Skip to content

Commit

Permalink
R151 redux (#4192)
Browse files Browse the repository at this point in the history
* updated to three.js r151

* r151.2

* updated goldens

* DO NOT USE LEGACY LIGHTS

* fix two goldens
  • Loading branch information
elalish authored Apr 1, 2023
1 parent 866c03f commit 2846fee
Show file tree
Hide file tree
Showing 89 changed files with 829 additions and 716 deletions.
437 changes: 225 additions & 212 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/model-viewer/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ module.exports = function(config) {
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox'],
flags: ['--no-sandbox', '--use-angle=metal'],
}
},
});
Expand Down
397 changes: 227 additions & 170 deletions packages/model-viewer/package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions packages/model-viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"lit": "^2.2.3"
},
"peerDependencies": {
"three": "^0.150.0"
"three": "^0.151.2"
},
"devDependencies": {
"@open-wc/karma-esm": "^4.0.0",
Expand All @@ -86,7 +86,7 @@
"@types/chai": "^4.3.1",
"@types/mocha": "^9.1.1",
"@types/pngjs": "^6.0.1",
"@types/three": "^0.149.0",
"@types/three": "^0.150.0",
"@ungap/event-target": "^0.2.3",
"chai": "^4.3.6",
"focus-visible": "^5.2.0",
Expand All @@ -106,7 +106,7 @@
"rollup-plugin-polyfill": "^3.0.0",
"rollup-plugin-terser": "^7.0.2",
"typescript": "4.8.4",
"three": "^0.150.0"
"three": "^0.151.2"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 2 additions & 2 deletions packages/model-viewer/src/features/scene-graph/material.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

import {Color, DoubleSide, FrontSide, MeshStandardMaterial} from 'three';
import {Color, ColorRepresentation, DoubleSide, FrontSide, MeshStandardMaterial} from 'three';

import {AlphaMode, GLTF, Material as GLTFMaterial, RGB} from '../../three-components/gltf-instance/gltf-2.0.js';
import {Material as DefaultedMaterial} from '../../three-components/gltf-instance/gltf-defaulted.js';
Expand Down Expand Up @@ -258,7 +258,7 @@ export class Material extends ThreeDOMElement implements MaterialInterface {
if (rgb instanceof Array) {
color.fromArray(rgb);
} else {
color.set(rgb).convertSRGBToLinear();
color.set(rgb as ColorRepresentation).convertSRGBToLinear();
}
for (const material of this[$correlatedObjects] as
Set<MeshStandardMaterial>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

import {Color, MeshStandardMaterial} from 'three';
import {Color, ColorRepresentation, MeshStandardMaterial} from 'three';

import {GLTF, PBRMetallicRoughness as GLTFPBRMetallicRoughness} from '../../three-components/gltf-instance/gltf-2.0.js';
import {PBRMetallicRoughness as DefaultedPBRMetallicRoughness} from '../../three-components/gltf-instance/gltf-defaulted.js';
Expand Down Expand Up @@ -110,7 +110,7 @@ export class PBRMetallicRoughness extends ThreeDOMElement implements
if (rgba instanceof Array) {
color.fromArray(rgba);
} else {
color.set(rgba).convertSRGBToLinear();
color.set(rgba as ColorRepresentation).convertSRGBToLinear();
}
for (const material of this[$threeMaterials]) {
material.color.set(color);
Expand Down
5 changes: 3 additions & 2 deletions packages/model-viewer/src/three-components/ModelScene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

import {AnimationAction, AnimationClip, AnimationMixer, Box3, Camera, Euler, Event as ThreeEvent, LoopPingPong, LoopRepeat, Material, Matrix3, Mesh, Object3D, PerspectiveCamera, Raycaster, Scene, Sphere, Texture, Triangle, Vector2, Vector3, WebGLRenderer} from 'three';
import {AnimationAction, AnimationActionLoopStyles, AnimationClip, AnimationMixer, Box3, Camera, Euler, Event as ThreeEvent, LoopPingPong, LoopRepeat, Material, Matrix3, Mesh, Object3D, PerspectiveCamera, Raycaster, Scene, Sphere, Texture, Triangle, Vector2, Vector3, WebGLRenderer} from 'three';
import {CSS2DRenderer} from 'three/examples/jsm/renderers/CSS2DRenderer.js';
// @ts-ignore
import {reduceVertices} from 'three/examples/jsm/utils/SceneUtils.js';
Expand Down Expand Up @@ -663,7 +663,8 @@ export class ModelScene extends Scene {
*/
playAnimation(
name: string|null = null, crossfadeTime: number = 0,
loopMode: number = LoopRepeat, repetitionCount: number = Infinity) {
loopMode: AnimationActionLoopStyles = LoopRepeat,
repetitionCount: number = Infinity) {
if (this._currentGLTF == null) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/model-viewer/src/three-components/Renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export class Renderer extends EventDispatcher {
});
this.threeRenderer.autoClear = true;
this.threeRenderer.outputEncoding = sRGBEncoding;
this.threeRenderer.physicallyCorrectLights = true;
this.threeRenderer.useLegacyLights = false;
this.threeRenderer.setPixelRatio(1); // handle pixel ratio externally

this.debugger = !!options.debug ? new Debugger(this) : null;
Expand Down
49 changes: 25 additions & 24 deletions packages/modelviewer.dev/package-lock.json

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

Loading

0 comments on commit 2846fee

Please sign in to comment.