Skip to content

Commit

Permalink
Update examples (#849)
Browse files Browse the repository at this point in the history
* Update three.js

* Add examples

* Updates

* Update patch

* Delete examples

* Add examples

* Update patch

* Delete examples
  • Loading branch information
Methuselah96 authored Feb 29, 2024
1 parent dd43883 commit ed280f8
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 27 deletions.
95 changes: 69 additions & 26 deletions examples-testing/changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6761,7 +6761,7 @@ index b3ca12c..47dca0a 100644
const geometry = new WireframeGeometry2(geo);

diff --git a/examples-testing/examples/webgl_loader_3dm.ts b/examples-testing/examples/webgl_loader_3dm.ts
index 545970a..c90ffcf 100644
index fc3b73d..218a5f1 100644
--- a/examples-testing/examples/webgl_loader_3dm.ts
+++ b/examples-testing/examples/webgl_loader_3dm.ts
@@ -5,8 +5,8 @@ import { Rhino3dmLoader } from 'three/addons/loaders/3DMLoader.js';
Expand All @@ -6775,16 +6775,16 @@ index 545970a..c90ffcf 100644

init();
animate();
@@ -36,7 +36,7 @@ function init() {
initGUI(object.userData.layers);

// hide spinner
- document.getElementById('loader').style.display = 'none';
+ document.getElementById('loader')!.style.display = 'none';
});
@@ -38,7 +38,7 @@ function init() {
initGUI(object.userData.layers);

controls = new OrbitControls(camera, renderer.domElement);
@@ -61,7 +61,7 @@ function animate() {
// hide spinner
- document.getElementById('loader').style.display = 'none';
+ document.getElementById('loader')!.style.display = 'none';
},
function (progress) {
console.log((progress.loaded / progress.total) * 100 + '%');
@@ -70,7 +70,7 @@ function animate() {
requestAnimationFrame(animate);
}

Expand Down Expand Up @@ -7783,7 +7783,7 @@ index b536ebd..1ec3b80 100644
init();
animate();
diff --git a/examples-testing/examples/webgl_loader_vrml.ts b/examples-testing/examples/webgl_loader_vrml.ts
index e7a7914..0ec3170 100644
index 242405a..407d284 100644
--- a/examples-testing/examples/webgl_loader_vrml.ts
+++ b/examples-testing/examples/webgl_loader_vrml.ts
@@ -6,7 +6,12 @@ import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
Expand All @@ -7800,7 +7800,7 @@ index e7a7914..0ec3170 100644

const params = {
asset: 'house',
@@ -28,7 +33,7 @@ const assets = [
@@ -29,7 +34,7 @@ const assets = [
'points',
];

Expand All @@ -7809,7 +7809,7 @@ index e7a7914..0ec3170 100644

init();
animate();
@@ -81,9 +86,14 @@ function init() {
@@ -82,9 +87,14 @@ function init() {
gui.add(params, 'asset', assets).onChange(function (value) {
if (vrmlScene) {
vrmlScene.traverse(function (object) {
Expand All @@ -7827,7 +7827,7 @@ index e7a7914..0ec3170 100644
});

scene.remove(vrmlScene);
@@ -93,7 +103,7 @@ function init() {
@@ -94,7 +104,7 @@ function init() {
});
}

Expand Down Expand Up @@ -13846,7 +13846,7 @@ index 3705045..7fc1806 100644
init();

diff --git a/examples-testing/examples/webgpu_clipping.ts b/examples-testing/examples/webgpu_clipping.ts
index ffd1e7c..c458d01 100644
index c89b95f..60e0571 100644
--- a/examples-testing/examples/webgpu_clipping.ts
+++ b/examples-testing/examples/webgpu_clipping.ts
@@ -12,7 +12,12 @@ import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
Expand All @@ -13862,7 +13862,7 @@ index ffd1e7c..c458d01 100644
+ stats: Stats;

init();
animate();

@@ -113,7 +118,7 @@ function init() {

// ***** Clipping setup (renderer): *****
Expand All @@ -13881,17 +13881,15 @@ index ffd1e7c..c458d01 100644
},
set Enabled(v) {
renderer.localClippingEnabled = v;
@@ -205,8 +210,8 @@ function onWindowResize() {
@@ -205,7 +210,7 @@ function onWindowResize() {
renderer.setSize(window.innerWidth, window.innerHeight);
}

-function animate(currentTime) {
- const time = (currentTime - startTime) / 1000;
+function animate(currentTime?: DOMHighResTimeStamp) {
+ const time = (currentTime! - startTime) / 1000;

requestAnimationFrame(animate);
+function animate(currentTime: DOMHighResTimeStamp) {
const time = (currentTime - startTime) / 1000;

object.position.y = 0.8;
diff --git a/examples-testing/examples/webgpu_lights_ies_spotlight.ts b/examples-testing/examples/webgpu_lights_ies_spotlight.ts
index 1430a29..58b951d 100644
--- a/examples-testing/examples/webgpu_lights_ies_spotlight.ts
Expand Down Expand Up @@ -13923,7 +13921,7 @@ index 1430a29..58b951d 100644

for (let i = 0; i < lights.length; i++) {
diff --git a/examples-testing/examples/webgpu_loader_gltf.ts b/examples-testing/examples/webgpu_loader_gltf.ts
index a4579e0..c63622e 100644
index d0fd310..7292c9e 100644
--- a/examples-testing/examples/webgpu_loader_gltf.ts
+++ b/examples-testing/examples/webgpu_loader_gltf.ts
@@ -10,7 +10,7 @@ import { RGBELoader } from 'three/addons/loaders/RGBELoader.js';
Expand Down Expand Up @@ -13987,7 +13985,7 @@ index b8fb383..0bcc65c 100644
const gui = new GUI();

diff --git a/examples-testing/examples/webgpu_materials_texture_anisotropy.ts b/examples-testing/examples/webgpu_materials_texture_anisotropy.ts
index 00672da..cf96e31 100644
index ca0ae9e..2125232 100644
--- a/examples-testing/examples/webgpu_materials_texture_anisotropy.ts
+++ b/examples-testing/examples/webgpu_materials_texture_anisotropy.ts
@@ -3,9 +3,9 @@ import * as THREE from 'three';
Expand All @@ -14002,7 +14000,7 @@ index 00672da..cf96e31 100644

let mouseX = 0,
mouseY = 0;
@@ -76,11 +76,11 @@ async function init() {
@@ -76,11 +76,11 @@ function init() {
texture2.repeat.set(512, 512);

if (maxAnisotropy > 0) {
Expand Down Expand Up @@ -14241,7 +14239,7 @@ index e042466..68f5e73 100644
init();

diff --git a/examples-testing/examples/webgpu_postprocessing_afterimage.ts b/examples-testing/examples/webgpu_postprocessing_afterimage.ts
index 86f21eb..bf2af6b 100644
index b89f292..c3cfcdf 100644
--- a/examples-testing/examples/webgpu_postprocessing_afterimage.ts
+++ b/examples-testing/examples/webgpu_postprocessing_afterimage.ts
@@ -5,9 +5,10 @@ import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
Expand Down Expand Up @@ -14589,3 +14587,48 @@ index 2baded4..9c3f5e7 100644
video.play();

const texture = new THREE.VideoTexture(video);
diff --git a/examples-testing/examples/webxr_xr_controls_transform.ts b/examples-testing/examples/webxr_xr_controls_transform.ts
index 12e2dbf..adcaad8 100644
--- a/examples-testing/examples/webxr_xr_controls_transform.ts
+++ b/examples-testing/examples/webxr_xr_controls_transform.ts
@@ -2,15 +2,16 @@ import * as THREE from 'three';
import { TransformControls } from 'three/addons/controls/TransformControls.js';
import { XRButton } from 'three/addons/webxr/XRButton.js';
import { XRControllerModelFactory } from 'three/addons/webxr/XRControllerModelFactory.js';
+import { Event } from 'three';

-let container;
-let camera, scene, renderer;
-let controller1, controller2, line;
-let controllerGrip1, controllerGrip2;
+let container: HTMLDivElement;
+let camera: THREE.PerspectiveCamera, scene: THREE.Scene, renderer: THREE.WebGLRenderer;
+let controller1: THREE.XRTargetRaySpace, controller2: THREE.XRTargetRaySpace, line: THREE.Line;
+let controllerGrip1: THREE.XRGripSpace, controllerGrip2: THREE.XRGripSpace;

-let raycaster;
+let raycaster: THREE.Raycaster;

-let controls, group;
+let controls: TransformControls, group: THREE.Group;

init();
animate();
@@ -148,7 +149,7 @@ function init() {
window.addEventListener('resize', onWindowResize);
}

-function onSelect(event) {
+function onSelect(event: Event<'select', THREE.XRTargetRaySpace>) {
const controller = event.target;

controller1.userData.active = false;
@@ -173,7 +174,7 @@ function onSelect(event) {
}
}

-function onControllerEvent(event) {
+function onControllerEvent(event: Event<'selectstart' | 'selectend' | 'move', THREE.XRTargetRaySpace>) {
const controller = event.target;

if (controller.userData.active === false) return;
2 changes: 1 addition & 1 deletion three.js
Submodule three.js updated 81 files
+2 −1 .eslintrc.json
+3 −3 .github/workflows/codeql-code-scanning.yml
+76 −56 build/three.cjs
+77 −56 build/three.module.js
+1 −1 build/three.module.min.js
+0 −1 docs/api/ar/core/bufferAttributeTypes/BufferAttributeTypes.html
+1 −1 docs/api/ar/helpers/GridHelper.html
+1 −1 docs/api/ar/helpers/PolarGridHelper.html
+0 −1 docs/api/en/core/bufferAttributeTypes/BufferAttributeTypes.html
+1 −1 docs/api/en/helpers/GridHelper.html
+1 −1 docs/api/en/helpers/PolarGridHelper.html
+0 −1 docs/api/it/core/bufferAttributeTypes/BufferAttributeTypes.html
+1 −1 docs/api/it/helpers/GridHelper.html
+1 −1 docs/api/it/helpers/PolarGridHelper.html
+0 −1 docs/api/ko/core/bufferAttributeTypes/BufferAttributeTypes.html
+4 −0 docs/api/zh/constants/CustomBlendingEquations.html
+0 −1 docs/api/zh/core/bufferAttributeTypes/BufferAttributeTypes.html
+1 −1 docs/api/zh/helpers/GridHelper.html
+1 −1 docs/api/zh/helpers/PolarGridHelper.html
+12 −5 docs/api/zh/materials/Material.html
+5 −0 docs/examples/en/controls/DragControls.html
+6 −6 docs/examples/en/loaders/3DMLoader.html
+10 −0 docs/examples/ko/controls/DragControls.html
+10 −0 docs/examples/zh/controls/DragControls.html
+0 −6 editor/css/main.css
+5 −4 editor/js/Sidebar.Object.Animation.js
+6 −0 editor/js/Sidebar.Object.js
+155 −0 editor/js/Sidebar.Project.Image.js
+3 −0 editor/js/Sidebar.Project.js
+1 −3 editor/js/Sidebar.js
+12 −3 editor/js/Strings.js
+11 −12 editor/js/Viewport.Info.js
+27 −8 editor/js/Viewport.js
+2 −1 editor/sw.js
+1 −0 examples/files.json
+28 −1 examples/jsm/controls/DragControls.js
+12 −5 examples/jsm/controls/OrbitControls.js
+1 −8,723 examples/jsm/libs/rhino3dm/rhino3dm.js
+1 −8,734 examples/jsm/libs/rhino3dm/rhino3dm.module.js
+ examples/jsm/libs/rhino3dm/rhino3dm.wasm
+13 −21 examples/jsm/loaders/3DMLoader.js
+9 −2 examples/jsm/loaders/VOXLoader.js
+6 −2 examples/jsm/loaders/VRMLLoader.js
+1 −1 examples/jsm/nodes/Nodes.js
+6 −0 examples/jsm/nodes/code/CodeNode.js
+13 −1 examples/jsm/nodes/core/AssignNode.js
+10 −0 examples/jsm/nodes/math/CondNode.js
+20 −0 examples/jsm/nodes/math/MathNode.js
+2 −2 examples/jsm/renderers/common/Background.js
+2 −0 examples/jsm/renderers/common/RenderContext.js
+50 −34 examples/jsm/renderers/common/Renderer.js
+1 −0 examples/jsm/renderers/common/Textures.js
+5 −3 examples/jsm/renderers/webgl/WebGLBackend.js
+2 −1 examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js
+8 −10 examples/jsm/renderers/webgpu/WebGPUBackend.js
+8 −0 examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js
+2 −2 examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js
+8 −0 examples/jsm/webxr/XRControllerModelFactory.js
+41 −0 examples/models/vrml/linesTransparent.wrl
+ examples/screenshots/webxr_xr_controls_transform.jpg
+8 −0 examples/webgl_loader_3dm.html
+1 −0 examples/webgl_loader_vrml.html
+54 −5 examples/webgl_morphtargets_webcam.html
+1 −3 examples/webgpu_clipping.html
+1 −1 examples/webgpu_compute_texture.html
+1 −1 examples/webgpu_instance_mesh.html
+1 −1 examples/webgpu_loader_gltf.html
+3 −9 examples/webgpu_materials_texture_anisotropy.html
+0 −1 examples/webgpu_mirror.html
+1 −2 examples/webgpu_postprocessing_afterimage.html
+1 −1 examples/webgpu_postprocessing_anamorphic.html
+0 −1 examples/webgpu_sandbox.html
+258 −0 examples/webxr_xr_controls_transform.html
+194 −192 package-lock.json
+1 −1 package.json
+1 −1 src/constants.js
+0 −11 src/core/BufferAttribute.js
+23 −29 src/core/BufferGeometry.js
+4 −4 src/core/Raycaster.js
+49 −11 src/renderers/webgl/WebGLTextures.js
+3 −27 test/unit/src/core/BufferAttribute.tests.js
5 changes: 5 additions & 0 deletions types/three/examples/jsm/controls/TransformControls.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ export class TransformControls extends Object3D<TransformControlsEventMap> {
RIGHT?: MOUSE | null | undefined;
};

pointerHover(pointer: PointerEvent | null): void;
pointerDown(pointer: PointerEvent | null): void;
pointerMove(pointer: PointerEvent | null): void;
pointerUp(pointer: PointerEvent | null): void;

attach(object: Object3D): this;
detach(): this;
getMode(): "translate" | "rotate" | "scale";
Expand Down

0 comments on commit ed280f8

Please sign in to comment.