Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
4dcb67f0
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,发现更多精彩内容 >>
提交
4dcb67f0
编写于
7月 25, 2013
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds.
上级
5900232f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
378 addition
and
275 deletion
+378
-275
build/three.js
build/three.js
+158
-56
build/three.min.js
build/three.min.js
+220
-219
未找到文件。
build/three.js
浏览文件 @
4dcb67f0
...
...
@@ -10572,7 +10572,7 @@ THREE.JSONLoader.prototype.parse = function ( json, texturePath ) {
var i, j, fi,
offset, zLength,
nVertices,
offset, zLength,
colorIndex, normalIndex, uvIndex, materialIndex,
...
...
@@ -10583,9 +10583,9 @@ THREE.JSONLoader.prototype.parse = function ( json, texturePath ) {
hasFaceNormal, hasFaceVertexNormal,
hasFaceColor, hasFaceVertexColor,
vertex, face,
color
, normal,
vertex, face,
faceA, faceB, color, hex
, normal,
uvLayer, uv
s
, u, v,
uvLayer, uv, u, v,
faces = json.faces,
vertices = json.vertices,
...
...
@@ -10647,114 +10647,216 @@ THREE.JSONLoader.prototype.parse = function ( json, texturePath ) {
if ( isQuad ) {
face = new THREE.Face4();
faceA = new THREE.Face3();
faceA.a = faces[ offset ];
faceA.b = faces[ offset + 1 ];
faceA.c = faces[ offset + 3 ];
face
.a = faces[ offset ++ ]
;
face
.b = faces[ offset ++
];
face
.c = faces[ offset ++
];
face
.d = faces[ offset ++
];
face
B = new THREE.Face3()
;
face
B.a = faces[ offset + 1
];
face
B.b = faces[ offset + 2
];
face
B.c = faces[ offset + 3
];
nVertices
= 4;
offset +
= 4;
} else
{
if ( hasMaterial )
{
face = new THREE.Face3();
materialIndex = faces[ offset ++ ];
faceA.materialIndex = materialIndex;
faceB.materialIndex = materialIndex;
face.a = faces[ offset ++ ];
face.b = faces[ offset ++ ];
face.c = faces[ offset ++ ];
}
nVertices = 3;
// to get face <=> uv index correspondence
}
fi = geometry.faces.length;
if ( hasMaterial
) {
if ( hasFaceVertexUv
) {
materialIndex = faces[ offset ++ ];
face.materialIndex = materialIndex;
for ( i = 0; i < nUvLayers; i++ ) {
}
uvLayer = json.uvs[ i ];
geometry.faceVertexUvs[ i ][ fi ] = [];
geometry.faceVertexUvs[ i ][ fi + 1 ] = []
for ( j = 0; j < 4; j ++ ) {
uvIndex = faces[ offset ++ ];
u = uvLayer[ uvIndex * 2 ];
v = uvLayer[ uvIndex * 2 + 1 ];
uv = new THREE.Vector2( u, v );
if ( j !== 2 ) geometry.faceVertexUvs[ i ][ fi ].push( uv );
if ( j !== 0 ) geometry.faceVertexUvs[ i ][ fi + 1 ].push( uv );
}
}
}
// to get face <=> uv index correspondence
if ( hasFaceNormal ) {
fi = geometry.faces.length
;
normalIndex = faces[ offset ++ ] * 3
;
if ( hasFaceVertexUv ) {
faceA.normal.set(
normals[ normalIndex ++ ],
normals[ normalIndex ++ ],
normals[ normalIndex ]
);
for ( i = 0; i < nUvLayers; i++ ) {
faceB.normal.copy( faceA.normal );
uvLayer = json.uvs[ i ];
}
if ( hasFaceVertexNormal ) {
uvs = [];
for ( i = 0; i < 4; i++ ) {
for ( j = 0; j < nVertices; j ++ ) {
normalIndex = faces[ offset ++ ] * 3;
uvIndex = faces[ offset ++ ];
normal = new THREE.Vector3(
normals[ normalIndex ++ ],
normals[ normalIndex ++ ],
normals[ normalIndex ]
);
u = uvLayer[ uvIndex * 2 ];
v = uvLayer[ uvIndex * 2 + 1 ];
uvs[ j ] = new THREE.Vector2( u, v );
if ( i !== 2 ) faceA.vertexNormals.push( normal );
if ( i !== 0 ) faceB.vertexNormals.push( normal );
}
geometry.faceVertexUvs[ i ][ fi ] = uvs;
}
if ( hasFaceColor ) {
colorIndex = faces[ offset ++ ];
hex = colors[ colorIndex ];
faceA.color.setHex( hex );
faceB.color.setHex( hex );
}
}
if ( hasFaceNormal
) {
if ( hasFaceVertexColor
) {
normalIndex = faces[ offset ++ ] * 3;
for ( i = 0; i < 4; i++ ) {
face.normal.set(
normals[ normalIndex ++ ],
normals[ normalIndex ++ ],
normals[ normalIndex ]
);
colorIndex = faces[ offset ++ ];
hex = colors[ colorIndex ];
}
if ( i !== 2 ) faceA.vertexColors.push( new THREE.Color( hex ) );
if ( i !== 0 ) faceB.vertexColors.push( new THREE.Color( hex ) );
}
}
geometry.faces.push( faceA );
geometry.faces.push( faceB );
if ( hasFaceVertexNormal ) {
} else {
face = new THREE.Face3();
face.a = faces[ offset ++ ];
face.b = faces[ offset ++ ];
face.c = faces[ offset ++ ];
if ( hasMaterial ) {
materialIndex = faces[ offset ++ ];
face.materialIndex = materialIndex;
}
// to get face <=> uv index correspondence
fi = geometry.faces.length;
if ( hasFaceVertexUv ) {
for ( i = 0; i < nUvLayers; i++ ) {
uvLayer = json.uvs[ i ];
geometry.faceVertexUvs[ i ][ fi ] = [];
for ( j = 0; j < 3; j ++ ) {
uvIndex = faces[ offset ++ ];
u = uvLayer[ uvIndex * 2 ];
v = uvLayer[ uvIndex * 2 + 1 ];
uv = new THREE.Vector2( u, v );
geometry.faceVertexUvs[ i ][ fi ].push( uv );
for ( i = 0; i < nVertices; i++ ) {
}
}
}
if ( hasFaceNormal ) {
normalIndex = faces[ offset ++ ] * 3;
normal = new THREE.Vector3
(
face.normal.set
(
normals[ normalIndex ++ ],
normals[ normalIndex ++ ],
normals[ normalIndex ]
);
face.vertexNormals.push( normal );
}
}
if ( hasFaceVertexNormal ) {
for ( i = 0; i < 3; i++ ) {
if ( hasFaceColor ) {
normalIndex = faces[ offset ++ ] * 3;
colorIndex = faces[ offset ++ ];
face.color.setHex( colors[ colorIndex ] );
normal = new THREE.Vector3(
normals[ normalIndex ++ ],
normals[ normalIndex ++ ],
normals[ normalIndex ]
);
}
face.vertexNormals.push( normal );
}
}
if ( hasFaceVertexColor ) {
for ( i = 0; i < nVertices; i++
) {
if ( hasFaceColor
) {
colorIndex = faces[ offset ++ ];
face.
vertexColors.push( new THREE.Color( colors[ colorIndex ] )
);
face.
color.setHex( colors[ colorIndex ]
);
}
}
geometry.faces.push( face );
if ( hasFaceVertexColor ) {
for ( i = 0; i < 3; i++ ) {
colorIndex = faces[ offset ++ ];
face.vertexColors.push( new THREE.Color( colors[ colorIndex ] ) );
}
}
geometry.faces.push( face );
}
}
...
...
build/three.min.js
浏览文件 @
4dcb67f0
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录