Skip to content

Commit 8d30d74

Browse files
committed
Updated builds
1 parent 0dfb9b0 commit 8d30d74

File tree

3 files changed

+75
-13
lines changed

3 files changed

+75
-13
lines changed

build/three.js

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5456,7 +5456,19 @@
54565456
return element.uuid;
54575457
}
54585458

5459-
if (this.isMesh || this.isLine || this.isPoints) {
5459+
if (this.isScene) {
5460+
if (this.background) {
5461+
if (this.background.isColor) {
5462+
object.background = this.background.toJSON();
5463+
} else if (this.background.isTexture) {
5464+
object.background = this.background.toJSON(meta).uuid;
5465+
}
5466+
}
5467+
5468+
if (this.environment && this.environment.isTexture) {
5469+
object.environment = this.environment.toJSON(meta).uuid;
5470+
}
5471+
} else if (this.isMesh || this.isLine || this.isPoints) {
54605472
object.geometry = serialize(meta.geometries, this.geometry);
54615473
const parameters = this.geometry.parameters;
54625474

@@ -18599,6 +18611,7 @@
1859918611

1860018612
if (capabilities.isWebGL2) {
1860118613
// Workaround for https://bugs.chromium.org/p/chromium/issues/detail?id=1120100
18614+
// Not needed in Chrome 93+
1860218615
if (glFormat === _gl.RGB) glFormat = _gl.RGB8;
1860318616
if (glFormat === _gl.RGBA) glFormat = _gl.RGBA8;
1860418617
}
@@ -18826,8 +18839,6 @@
1882618839

1882718840
toJSON(meta) {
1882818841
const data = super.toJSON(meta);
18829-
if (this.background !== null) data.object.background = this.background.toJSON(meta);
18830-
if (this.environment !== null) data.object.environment = this.environment.toJSON(meta);
1883118842
if (this.fog !== null) data.object.fog = this.fog.toJSON();
1883218843
return data;
1883318844
}
@@ -28362,7 +28373,7 @@
2836228373
});
2836328374
const textures = this.parseTextures(json.textures, images);
2836428375
const materials = this.parseMaterials(json.materials, textures);
28365-
const object = this.parseObject(json.object, geometries, materials, animations);
28376+
const object = this.parseObject(json.object, geometries, materials, textures, animations);
2836628377
const skeletons = this.parseSkeletons(json.skeletons, object);
2836728378
this.bindSkeletons(object, skeletons); //
2836828379

@@ -28745,7 +28756,7 @@
2874528756
return textures;
2874628757
}
2874728758

28748-
parseObject(data, geometries, materials, animations) {
28759+
parseObject(data, geometries, materials, textures, animations) {
2874928760
let object;
2875028761

2875128762
function getGeometry(name) {
@@ -28782,6 +28793,14 @@
2878228793
return materials[name];
2878328794
}
2878428795

28796+
function getTexture(uuid) {
28797+
if (textures[uuid] === undefined) {
28798+
console.warn('THREE.ObjectLoader: Undefined texture', uuid);
28799+
}
28800+
28801+
return textures[uuid];
28802+
}
28803+
2878528804
let geometry, material;
2878628805

2878728806
switch (data.type) {
@@ -28791,9 +28810,13 @@
2879128810
if (data.background !== undefined) {
2879228811
if (Number.isInteger(data.background)) {
2879328812
object.background = new Color(data.background);
28813+
} else {
28814+
object.background = getTexture(data.background);
2879428815
}
2879528816
}
2879628817

28818+
if (data.environment !== undefined) object.environment = getTexture(data.environment);
28819+
2879728820
if (data.fog !== undefined) {
2879828821
if (data.fog.type === 'Fog') {
2879928822
object.fog = new Fog(data.fog.color, data.fog.near, data.fog.far);
@@ -28945,7 +28968,7 @@
2894528968
const children = data.children;
2894628969

2894728970
for (let i = 0; i < children.length; i++) {
28948-
object.add(this.parseObject(children[i], geometries, materials, animations));
28971+
object.add(this.parseObject(children[i], geometries, materials, textures, animations));
2894928972
}
2895028973
}
2895128974

build/three.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/three.module.js

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7174,7 +7174,29 @@ class Object3D extends EventDispatcher {
71747174

71757175
}
71767176

7177-
if ( this.isMesh || this.isLine || this.isPoints ) {
7177+
if ( this.isScene ) {
7178+
7179+
if ( this.background ) {
7180+
7181+
if ( this.background.isColor ) {
7182+
7183+
object.background = this.background.toJSON();
7184+
7185+
} else if ( this.background.isTexture ) {
7186+
7187+
object.background = this.background.toJSON( meta ).uuid;
7188+
7189+
}
7190+
7191+
}
7192+
7193+
if ( this.environment && this.environment.isTexture ) {
7194+
7195+
object.environment = this.environment.toJSON( meta ).uuid;
7196+
7197+
}
7198+
7199+
} else if ( this.isMesh || this.isLine || this.isPoints ) {
71787200

71797201
object.geometry = serialize( meta.geometries, this.geometry );
71807202

@@ -25349,6 +25371,7 @@ function WebGLRenderer( parameters = {} ) {
2534925371
if ( capabilities.isWebGL2 ) {
2535025372

2535125373
// Workaround for https://bugs.chromium.org/p/chromium/issues/detail?id=1120100
25374+
// Not needed in Chrome 93+
2535225375

2535325376
if ( glFormat === 6407 ) glFormat = 32849;
2535425377
if ( glFormat === 6408 ) glFormat = 32856;
@@ -25627,8 +25650,6 @@ class Scene extends Object3D {
2562725650

2562825651
const data = super.toJSON( meta );
2562925652

25630-
if ( this.background !== null ) data.object.background = this.background.toJSON( meta );
25631-
if ( this.environment !== null ) data.object.environment = this.environment.toJSON( meta );
2563225653
if ( this.fog !== null ) data.object.fog = this.fog.toJSON();
2563325654

2563425655
return data;
@@ -39177,7 +39198,7 @@ class ObjectLoader extends Loader {
3917739198
const textures = this.parseTextures( json.textures, images );
3917839199
const materials = this.parseMaterials( json.materials, textures );
3917939200

39180-
const object = this.parseObject( json.object, geometries, materials, animations );
39201+
const object = this.parseObject( json.object, geometries, materials, textures, animations );
3918139202
const skeletons = this.parseSkeletons( json.skeletons, object );
3918239203

3918339204
this.bindSkeletons( object, skeletons );
@@ -39833,7 +39854,7 @@ class ObjectLoader extends Loader {
3983339854

3983439855
}
3983539856

39836-
parseObject( data, geometries, materials, animations ) {
39857+
parseObject( data, geometries, materials, textures, animations ) {
3983739858

3983839859
let object;
3983939860

@@ -39885,6 +39906,18 @@ class ObjectLoader extends Loader {
3988539906

3988639907
}
3988739908

39909+
function getTexture( uuid ) {
39910+
39911+
if ( textures[ uuid ] === undefined ) {
39912+
39913+
console.warn( 'THREE.ObjectLoader: Undefined texture', uuid );
39914+
39915+
}
39916+
39917+
return textures[ uuid ];
39918+
39919+
}
39920+
3988839921
let geometry, material;
3988939922

3989039923
switch ( data.type ) {
@@ -39899,10 +39932,16 @@ class ObjectLoader extends Loader {
3989939932

3990039933
object.background = new Color( data.background );
3990139934

39935+
} else {
39936+
39937+
object.background = getTexture( data.background );
39938+
3990239939
}
3990339940

3990439941
}
3990539942

39943+
if ( data.environment !== undefined ) object.environment = getTexture( data.environment );
39944+
3990639945
if ( data.fog !== undefined ) {
3990739946

3990839947
if ( data.fog.type === 'Fog' ) {
@@ -40118,7 +40157,7 @@ class ObjectLoader extends Loader {
4011840157

4011940158
for ( let i = 0; i < children.length; i ++ ) {
4012040159

40121-
object.add( this.parseObject( children[ i ], geometries, materials, animations ) );
40160+
object.add( this.parseObject( children[ i ], geometries, materials, textures, animations ) );
4012240161

4012340162
}
4012440163

0 commit comments

Comments
 (0)