Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
8d30d742
T
three.js
项目概览
车家大少爷
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8d30d742
编写于
6月 19, 2021
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds
上级
0dfb9b02
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
75 addition
and
13 deletion
+75
-13
build/three.js
build/three.js
+29
-6
build/three.min.js
build/three.min.js
+1
-1
build/three.module.js
build/three.module.js
+45
-6
未找到文件。
build/three.js
浏览文件 @
8d30d742
...
@@ -5456,7 +5456,19 @@
...
@@ -5456,7 +5456,19 @@
return element.uuid;
return element.uuid;
}
}
if (this.isMesh || this.isLine || this.isPoints) {
if (this.isScene) {
if (this.background) {
if (this.background.isColor) {
object.background = this.background.toJSON();
} else if (this.background.isTexture) {
object.background = this.background.toJSON(meta).uuid;
}
}
if (this.environment && this.environment.isTexture) {
object.environment = this.environment.toJSON(meta).uuid;
}
} else if (this.isMesh || this.isLine || this.isPoints) {
object.geometry = serialize(meta.geometries, this.geometry);
object.geometry = serialize(meta.geometries, this.geometry);
const parameters = this.geometry.parameters;
const parameters = this.geometry.parameters;
...
@@ -18599,6 +18611,7 @@
...
@@ -18599,6 +18611,7 @@
if (capabilities.isWebGL2) {
if (capabilities.isWebGL2) {
// Workaround for https://bugs.chromium.org/p/chromium/issues/detail?id=1120100
// Workaround for https://bugs.chromium.org/p/chromium/issues/detail?id=1120100
// Not needed in Chrome 93+
if (glFormat === _gl.RGB) glFormat = _gl.RGB8;
if (glFormat === _gl.RGB) glFormat = _gl.RGB8;
if (glFormat === _gl.RGBA) glFormat = _gl.RGBA8;
if (glFormat === _gl.RGBA) glFormat = _gl.RGBA8;
}
}
...
@@ -18826,8 +18839,6 @@
...
@@ -18826,8 +18839,6 @@
toJSON(meta) {
toJSON(meta) {
const data = super.toJSON(meta);
const data = super.toJSON(meta);
if (this.background !== null) data.object.background = this.background.toJSON(meta);
if (this.environment !== null) data.object.environment = this.environment.toJSON(meta);
if (this.fog !== null) data.object.fog = this.fog.toJSON();
if (this.fog !== null) data.object.fog = this.fog.toJSON();
return data;
return data;
}
}
...
@@ -28362,7 +28373,7 @@
...
@@ -28362,7 +28373,7 @@
});
});
const textures = this.parseTextures(json.textures, images);
const textures = this.parseTextures(json.textures, images);
const materials = this.parseMaterials(json.materials, textures);
const materials = this.parseMaterials(json.materials, textures);
const object = this.parseObject(json.object, geometries, materials, animations);
const object = this.parseObject(json.object, geometries, materials,
textures,
animations);
const skeletons = this.parseSkeletons(json.skeletons, object);
const skeletons = this.parseSkeletons(json.skeletons, object);
this.bindSkeletons(object, skeletons); //
this.bindSkeletons(object, skeletons); //
...
@@ -28745,7 +28756,7 @@
...
@@ -28745,7 +28756,7 @@
return textures;
return textures;
}
}
parseObject(data, geometries, materials, animations) {
parseObject(data, geometries, materials,
textures,
animations) {
let object;
let object;
function getGeometry(name) {
function getGeometry(name) {
...
@@ -28782,6 +28793,14 @@
...
@@ -28782,6 +28793,14 @@
return materials[name];
return materials[name];
}
}
function getTexture(uuid) {
if (textures[uuid] === undefined) {
console.warn('THREE.ObjectLoader: Undefined texture', uuid);
}
return textures[uuid];
}
let geometry, material;
let geometry, material;
switch (data.type) {
switch (data.type) {
...
@@ -28791,9 +28810,13 @@
...
@@ -28791,9 +28810,13 @@
if (data.background !== undefined) {
if (data.background !== undefined) {
if (Number.isInteger(data.background)) {
if (Number.isInteger(data.background)) {
object.background = new Color(data.background);
object.background = new Color(data.background);
} else {
object.background = getTexture(data.background);
}
}
}
}
if (data.environment !== undefined) object.environment = getTexture(data.environment);
if (data.fog !== undefined) {
if (data.fog !== undefined) {
if (data.fog.type === 'Fog') {
if (data.fog.type === 'Fog') {
object.fog = new Fog(data.fog.color, data.fog.near, data.fog.far);
object.fog = new Fog(data.fog.color, data.fog.near, data.fog.far);
...
@@ -28945,7 +28968,7 @@
...
@@ -28945,7 +28968,7 @@
const children = data.children;
const children = data.children;
for (let i = 0; i < children.length; i++) {
for (let i = 0; i < children.length; i++) {
object.add(this.parseObject(children[i], geometries, materials, animations));
object.add(this.parseObject(children[i], geometries, materials,
textures,
animations));
}
}
}
}
build/three.min.js
浏览文件 @
8d30d742
此差异已折叠。
点击以展开。
build/three.module.js
浏览文件 @
8d30d742
...
@@ -7174,7 +7174,29 @@ class Object3D extends EventDispatcher {
...
@@ -7174,7 +7174,29 @@ class Object3D extends EventDispatcher {
}
}
if ( this.isMesh || this.isLine || this.isPoints ) {
if ( this.isScene ) {
if ( this.background ) {
if ( this.background.isColor ) {
object.background = this.background.toJSON();
} else if ( this.background.isTexture ) {
object.background = this.background.toJSON( meta ).uuid;
}
}
if ( this.environment && this.environment.isTexture ) {
object.environment = this.environment.toJSON( meta ).uuid;
}
} else if ( this.isMesh || this.isLine || this.isPoints ) {
object.geometry = serialize( meta.geometries, this.geometry );
object.geometry = serialize( meta.geometries, this.geometry );
...
@@ -25349,6 +25371,7 @@ function WebGLRenderer( parameters = {} ) {
...
@@ -25349,6 +25371,7 @@ function WebGLRenderer( parameters = {} ) {
if ( capabilities.isWebGL2 ) {
if ( capabilities.isWebGL2 ) {
// Workaround for https://bugs.chromium.org/p/chromium/issues/detail?id=1120100
// Workaround for https://bugs.chromium.org/p/chromium/issues/detail?id=1120100
// Not needed in Chrome 93+
if ( glFormat === 6407 ) glFormat = 32849;
if ( glFormat === 6407 ) glFormat = 32849;
if ( glFormat === 6408 ) glFormat = 32856;
if ( glFormat === 6408 ) glFormat = 32856;
...
@@ -25627,8 +25650,6 @@ class Scene extends Object3D {
...
@@ -25627,8 +25650,6 @@ class Scene extends Object3D {
const data = super.toJSON( meta );
const data = super.toJSON( meta );
if ( this.background !== null ) data.object.background = this.background.toJSON( meta );
if ( this.environment !== null ) data.object.environment = this.environment.toJSON( meta );
if ( this.fog !== null ) data.object.fog = this.fog.toJSON();
if ( this.fog !== null ) data.object.fog = this.fog.toJSON();
return data;
return data;
...
@@ -39177,7 +39198,7 @@ class ObjectLoader extends Loader {
...
@@ -39177,7 +39198,7 @@ class ObjectLoader extends Loader {
const textures = this.parseTextures( json.textures, images );
const textures = this.parseTextures( json.textures, images );
const materials = this.parseMaterials( json.materials, textures );
const materials = this.parseMaterials( json.materials, textures );
const object = this.parseObject( json.object, geometries, materials, animations );
const object = this.parseObject( json.object, geometries, materials,
textures,
animations );
const skeletons = this.parseSkeletons( json.skeletons, object );
const skeletons = this.parseSkeletons( json.skeletons, object );
this.bindSkeletons( object, skeletons );
this.bindSkeletons( object, skeletons );
...
@@ -39833,7 +39854,7 @@ class ObjectLoader extends Loader {
...
@@ -39833,7 +39854,7 @@ class ObjectLoader extends Loader {
}
}
parseObject( data, geometries, materials, animations ) {
parseObject( data, geometries, materials,
textures,
animations ) {
let object;
let object;
...
@@ -39885,6 +39906,18 @@ class ObjectLoader extends Loader {
...
@@ -39885,6 +39906,18 @@ class ObjectLoader extends Loader {
}
}
function getTexture( uuid ) {
if ( textures[ uuid ] === undefined ) {
console.warn( 'THREE.ObjectLoader: Undefined texture', uuid );
}
return textures[ uuid ];
}
let geometry, material;
let geometry, material;
switch ( data.type ) {
switch ( data.type ) {
...
@@ -39899,10 +39932,16 @@ class ObjectLoader extends Loader {
...
@@ -39899,10 +39932,16 @@ class ObjectLoader extends Loader {
object.background = new Color( data.background );
object.background = new Color( data.background );
} else {
object.background = getTexture( data.background );
}
}
}
}
if ( data.environment !== undefined ) object.environment = getTexture( data.environment );
if ( data.fog !== undefined ) {
if ( data.fog !== undefined ) {
if ( data.fog.type === 'Fog' ) {
if ( data.fog.type === 'Fog' ) {
...
@@ -40118,7 +40157,7 @@ class ObjectLoader extends Loader {
...
@@ -40118,7 +40157,7 @@ class ObjectLoader extends Loader {
for ( let i = 0; i < children.length; i ++ ) {
for ( let i = 0; i < children.length; i ++ ) {
object.add( this.parseObject( children[ i ], geometries, materials, animations ) );
object.add( this.parseObject( children[ i ], geometries, materials,
textures,
animations ) );
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录