Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Three.js into r128 #4321

Merged
merged 46 commits into from
Jul 27, 2021
Merged
Changes from 32 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
96e5c29
Fix skybox.js for the upstreaming Three.js
takahirox Jun 2, 2021
dd91daa
Replace BatchManagerSystem with a stub
takahirox Jun 2, 2021
d7b3b07
Replace deprecated renderer.vr with renderer.xr
takahirox Jun 5, 2021
021031a
Replace deprecated Quaternion.inverse with Quaternion.invert
takahirox Jun 5, 2021
34e6cfc
Replace deprecate .applyMatrix with .applyMatrix4
takahirox Jun 5, 2021
e98ebb8
Replace deprecated Matrix4.getInverse() with Matrix4.copy(src).invert()
takahirox Jun 7, 2021
2c1ce20
Replace deprecated Quaternion.slerp() with Quaternion.slerpQuaternions()
takahirox Jun 7, 2021
1d1ef75
Replace deprecated WebGLRenderer.gammaOutput with WebGLRenderer.outpu…
takahirox Jun 7, 2021
b3d6f81
Replace deprecated Frustum.setFromMatrix() with Frustum.setFromProjec…
takahirox Jun 7, 2021
01c6450
Introduce createPlaneBufferGeometry() util function
takahirox Jun 7, 2021
18c23d3
Remove deprecated Mesh.drawMode
takahirox Jun 7, 2021
4ea709e
Clean up nav.js, use BufferGeometry.
takahirox Jun 7, 2021
ddd1ba0
Replace our special WebGLRenderer.compileAndUploadMaterials() with We…
takahirox Jun 7, 2021
c43f2ea
Follow the latest WebGLCubeRenderTarget API
takahirox Jun 7, 2021
d1c4f2f
Follow the latest PMREMGenerator API
takahirox Jun 7, 2021
ed8339b
Clean up
takahirox Jun 7, 2021
41d3f9e
Disable ImageBitmap for Firefox in HubsTextureLoader as temporal work…
takahirox Jun 7, 2021
bc7e05c
Refactor HubsTextureLoader
takahirox Jun 7, 2021
e3efddb
Replace Three.js TextureLoader with HubsTextureLoader
takahirox Jun 7, 2021
7038476
Bump Three.js into r128
takahirox Jun 8, 2021
741edfb
Bump three-mesh-bvh to 0.3.7
takahirox Jun 8, 2021
02498b4
Bump aframe to the newer one. We need to update the link when hubs/ma…
takahirox Jun 8, 2021
e16c3f1
Bump three-pathfinding to the newer one. We need to update the link w…
takahirox Jun 8, 2021
37021a1
Bump three-to-ammo into the newer one. We need to update the link to …
takahirox Jun 8, 2021
e42ce42
Bump buffered-interpolation to the newer one. We need to update the l…
takahirox Jun 8, 2021
c315804
Bump three-bmfont-text into the newer one. We need to update the link…
takahirox Jun 8, 2021
959e9d0
Bump three-ammo into the newer one. We need to update the link to the…
takahirox Jun 9, 2021
e46019c
Import WebXR polyfill for platforms supporting only WebVR e.g. Firefo…
takahirox Jun 9, 2021
19b30ae
Delint
takahirox Jun 9, 2021
22af86c
Use require instead of import to import modules under the three/examp…
takahirox Jun 10, 2021
873ffd1
BufferAttribute._itemSize is .itemSize in Three.js r128
takahirox Jun 10, 2021
b3e197a
Fix teleporter ray rendering to use triangles
netpro2k Jun 11, 2021
8a36363
Update physics-utils to follow the new three-mesh-bvh API.
takahirox Jun 11, 2021
60ce1d4
Fix unlit materials with no emissive map
netpro2k Jun 11, 2021
8590e26
Use include for unlit emissive shader chunk
netpro2k Jun 11, 2021
22db3b8
Replace deprecated renderer.vr API with renderer.xr
takahirox Jun 21, 2021
869c68a
Remove webxr-bypass-hacks.js
takahirox Jun 22, 2021
5d850df
Write Gamepad.hand property only if it is undefined to avoid writing …
takahirox Jun 22, 2021
4343809
Fix upside-down small emojis
takahirox Jun 23, 2021
8462298
Import the upstreaming three-pathfinding
takahirox Jun 23, 2021
c9fb8db
Merge remote-tracking branch 'upstream/master' into LatestThree
takahirox Jun 24, 2021
1a2668f
Apply a monkeypatch to Three.js Raycast API for visibility based rayc…
takahirox Jul 12, 2021
ce00ffa
Fix audio icon flipY problem
takahirox Jul 15, 2021
69cc235
Import webxr-polyfill before importing other modules
takahirox Jul 27, 2021
027df04
Merge branch 'master' into LatestThree
takahirox Jul 27, 2021
c53c8c4
Update package.json and package-lock.json
takahirox Jul 27, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 32 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -76,13 +76,13 @@
"@mozillareality/easing-functions": "^0.1.1",
"@mozillareality/three-batch-manager": "github:mozillareality/three-batch-manager#master",
"@popperjs/core": "^2.4.4",
"aframe": "github:mozillareality/aframe#hubs/master",
"aframe": "github:takahirox/aframe#hubs/LatestThreeWIP",
"aframe-rounded": "^1.0.3",
"aframe-slice9-component": "^1.0.0",
"ammo-debug-drawer": "github:infinitelee/ammo-debug-drawer",
"ammo.js": "github:mozillareality/ammo.js#hubs/master",
"animejs": "github:mozillareality/anime#hubs/master",
"buffered-interpolation": "^0.2.5",
"buffered-interpolation": "github:takahirox/buffered-interpolation#LatestThree",
"classnames": "^2.2.5",
"color": "^3.1.2",
"copy-to-clipboard": "^3.0.8",
@@ -134,15 +134,16 @@
"resize-observer-polyfill": "^1.5.1",
"screenfull": "^4.0.1",
"semver": "^7.3.2",
"three": "github:mozillareality/three.js#hubs/master",
"three-ammo": "^1.0.12",
"three-bmfont-text": "github:mozillareality/three-bmfont-text#hubs/master",
"three-mesh-bvh": "^0.1.2",
"three-pathfinding": "github:MozillaReality/three-pathfinding#hubs/master2",
"three-to-ammo": "github:infinitelee/three-to-ammo",
"three": "^0.128.0",
"three-ammo": "github:takahirox/three-ammo#LatestThree",
"three-bmfont-text": "github:takahirox/three-bmfont-text#hubs/LatestThree",
"three-mesh-bvh": "^0.3.7",
"three-pathfinding": "github:takahirox/three-pathfinding#hubs/master3",
takahirox marked this conversation as resolved.
Show resolved Hide resolved
"three-to-ammo": "github:takahirox/three-to-ammo#LatestThree",
"use-clipboard-copy": "^0.1.2",
"uuid": "^3.2.1",
"webrtc-adapter": "^7.7.0",
"webxr-polyfill": "^2.0.3",
"zip-loader": "^1.1.0"
},
"devDependencies": {
6 changes: 3 additions & 3 deletions src/components/camera-tool.js
Original file line number Diff line number Diff line change
@@ -634,10 +634,10 @@ AFRAME.registerComponent("camera-tool", {
boneVisibilitySystem.tick();
}

const tmpVRFlag = renderer.vr.enabled;
const tmpVRFlag = renderer.xr.enabled;
const tmpOnAfterRender = sceneEl.object3D.onAfterRender;
delete sceneEl.object3D.onAfterRender;
renderer.vr.enabled = false;
renderer.xr.enabled = false;

if (allowVideo && this.videoRecorder && !this.videoRenderTarget) {
// Create a separate render target for video becuase we need to flip and (sometimes) downscale it before
@@ -659,7 +659,7 @@ AFRAME.registerComponent("camera-tool", {
renderer.render(sceneEl.object3D, this.camera);
renderer.setRenderTarget(null);

renderer.vr.enabled = tmpVRFlag;
renderer.xr.enabled = tmpVRFlag;
sceneEl.object3D.onAfterRender = tmpOnAfterRender;
if (playerHead) {
playerHead.visible = false;
11 changes: 5 additions & 6 deletions src/components/ik-controller.js
Original file line number Diff line number Diff line change
@@ -160,7 +160,7 @@ AFRAME.registerComponent("ik-controller", {
this.middleEyePosition.addVectors(this.leftEye.position, this.rightEye.position);
this.middleEyePosition.divideScalar(2);
this.middleEyeMatrix.makeTranslation(this.middleEyePosition.x, this.middleEyePosition.y, this.middleEyePosition.z);
this.invMiddleEyeToHead = this.middleEyeMatrix.getInverse(this.middleEyeMatrix);
this.invMiddleEyeToHead = this.middleEyeMatrix.copy(this.middleEyeMatrix).invert();

this.invHipsToHeadVector
.addVectors(this.chest.position, this.neck.position)
@@ -242,10 +242,9 @@ AFRAME.registerComponent("ik-controller", {
if (yDelta > this.data.maxLerpAngle) {
avatar.quaternion.copy(cameraYQuaternion);
} else {
Quaternion.slerp(
avatar.quaternion.slerpQuaternions(
avatar.quaternion,
cameraYQuaternion,
avatar.quaternion,
(this.data.rotationSpeed * dt) / 1000
);
}
@@ -257,12 +256,12 @@ AFRAME.registerComponent("ik-controller", {

// Take the head orientation computed from the hmd, remove the Y rotation already applied to it by the hips,
// and apply it to the head
invHipsQuaternion.copy(avatar.quaternion).inverse();
invHipsQuaternion.copy(avatar.quaternion).invert();
head.quaternion.setFromRotationMatrix(headTransform).premultiply(invHipsQuaternion);

avatar.updateMatrix();
rootToChest.multiplyMatrices(avatar.matrix, chest.matrix);
invRootToChest.getInverse(rootToChest);
invRootToChest.copy(rootToChest).invert();

root.matrixNeedsUpdate = true;
neck.matrixNeedsUpdate = true;
@@ -324,7 +323,7 @@ AFRAME.registerComponent("ik-controller", {
const cameraWorld = new THREE.Vector3();
const isInViewOfCamera = (screenCamera, pos) => {
frustumMatrix.multiplyMatrices(screenCamera.projectionMatrix, screenCamera.matrixWorldInverse);
frustum.setFromMatrix(frustumMatrix);
frustum.setFromProjectionMatrix(frustumMatrix);
return frustum.containsPoint(pos);
};

8 changes: 5 additions & 3 deletions src/components/media-views.js
Original file line number Diff line number Diff line change
@@ -17,6 +17,8 @@ import { applyPersistentSync } from "../utils/permissions-utils";
import { refreshMediaMirror, getCurrentMirroredMedia } from "../utils/mirror-utils";
import { detect } from "detect-browser";
import semver from "semver";
import { createPlaneBufferGeometry } from "../utils/three-utils";
import HubsTextureLoader from "../loaders/HubsTextureLoader";

import qsTruthy from "../utils/qs_truthy";

@@ -38,7 +40,7 @@ const TYPE_IMG_PNG = { type: "image/png" };
const parseGIF = promisifyWorker(new GIFWorker());

const isIOS = AFRAME.utils.device.isIOS();
const audioIconTexture = new THREE.TextureLoader().load(audioIcon);
const audioIconTexture = new HubsTextureLoader().load(audioIcon);

export const VOLUME_LABELS = [];
for (let i = 0; i <= 20; i++) {
@@ -1163,7 +1165,7 @@ AFRAME.registerComponent("media-image", {
}
}
} else {
geometry = new THREE.PlaneBufferGeometry(1, 1, 1, 1, texture.flipY);
geometry = createPlaneBufferGeometry(1, 1, 1, 1, texture.flipY);
material.side = THREE.DoubleSide;
}

@@ -1304,7 +1306,7 @@ AFRAME.registerComponent("media-pdf", {

if (!this.mesh) {
const material = new THREE.MeshBasicMaterial();
const geometry = new THREE.PlaneBufferGeometry(1, 1, 1, 1, texture.flipY);
const geometry = createPlaneBufferGeometry(1, 1, 1, 1, texture.flipY);
material.side = THREE.DoubleSide;

this.mesh = new THREE.Mesh(geometry, material);
4 changes: 1 addition & 3 deletions src/components/particle-emitter.js
Original file line number Diff line number Diff line change
@@ -57,9 +57,7 @@ AFRAME.registerComponent("particle-emitter", {
accessibleUrl = proxiedUrlFor(canonicalUrl);
}

const texture = new THREE.Texture();

await textureLoader.loadTextureAsync(texture, accessibleUrl);
const texture = await textureLoader.loadAsync(accessibleUrl);

// Guard against src changing while request was in flight
if (this.data.src !== src) {
2 changes: 1 addition & 1 deletion src/components/pitch-yaw-rotator.js
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ const rotatePitchAndYaw = (function() {
q.copy(owq)
.premultiply(pq)
.premultiply(yq)
.premultiply(opq.inverse());
.premultiply(opq.invert());
v.set(0, 1, 0).applyQuaternion(q);
const newUpDot = v.dot(UP);
v.set(0, 0, 1).applyQuaternion(q);
2 changes: 1 addition & 1 deletion src/components/scene-preview-camera.js
Original file line number Diff line number Diff line change
@@ -80,7 +80,7 @@ AFRAME.registerComponent("scene-preview-camera", {
const fromRot = this.backwards ? this.targetRotation : this.startRotation;
const toRot = this.backwards ? this.startRotation : this.targetRotation;

THREE.Quaternion.slerp(fromRot, toRot, newRot, t);
newRot.slerpQuaternions(fromRot, toRot, t);

this.el.object3D.position.set(lerp(from.x, to.x, t), lerp(from.y, to.y, t), lerp(from.z, to.z, t));

13 changes: 3 additions & 10 deletions src/components/simple-water.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import { SimplexNoise } from "three/examples/jsm/math/SimplexNoise";
import waterNormalsUrl from "../assets/waternormals.jpg";
import HubsTextureLoader from "../loaders/HubsTextureLoader";

const {
Mesh,
PlaneBufferGeometry,
MeshStandardMaterial,
MeshPhongMaterial,
Vector2,
TextureLoader,
RepeatWrapping
} = THREE;
const { Mesh, PlaneBufferGeometry, MeshStandardMaterial, MeshPhongMaterial, Vector2, RepeatWrapping } = THREE;

/**
* SimpleWater
@@ -287,7 +280,7 @@ AFRAME.registerComponent("simple-water", {

init() {
if (!waterNormalMap) {
waterNormalMap = new TextureLoader().load(waterNormalsUrl);
waterNormalMap = new HubsTextureLoader().load(waterNormalsUrl);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of scope for this PR, but I wonder if we should just use a single instance of HubsTextureLoader for the whole app.

}

const usePhongShader = window.APP.store.materialQualitySetting !== "high";
Loading