Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
60eb97d1
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,发现更多精彩内容 >>
提交
60eb97d1
编写于
8月 05, 2012
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds.
上级
d439a038
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
86 addition
and
86 deletion
+86
-86
build/Three.js
build/Three.js
+15
-15
build/custom/ThreeCanvas.js
build/custom/ThreeCanvas.js
+56
-56
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+15
-15
未找到文件。
build/Three.js
浏览文件 @
60eb97d1
...
...
@@ -172,21 +172,21 @@ p;){var q=g[m++],s=q&2,f=q&4,x=q&8,t=q&16,r=q&32,w=q&64,o=q&128;if(q&1){q=new TH
{};
d
.
morphColors
[
f
].
name
=
a
.
morphColors
[
f
].
name
;
d
.
morphColors
[
f
].
colors
=
[];
e
=
d
.
morphColors
[
f
].
colors
;
j
=
a
.
morphColors
[
f
].
colors
;
n
=
0
;
for
(
l
=
j
.
length
;
n
<
l
;
n
=
n
+
3
){
m
=
new
THREE
.
Color
(
16755200
);
m
.
setRGB
(
j
[
n
],
j
[
n
+
1
],
j
[
n
+
2
]);
e
.
push
(
m
)}}}
d
.
computeCentroids
();
d
.
computeFaceNormals
();
return
d
}};
THREE
.
SceneLoader
=
function
(){
this
.
onLoadStart
=
function
(){};
this
.
onLoadProgress
=
function
(){};
this
.
onLoadComplete
=
function
(){};
this
.
callbackSync
=
function
(){};
this
.
callbackProgress
=
function
(){}};
THREE
.
SceneLoader
.
prototype
.
constructor
=
THREE
.
SceneLoader
;
THREE
.
SceneLoader
.
prototype
.
load
=
function
(
a
,
b
){
var
c
=
this
,
d
=
new
XMLHttpRequest
;
d
.
onreadystatechange
=
function
(){
if
(
d
.
readyState
===
4
)
if
(
d
.
status
===
200
||
d
.
status
===
0
){
var
e
=
JSON
.
parse
(
d
.
responseText
);
c
.
createScene
(
e
,
b
,
a
)}
else
console
.
error
(
"
THREE.SceneLoader: Couldn't load [
"
+
a
+
"
] [
"
+
d
.
status
+
"
]
"
)};
d
.
open
(
"
GET
"
,
a
,
true
);
d
.
overrideMimeType
&&
d
.
overrideMimeType
(
"
text/plain; charset=x-user-defined
"
);
d
.
setRequestHeader
(
"
Content-Type
"
,
"
text/plain
"
);
d
.
send
(
null
)};
THREE
.
SceneLoader
.
prototype
.
createScene
=
function
(
a
,
b
,
c
){
function
d
(
a
,
b
){
return
b
==
"
relativeToHTML
"
?
a
:
j
+
"
/
"
+
a
}
function
e
(
){
var
a
;
for
(
n
in
B
.
objects
)
if
(
!
N
.
objects
[
n
]){
s
=
B
.
objects
[
n
];
if
(
s
.
geometry
!==
void
0
){
if
(
J
=
N
.
geometries
[
s
.
geometry
]){
a
=
false
;
M
=
N
.
materials
[
s
.
materials
[
0
]];(
a
=
M
instanceof
THREE
.
ShaderMaterial
)
&&
J
.
computeTangents
();
z
=
s
.
position
;
C
=
s
.
rotation
;
E
=
s
.
quaternion
;
A
=
s
.
scale
;
x
=
s
.
matrix
;
E
=
0
;
s
.
materials
.
length
==
0
&&
(
M
=
new
THREE
.
MeshFaceMaterial
);
s
.
materials
.
length
>
1
&&
(
M
=
new
THREE
.
MeshFaceMaterial
);
a
=
new
THREE
.
Mesh
(
J
,
M
);
a
.
name
=
n
;
if
(
x
){
a
.
matrixAutoUpdate
=
false
;
a
.
matrix
.
set
(
x
[
0
],
x
[
1
],
x
[
2
],
x
[
3
],
x
[
4
],
x
[
5
],
x
[
6
],
x
[
7
],
x
[
8
],
x
[
9
],
x
[
10
],
x
[
11
],
x
[
12
],
x
[
13
],
x
[
14
],
x
[
15
])}
else
{
a
.
position
.
set
(
z
[
0
],
z
[
1
],
z
[
2
]);
if
(
E
){
a
.
quaternion
.
set
(
E
[
0
],
E
[
1
],
E
[
2
],
E
[
3
]);
a
.
useQuaternion
=
true
}
else
a
.
rotation
.
set
(
C
[
0
],
C
[
1
],
C
[
2
]);
a
.
scale
.
set
(
A
[
0
],
A
[
1
],
A
[
2
])}
a
.
visible
=
s
.
visible
;
a
.
castShadow
=
s
.
castShadow
;
a
.
receiveShadow
=
s
.
receiveShadow
;
N
.
scene
.
add
(
a
);
N
.
objects
[
n
]
=
a
}}
else
{
z
=
s
.
position
;
C
=
s
.
rotation
;
E
=
s
.
quaternion
;
A
=
s
.
scale
;
E
=
0
;
a
=
new
THREE
.
Object3D
;
a
.
name
=
n
;
a
.
position
.
set
(
z
[
0
],
z
[
1
],
z
[
2
]);
if
(
E
){
a
.
quaternion
.
set
(
E
[
0
],
E
[
1
],
E
[
2
],
E
[
3
]);
a
.
useQuaternion
=
true
}
else
a
.
rotation
.
set
(
C
[
0
],
C
[
1
],
C
[
2
]);
a
.
scale
.
set
(
A
[
0
],
A
[
1
],
A
[
2
]);
a
.
visible
=
s
.
visible
!==
void
0
?
s
.
visible
:
false
;
N
.
scene
.
add
(
a
);
N
.
objects
[
n
]
=
a
;
N
.
empties
[
n
]
=
a
}}}
function
f
(
a
){
return
function
(
b
){
N
.
geometries
[
a
]
=
b
;
e
();
Q
=
Q
-
1
;
i
.
onLoadComplete
();
h
()}}
function
g
(
a
){
return
function
(
b
){
N
.
geometries
[
a
]
=
b
}}
function
h
(){
i
.
callbackProgress
({
totalModels
:
ba
,
totalTextures
:
X
,
loadedModels
:
ba
-
Q
,
loadedTextures
:
X
-
F
},
N
);
i
.
onLoadProgress
();
Q
===
0
&&
F
===
0
&&
b
(
N
)}
var
i
=
this
,
j
=
THREE
.
Loader
.
prototype
.
extractUrlBase
(
c
),
l
,
m
,
n
,
p
,
r
,
o
,
q
,
s
,
x
,
t
,
w
,
z
,
C
,
E
,
A
,
u
,
H
,
J
,
M
,
O
,
$
,
B
,
G
,
Q
,
F
,
ba
,
X
,
N
;
B
=
a
;
c
=
new
THREE
.
BinaryLoader
;
G
=
new
THREE
.
JSONLoader
;
F
=
Q
=
0
;
N
=
{
scene
:
new
THREE
.
Scene
,
geometries
:{},
materials
:{},
textures
:{},
objects
:{},
cameras
:{},
lights
:{},
fogs
:{},
empties
:{}};
if
(
B
.
transform
){
a
=
B
.
transform
.
position
;
t
=
B
.
transform
.
rotation
;
u
=
B
.
transform
.
scale
;
a
&&
N
.
scene
.
position
.
set
(
a
[
0
],
a
[
1
],
a
[
2
]);
t
&&
N
.
scene
.
rotation
.
set
(
t
[
0
],
t
[
1
],
t
[
2
]);
u
&&
N
.
scene
.
scale
.
set
(
u
[
0
],
u
[
1
],
u
[
2
]);
if
(
a
||
t
||
u
){
N
.
scene
.
updateMatrix
();
N
.
scene
.
updateMatrixWorld
()}}
a
=
function
(
a
){
return
function
(){
F
=
F
-
a
;
h
();
i
.
onLoadComplete
()}};
for
(
r
in
B
.
cameras
){
u
=
B
.
cameras
[
r
];
u
.
type
===
"
perspective
"
?
O
=
new
THREE
.
PerspectiveCamera
(
u
.
fov
,
u
.
aspect
,
u
.
near
,
u
.
far
):
u
.
type
===
"
ortho
"
&&
(
O
=
new
THREE
.
OrthographicCamera
(
u
.
left
,
u
.
right
,
u
.
top
,
u
.
bottom
,
u
.
near
,
u
.
far
));
z
=
u
.
position
;
t
=
u
.
target
;
u
=
u
.
up
;
O
.
position
.
set
(
z
[
0
],
z
[
1
],
z
[
2
]);
O
.
target
=
new
THREE
.
Vector3
(
t
[
0
],
t
[
1
],
t
[
2
]);
u
&&
O
.
up
.
set
(
u
[
0
],
u
[
1
],
u
[
2
]);
N
.
cameras
[
r
]
=
O
}
for
(
p
in
B
.
lights
){
t
=
B
.
lights
[
p
];
r
=
t
.
color
!==
void
0
?
t
.
color
:
16777215
;
O
=
t
.
intensity
!==
void
0
?
t
.
intensity
:
1
;
if
(
t
.
type
===
"
directional
"
){
z
=
t
.
direction
;
w
=
new
THREE
.
DirectionalLight
(
r
,
O
);
w
.
position
.
set
(
z
[
0
],
z
[
1
],
z
[
2
]);
w
.
position
.
normalize
()}
else
if
(
t
.
type
===
"
point
"
){
z
=
t
.
position
;
w
=
t
.
distance
;
w
=
new
THREE
.
PointLight
(
r
,
O
,
w
);
w
.
position
.
set
(
z
[
0
],
z
[
1
],
z
[
2
])}
else
t
.
type
===
"
ambient
"
&&
(
w
=
new
THREE
.
AmbientLight
(
r
));
N
.
scene
.
add
(
w
);
N
.
lights
[
p
]
=
w
}
for
(
o
in
B
.
fogs
){
p
=
B
.
fogs
[
o
];
p
.
type
===
"
linear
"
?
$
=
new
THREE
.
Fog
(
0
,
p
.
near
,
p
.
far
):
p
.
type
===
"
exp2
"
&&
(
$
=
new
THREE
.
FogExp2
(
0
,
p
.
density
));
u
=
p
.
color
;
$
.
color
.
setRGB
(
u
[
0
],
u
[
1
],
u
[
2
]);
N
.
fogs
[
o
]
=
$
}
if
(
N
.
cameras
&&
B
.
defaults
.
camera
)
N
.
currentCamera
=
N
.
cameras
[
B
.
defaults
.
camera
];
if
(
N
.
fogs
&&
B
.
defaults
.
fog
)
N
.
scene
.
fog
=
N
.
fogs
[
B
.
defaults
.
fog
];
u
=
B
.
defaults
.
bgcolor
;
N
.
bgColor
=
new
THREE
.
Color
;
N
.
bgColor
.
setRGB
(
u
[
0
],
u
[
1
],
u
[
2
]);
N
.
bgColorAlpha
=
B
.
defaults
.
bgalpha
;
for
(
l
in
B
.
geometries
){
o
=
B
.
geometries
[
l
];
if
(
o
.
type
==
"
bin_mesh
"
||
o
.
type
==
"
ascii_mesh
"
){
Q
=
Q
+
1
;
i
.
onLoadStart
()}}
ba
=
Q
;
for
(
l
in
B
.
geometries
){
o
=
B
.
geometries
[
l
];
if
(
o
.
type
==
=
"
cube
"
){
J
=
new
THREE
.
CubeGeometry
(
o
.
width
,
o
.
height
,
o
.
depth
,
o
.
segmentsWidth
,
o
.
segmentsHeight
,
o
.
segmentsDepth
,
null
,
o
.
flipped
,
o
.
sides
);
N
.
geometries
[
l
]
=
J
}
else
if
(
o
.
type
===
"
plane
"
){
J
=
new
THREE
.
PlaneGeometry
(
o
.
width
,
o
.
height
,
o
.
segmentsWidth
,
o
.
segmentsHeight
);
N
.
geometries
[
l
]
=
J
}
else
if
(
o
.
type
===
"
sphere
"
){
J
=
new
THREE
.
SphereGeometry
(
o
.
radius
,
o
.
segmentsWidth
,
o
.
segmentsHeight
);
N
.
geometries
[
l
]
=
J
}
else
if
(
o
.
type
===
"
cylinder
"
){
J
=
new
THREE
.
CylinderGeometry
(
o
.
topRad
,
o
.
botRad
,
o
.
height
,
o
.
radSegs
,
o
.
heightSegs
);
N
.
geometries
[
l
]
=
J
}
else
if
(
o
.
type
===
"
torus
"
){
J
=
new
THREE
.
TorusGeometry
(
o
.
radius
,
o
.
tube
,
o
.
segmentsR
,
o
.
segmentsT
);
N
.
geometries
[
l
]
=
J
}
else
if
(
o
.
type
===
"
icosahedron
"
){
J
=
new
THREE
.
IcosahedronGeometry
(
o
.
radius
,
o
.
subdivisions
);
N
.
geometries
[
l
]
=
J
}
else
if
(
o
.
type
===
"
bin_mesh
"
)
c
.
load
(
d
(
o
.
url
,
B
.
urlBaseType
),
f
(
l
));
else
if
(
o
.
type
===
"
ascii_mesh
"
)
G
.
load
(
d
(
o
.
url
,
B
.
urlBaseType
),
f
(
l
));
else
if
(
o
.
type
===
"
embedded_mesh
"
){
o
=
B
.
embeds
[
o
.
id
];
o
.
metadata
=
B
.
metadata
;
o
&&
G
.
createModel
(
o
,
g
(
l
),
""
)}}
for
(
q
in
B
.
textures
){
l
=
B
.
textures
[
q
];
if
(
l
.
url
instanceof
Array
){
F
=
F
+
l
.
url
.
length
;
for
(
o
=
0
;
o
<
l
.
url
.
length
;
o
++
)
i
.
onLoadStart
()}
else
{
F
=
F
+
1
;
i
.
onLoadStart
()}}
X
=
F
;
for
(
q
in
B
.
textures
){
l
=
B
.
textures
[
q
];
if
(
l
.
mapping
!==
void
0
&&
THREE
[
l
.
mapping
]
!==
void
0
)
l
.
mapping
=
new
THREE
[
l
.
mapping
];
if
(
l
.
url
instanceof
Array
){
o
=
l
.
url
.
length
;
$
=
[];
for
(
c
=
0
;
c
<
o
;
c
++
)
$
[
c
]
=
d
(
l
.
url
[
c
],
B
.
urlBaseType
);
o
=
THREE
.
ImageUtils
.
loadTextureCube
(
$
,
l
.
mapping
,
a
(
o
))}
else
{
o
=
THREE
.
ImageUtils
.
loadTexture
(
d
(
l
.
url
,
B
.
urlBaseType
),
l
.
mapping
,
a
(
1
));
if
(
THREE
[
l
.
minFilter
]
!==
void
0
)
o
.
minFilter
=
THREE
[
l
.
minFilter
];
if
(
THREE
[
l
.
mag
Filter
]
!==
void
0
)
o
.
m
agFilter
=
THREE
[
l
.
magFilter
];
if
(
l
.
repeat
){
o
.
repeat
.
set
(
l
.
repeat
[
0
],
l
.
repeat
[
1
]);
if
(
l
.
repeat
[
0
]
!==
1
)
o
.
wrapS
=
THREE
.
RepeatWrapping
;
if
(
l
.
repeat
[
1
]
!==
1
)
o
.
wrapT
=
THREE
.
RepeatWrapping
}
l
.
offset
&&
o
.
offset
.
set
(
l
.
offset
[
0
],
l
.
offset
[
1
]);
if
(
l
.
wrap
){
$
=
{
repeat
:
THREE
.
RepeatWrapping
,
mirror
:
THREE
.
MirroredRepeatWrapping
};
if
(
$
[
l
.
wrap
[
0
]]
!==
void
0
)
o
.
wrapS
=
$
[
l
.
wrap
[
0
]];
if
(
$
[
l
.
wrap
[
1
]]
!==
void
0
)
o
.
wrapT
=
$
[
l
.
wrap
[
1
]]}}
N
.
textures
[
q
]
=
o
}
for
(
m
in
B
.
materials
){
x
=
B
.
materials
[
m
];
for
(
H
in
x
.
parameters
)
if
(
H
===
"
envMap
"
||
H
==
=
"
map
"
||
H
===
"
lightMap
"
)
x
.
parameters
[
H
]
=
N
.
textures
[
x
.
parameters
[
H
]];
else
if
(
H
===
"
shading
"
)
x
.
parameters
[
H
]
=
x
.
parameters
[
H
]
==
"
flat
"
?
THREE
.
FlatShading
:
THREE
.
SmoothShading
;
else
if
(
H
===
"
blending
"
)
x
.
parameters
[
H
]
=
x
.
parameters
[
H
]
in
THREE
?
THREE
[
x
.
parameters
[
H
]]:
THREE
.
NormalBlending
;
else
if
(
H
===
"
combine
"
)
x
.
parameters
[
H
]
=
x
.
parameters
[
H
]
==
"
MixOperation
"
?
THREE
.
MixOperation
:
THREE
.
MultiplyOperation
;
else
if
(
H
===
"
vertexColors
"
)
if
(
x
.
parameters
[
H
]
==
"
face
"
)
x
.
parameters
[
H
]
=
THREE
.
FaceColors
;
else
if
(
x
.
parameters
[
H
]
)
x
.
parameters
[
H
]
=
THREE
.
VertexColors
;
if
(
x
.
parameters
.
opacity
!==
void
0
&&
x
.
parameters
.
opacity
<
1
)
x
.
parameters
.
transparent
=
true
;
if
(
x
.
parameters
.
normalMap
){
q
=
THREE
.
ShaderUtils
.
lib
.
normal
;
a
=
THREE
.
UniformsUtils
.
clone
(
q
.
uniforms
);
l
=
x
.
parameters
.
color
;
o
=
x
.
parameters
.
specular
;
$
=
x
.
parameters
.
ambient
;
c
=
x
.
parameters
.
shininess
;
a
.
tNormal
.
texture
=
N
.
textures
[
x
.
parameters
.
normalMap
];
if
(
x
.
parameters
.
normalMapFactor
)
a
.
uNormalScale
.
value
=
x
.
parameters
.
normalMapFactor
;
if
(
x
.
parameters
.
map
){
a
.
tDiffuse
.
texture
=
x
.
parameters
.
map
;
a
.
enableDiffuse
.
valu
e
=
true
}
if
(
x
.
parameters
.
lightMap
){
a
.
tAO
.
texture
=
x
.
parameters
.
lightMap
;
a
.
enableAO
.
value
=
true
}
if
(
x
.
parameters
.
specularMap
){
a
.
tSpecular
.
texture
=
N
.
textures
[
x
.
parameters
.
specularMap
];
a
.
enableSpecular
.
value
=
true
}
a
.
uDiffuseColor
.
value
.
setHex
(
l
);
a
.
uSpecularColor
.
value
.
setHex
(
o
);
a
.
uAmbientColor
.
value
.
setHex
(
$
);
a
.
uShininess
.
value
=
c
;
if
(
x
.
parameters
.
opacity
)
a
.
uOpacity
.
value
=
x
.
parameters
.
opacity
;
M
=
new
THREE
.
ShaderMaterial
({
fragmentShader
:
q
.
fragmentShader
,
vertexShader
:
q
.
vertexShader
,
uniforms
:
a
,
lights
:
true
,
fog
:
true
})}
else
M
=
new
THREE
[
x
.
type
](
x
.
parameters
);
N
.
materials
[
m
]
=
M
}
e
(
);
i
.
callbackSync
(
N
);
h
()};
THREE
.
TextureLoader
=
function
(){
THREE
.
EventTarget
.
call
(
this
);
this
.
crossOrigin
=
null
};
THREE
.
SceneLoader
.
prototype
.
createScene
=
function
(
a
,
b
,
c
){
function
d
(
a
,
b
){
return
b
==
"
relativeToHTML
"
?
a
:
j
+
"
/
"
+
a
}
function
e
(
a
,
b
){
var
c
;
for
(
n
in
b
)
if
(
N
.
objects
[
n
]
===
void
0
){
s
=
b
[
n
];
if
(
s
.
geometry
!==
void
0
){
if
(
J
=
N
.
geometries
[
s
.
geometry
]){
c
=
false
;
M
=
N
.
materials
[
s
.
materials
[
0
]];(
c
=
M
instanceof
THREE
.
ShaderMaterial
)
&&
J
.
computeTangents
();
z
=
s
.
position
;
C
=
s
.
rotation
;
E
=
s
.
quaternion
;
A
=
s
.
scale
;
x
=
s
.
matrix
;
E
=
0
;
s
.
materials
.
length
==
0
&&
(
M
=
new
THREE
.
MeshFaceMaterial
);
s
.
materials
.
length
>
1
&&
(
M
=
new
THREE
.
MeshFaceMaterial
);
c
=
new
THREE
.
Mesh
(
J
,
M
);
c
.
name
=
n
;
if
(
x
){
c
.
matrixAutoUpdate
=
false
;
c
.
matrix
.
set
(
x
[
0
],
x
[
1
],
x
[
2
],
x
[
3
],
x
[
4
],
x
[
5
],
x
[
6
],
x
[
7
],
x
[
8
],
x
[
9
],
x
[
10
],
x
[
11
],
x
[
12
],
x
[
13
],
x
[
14
],
x
[
15
])}
else
{
c
.
position
.
set
(
z
[
0
],
z
[
1
],
z
[
2
]);
if
(
E
){
c
.
quaternion
.
set
(
E
[
0
],
E
[
1
],
E
[
2
],
E
[
3
]);
c
.
useQuaternion
=
true
}
else
c
.
rotation
.
set
(
C
[
0
],
C
[
1
],
C
[
2
]);
c
.
scale
.
set
(
A
[
0
],
A
[
1
],
A
[
2
])}
c
.
visible
=
s
.
visible
;
c
.
castShadow
=
s
.
castShadow
;
c
.
receiveShadow
=
s
.
receiveShadow
;
a
.
add
(
c
);
N
.
objects
[
n
]
=
c
}}
else
{
z
=
s
.
position
;
C
=
s
.
rotation
;
E
=
s
.
quaternion
;
A
=
s
.
scale
;
E
=
0
;
c
=
new
THREE
.
Object3D
;
c
.
name
=
n
;
c
.
position
.
set
(
z
[
0
],
z
[
1
],
z
[
2
]);
if
(
E
){
c
.
quaternion
.
set
(
E
[
0
],
E
[
1
],
E
[
2
],
E
[
3
]);
c
.
useQuaternion
=
true
}
else
c
.
rotation
.
set
(
C
[
0
],
C
[
1
],
C
[
2
]);
c
.
scale
.
set
(
A
[
0
],
A
[
1
],
A
[
2
]);
c
.
visible
=
s
.
visible
!==
void
0
?
s
.
visible
:
false
;
a
.
add
(
c
);
N
.
objects
[
n
]
=
c
;
N
.
empties
[
n
]
=
c
}
s
.
children
!==
void
0
&&
e
(
c
,
s
.
children
)}}
function
f
(
a
){
return
function
(
b
){
N
.
geometries
[
a
]
=
b
;
e
(
N
.
scene
,
B
.
objects
);
Q
=
Q
-
1
;
i
.
onLoadComplete
();
h
()}}
function
g
(
a
){
return
function
(
b
){
N
.
geometries
[
a
]
=
b
}}
function
h
(){
i
.
callbackProgress
({
totalModels
:
ba
,
totalTextures
:
X
,
loadedModels
:
ba
-
Q
,
loadedTextures
:
X
-
F
},
N
);
i
.
onLoadProgress
();
Q
===
0
&&
F
===
0
&&
b
(
N
)}
var
i
=
this
,
j
=
THREE
.
Loader
.
prototype
.
extractUrlBase
(
c
),
l
,
m
,
n
,
p
,
r
,
o
,
q
,
s
,
x
,
t
,
w
,
z
,
C
,
E
,
A
,
u
,
H
,
J
,
M
,
O
,
$
,
B
,
G
,
Q
,
F
,
ba
,
X
,
N
;
B
=
a
;
c
=
new
THREE
.
BinaryLoader
;
G
=
new
THREE
.
JSONLoader
;
F
=
Q
=
0
;
N
=
{
scene
:
new
THREE
.
Scene
,
geometries
:{},
materials
:{},
textures
:{},
objects
:{},
cameras
:{},
lights
:{},
fogs
:{},
empties
:{}};
if
(
B
.
transform
){
a
=
B
.
transform
.
position
;
t
=
B
.
transform
.
rotation
;
u
=
B
.
transform
.
scale
;
a
&&
N
.
scene
.
position
.
set
(
a
[
0
],
a
[
1
],
a
[
2
]);
t
&&
N
.
scene
.
rotation
.
set
(
t
[
0
],
t
[
1
],
t
[
2
]);
u
&&
N
.
scene
.
scale
.
set
(
u
[
0
],
u
[
1
],
u
[
2
]);
if
(
a
||
t
||
u
){
N
.
scene
.
updateMatrix
();
N
.
scene
.
updateMatrixWorld
()}}
a
=
function
(
a
){
return
function
(){
F
=
F
-
a
;
h
();
i
.
onLoadComplete
()}};
for
(
r
in
B
.
cameras
){
u
=
B
.
cameras
[
r
];
u
.
type
===
"
perspective
"
?
O
=
new
THREE
.
PerspectiveCamera
(
u
.
fov
,
u
.
aspect
,
u
.
near
,
u
.
far
):
u
.
type
===
"
ortho
"
&&
(
O
=
new
THREE
.
OrthographicCamera
(
u
.
left
,
u
.
right
,
u
.
top
,
u
.
bottom
,
u
.
near
,
u
.
far
));
z
=
u
.
position
;
t
=
u
.
target
;
u
=
u
.
up
;
O
.
position
.
set
(
z
[
0
],
z
[
1
],
z
[
2
]);
O
.
target
=
new
THREE
.
Vector3
(
t
[
0
],
t
[
1
],
t
[
2
]);
u
&&
O
.
up
.
set
(
u
[
0
],
u
[
1
],
u
[
2
]);
N
.
cameras
[
r
]
=
O
}
for
(
p
in
B
.
lights
){
t
=
B
.
lights
[
p
];
r
=
t
.
color
!==
void
0
?
t
.
color
:
16777215
;
O
=
t
.
intensity
!==
void
0
?
t
.
intensity
:
1
;
if
(
t
.
type
===
"
directional
"
){
z
=
t
.
direction
;
w
=
new
THREE
.
DirectionalLight
(
r
,
O
);
w
.
position
.
set
(
z
[
0
],
z
[
1
],
z
[
2
]);
w
.
position
.
normalize
()}
else
if
(
t
.
type
===
"
point
"
){
z
=
t
.
position
;
w
=
t
.
distance
;
w
=
new
THREE
.
PointLight
(
r
,
O
,
w
);
w
.
position
.
set
(
z
[
0
],
z
[
1
],
z
[
2
])}
else
t
.
type
===
"
ambient
"
&&
(
w
=
new
THREE
.
AmbientLight
(
r
));
N
.
scene
.
add
(
w
);
N
.
lights
[
p
]
=
w
}
for
(
o
in
B
.
fogs
){
p
=
B
.
fogs
[
o
];
p
.
type
===
"
linear
"
?
$
=
new
THREE
.
Fog
(
0
,
p
.
near
,
p
.
far
):
p
.
type
===
"
exp2
"
&&
(
$
=
new
THREE
.
FogExp2
(
0
,
p
.
density
));
u
=
p
.
color
;
$
.
color
.
setRGB
(
u
[
0
],
u
[
1
],
u
[
2
]);
N
.
fogs
[
o
]
=
$
}
if
(
N
.
cameras
&&
B
.
defaults
.
camera
)
N
.
currentCamera
=
N
.
cameras
[
B
.
defaults
.
camera
];
if
(
N
.
fogs
&&
B
.
defaults
.
fog
)
N
.
scene
.
fog
=
N
.
fogs
[
B
.
defaults
.
fog
];
u
=
B
.
defaults
.
bgcolor
;
N
.
bgColor
=
new
THREE
.
Color
;
N
.
bgColor
.
setRGB
(
u
[
0
],
u
[
1
],
u
[
2
]);
N
.
bgColorAlpha
=
B
.
defaults
.
bgalpha
;
for
(
l
in
B
.
geometries
){
o
=
B
.
geometries
[
l
];
if
(
o
.
type
==
"
bin_mesh
"
||
o
.
type
==
"
ascii_mesh
"
){
Q
=
Q
+
1
;
i
.
onLoadStart
()}}
ba
=
Q
;
for
(
l
in
B
.
geometries
){
o
=
B
.
geometries
[
l
];
if
(
o
.
type
===
"
cube
"
){
J
=
new
THREE
.
CubeGeometry
(
o
.
width
,
o
.
height
,
o
.
depth
,
o
.
segmentsWidth
,
o
.
segmentsHeight
,
o
.
segmentsDepth
,
null
,
o
.
flipped
,
o
.
sides
);
N
.
geometries
[
l
]
=
J
}
else
if
(
o
.
type
===
"
plane
"
){
J
=
new
THREE
.
PlaneGeometry
(
o
.
width
,
o
.
height
,
o
.
segmentsWidth
,
o
.
segmentsHeight
);
N
.
geometries
[
l
]
=
J
}
else
if
(
o
.
type
===
"
sphere
"
){
J
=
new
THREE
.
SphereGeometry
(
o
.
radius
,
o
.
segmentsWidth
,
o
.
segmentsHeight
);
N
.
geometries
[
l
]
=
J
}
else
if
(
o
.
type
===
"
cylinder
"
){
J
=
new
THREE
.
CylinderGeometry
(
o
.
topRad
,
o
.
botRad
,
o
.
height
,
o
.
radSegs
,
o
.
heightSegs
);
N
.
geometries
[
l
]
=
J
}
else
if
(
o
.
type
===
"
torus
"
){
J
=
new
THREE
.
TorusGeometry
(
o
.
radius
,
o
.
tube
,
o
.
segmentsR
,
o
.
segmentsT
);
N
.
geometries
[
l
]
=
J
}
else
if
(
o
.
type
===
"
icosahedron
"
){
J
=
new
THREE
.
IcosahedronGeometry
(
o
.
radius
,
o
.
subdivisions
);
N
.
geometries
[
l
]
=
J
}
else
if
(
o
.
type
===
"
bin_mesh
"
)
c
.
load
(
d
(
o
.
url
,
B
.
urlBaseType
),
f
(
l
));
else
if
(
o
.
type
===
"
ascii_mesh
"
)
G
.
load
(
d
(
o
.
url
,
B
.
urlBaseType
),
f
(
l
));
else
if
(
o
.
type
===
"
embedded_mesh
"
){
o
=
B
.
embeds
[
o
.
id
];
o
.
metadata
=
B
.
metadata
;
o
&&
G
.
createModel
(
o
,
g
(
l
),
""
)}}
for
(
q
in
B
.
textures
){
l
=
B
.
textures
[
q
];
if
(
l
.
url
instanceof
Array
){
F
=
F
+
l
.
url
.
length
;
for
(
o
=
0
;
o
<
l
.
url
.
length
;
o
++
)
i
.
onLoadStart
()}
else
{
F
=
F
+
1
;
i
.
onLoadStart
()}}
X
=
F
;
for
(
q
in
B
.
textures
){
l
=
B
.
textures
[
q
];
if
(
l
.
mapping
!==
void
0
&&
THREE
[
l
.
mapping
]
!==
void
0
)
l
.
mapping
=
new
THREE
[
l
.
mapping
];
if
(
l
.
url
instanceof
Array
){
o
=
l
.
url
.
length
;
$
=
[];
for
(
c
=
0
;
c
<
o
;
c
++
)
$
[
c
]
=
d
(
l
.
url
[
c
],
B
.
urlBaseType
);
o
=
THREE
.
ImageUtils
.
loadTextureCube
(
$
,
l
.
mapping
,
a
(
o
))}
else
{
o
=
THREE
.
ImageUtils
.
loadTexture
(
d
(
l
.
url
,
B
.
urlBaseType
),
l
.
mapping
,
a
(
1
));
if
(
THREE
[
l
.
min
Filter
]
!==
void
0
)
o
.
m
inFilter
=
THREE
[
l
.
minFilter
];
if
(
THREE
[
l
.
magFilter
]
!==
void
0
)
o
.
magFilter
=
THREE
[
l
.
magFilter
];
if
(
l
.
repeat
){
o
.
repeat
.
set
(
l
.
repeat
[
0
],
l
.
repeat
[
1
]);
if
(
l
.
repeat
[
0
]
!==
1
)
o
.
wrapS
=
THREE
.
RepeatWrapping
;
if
(
l
.
repeat
[
1
]
!==
1
)
o
.
wrapT
=
THREE
.
RepeatWrapping
}
l
.
offset
&&
o
.
offset
.
set
(
l
.
offset
[
0
],
l
.
offset
[
1
]);
if
(
l
.
wrap
){
$
=
{
repeat
:
THREE
.
RepeatWrapping
,
mirror
:
THREE
.
MirroredRepeatWrapping
};
if
(
$
[
l
.
wrap
[
0
]]
!==
void
0
)
o
.
wrapS
=
$
[
l
.
wrap
[
0
]];
if
(
$
[
l
.
wrap
[
1
]]
!==
void
0
)
o
.
wrapT
=
$
[
l
.
wrap
[
1
]]}}
N
.
textures
[
q
]
=
o
}
for
(
m
in
B
.
materials
){
x
=
B
.
materials
[
m
];
for
(
H
in
x
.
parameters
)
if
(
H
===
"
envMap
"
||
H
===
"
map
"
||
H
===
"
lightMap
"
)
x
.
parameters
[
H
]
=
N
.
textures
[
x
.
parameters
[
H
]];
else
if
(
H
===
"
shading
"
)
x
.
parameters
[
H
]
=
x
.
parameters
[
H
]
==
"
flat
"
?
THREE
.
FlatShading
:
THREE
.
SmoothShading
;
else
if
(
H
===
"
blending
"
)
x
.
parameters
[
H
]
=
x
.
parameters
[
H
]
in
THREE
?
THREE
[
x
.
parameters
[
H
]]:
THREE
.
NormalBlending
;
else
if
(
H
===
"
combine
"
)
x
.
parameters
[
H
]
=
x
.
parameters
[
H
]
==
"
MixOperation
"
?
THREE
.
MixOperation
:
THREE
.
MultiplyOperation
;
else
if
(
H
===
"
vertexColors
"
)
if
(
x
.
parameters
[
H
]
==
"
face
"
)
x
.
parameters
[
H
]
=
THREE
.
FaceColors
;
else
if
(
x
.
parameters
[
H
])
x
.
parameters
[
H
]
=
THREE
.
VertexColors
;
if
(
x
.
parameters
.
opacity
!==
void
0
&&
x
.
parameters
.
opacity
<
1
)
x
.
parameters
.
transparent
=
true
;
if
(
x
.
parameters
.
normalMap
){
q
=
THREE
.
ShaderUtils
.
lib
.
normal
;
a
=
THREE
.
UniformsUtils
.
clone
(
q
.
uniforms
);
l
=
x
.
parameters
.
color
;
o
=
x
.
parameters
.
specular
;
$
=
x
.
parameters
.
ambient
;
c
=
x
.
parameters
.
shininess
;
a
.
tNormal
.
texture
=
N
.
textures
[
x
.
parameters
.
normalMap
];
if
(
x
.
parameters
.
normalMapFactor
)
a
.
uNormalScale
.
value
=
x
.
parameters
.
normalMapFactor
;
if
(
x
.
parameters
.
map
){
a
.
tDiffuse
.
textur
e
=
x
.
parameters
.
map
;
a
.
enableDiffuse
.
value
=
true
}
if
(
x
.
parameters
.
lightMap
){
a
.
tAO
.
texture
=
x
.
parameters
.
lightMap
;
a
.
enableAO
.
value
=
true
}
if
(
x
.
parameters
.
specularMap
){
a
.
tSpecular
.
texture
=
N
.
textures
[
x
.
parameters
.
specularMap
];
a
.
enableSpecular
.
value
=
true
}
a
.
uDiffuseColor
.
value
.
setHex
(
l
);
a
.
uSpecularColor
.
value
.
setHex
(
o
);
a
.
uAmbientColor
.
value
.
setHex
(
$
);
a
.
uShininess
.
value
=
c
;
if
(
x
.
parameters
.
opacity
)
a
.
uOpacity
.
value
=
x
.
parameters
.
opacity
;
M
=
new
THREE
.
ShaderMaterial
({
fragmentShader
:
q
.
fragmentShader
,
vertexShader
:
q
.
vertexShader
,
uniforms
:
a
,
lights
:
true
,
fog
:
true
})}
else
M
=
new
THREE
[
x
.
type
](
x
.
parameters
);
N
.
materials
[
m
]
=
M
}
e
(
N
.
scene
,
B
.
objects
);
i
.
callbackSync
(
N
);
h
()};
THREE
.
TextureLoader
=
function
(){
THREE
.
EventTarget
.
call
(
this
);
this
.
crossOrigin
=
null
};
THREE
.
TextureLoader
.
prototype
=
{
constructor
:
THREE
.
TextureLoader
,
load
:
function
(
a
){
var
b
=
this
,
c
=
new
Image
;
c
.
addEventListener
(
"
load
"
,
function
(){
var
a
=
new
THREE
.
Texture
(
c
);
a
.
needsUpdate
=
true
;
b
.
dispatchEvent
({
type
:
"
load
"
,
content
:
a
})},
false
);
c
.
addEventListener
(
"
error
"
,
function
(){
b
.
dispatchEvent
({
type
:
"
error
"
,
message
:
"
Couldn't load URL [
"
+
a
+
"
]
"
})},
false
);
if
(
b
.
crossOrigin
)
c
.
crossOrigin
=
b
.
crossOrigin
;
c
.
src
=
a
}};
THREE
.
Material
=
function
(
a
){
a
=
a
||
{};
this
.
id
=
THREE
.
MaterialCount
++
;
this
.
name
=
""
;
this
.
opacity
=
a
.
opacity
!==
void
0
?
a
.
opacity
:
1
;
this
.
transparent
=
a
.
transparent
!==
void
0
?
a
.
transparent
:
false
;
this
.
blending
=
a
.
blending
!==
void
0
?
a
.
blending
:
THREE
.
NormalBlending
;
this
.
blendSrc
=
a
.
blendSrc
!==
void
0
?
a
.
blendSrc
:
THREE
.
SrcAlphaFactor
;
this
.
blendDst
=
a
.
blendDst
!==
void
0
?
a
.
blendDst
:
THREE
.
OneMinusSrcAlphaFactor
;
this
.
blendEquation
=
a
.
blendEquation
!==
void
0
?
a
.
blendEquation
:
THREE
.
AddEquation
;
this
.
depthTest
=
a
.
depthTest
!==
void
0
?
a
.
depthTest
:
true
;
this
.
depthWrite
=
a
.
depthWrite
!==
void
0
?
a
.
depthWrite
:
true
;
this
.
polygonOffset
=
a
.
polygonOffset
!==
void
0
?
a
.
polygonOffset
:
false
;
this
.
polygonOffsetFactor
=
a
.
polygonOffsetFactor
!==
void
0
?
a
.
polygonOffsetFactor
:
0
;
this
.
polygonOffsetUnits
=
a
.
polygonOffsetUnits
!==
void
0
?
a
.
polygonOffsetUnits
:
0
;
this
.
alphaTest
=
a
.
alphaTest
!==
void
0
?
a
.
alphaTest
:
0
;
this
.
overdraw
=
a
.
overdraw
!==
void
0
?
a
.
overdraw
:
false
;
this
.
visible
=
a
.
visible
!==
void
0
?
a
.
visible
:
true
;
this
.
doubleSided
=
a
.
doubleSided
!==
void
0
?
a
.
doubleSided
:
false
;
...
...
build/custom/ThreeCanvas.js
浏览文件 @
60eb97d1
此差异已折叠。
点击以展开。
build/custom/ThreeWebGL.js
浏览文件 @
60eb97d1
...
...
@@ -172,21 +172,21 @@ o;){var r=h[m++],p=r&2,f=r&4,x=r&8,w=r&16,u=r&32,H=r&64,q=r&128;if(r&1){r=new TH
{};
d
.
morphColors
[
f
].
name
=
a
.
morphColors
[
f
].
name
;
d
.
morphColors
[
f
].
colors
=
[];
e
=
d
.
morphColors
[
f
].
colors
;
k
=
a
.
morphColors
[
f
].
colors
;
n
=
0
;
for
(
i
=
k
.
length
;
n
<
i
;
n
=
n
+
3
){
m
=
new
THREE
.
Color
(
16755200
);
m
.
setRGB
(
k
[
n
],
k
[
n
+
1
],
k
[
n
+
2
]);
e
.
push
(
m
)}}}
d
.
computeCentroids
();
d
.
computeFaceNormals
();
return
d
}};
THREE
.
SceneLoader
=
function
(){
this
.
onLoadStart
=
function
(){};
this
.
onLoadProgress
=
function
(){};
this
.
onLoadComplete
=
function
(){};
this
.
callbackSync
=
function
(){};
this
.
callbackProgress
=
function
(){}};
THREE
.
SceneLoader
.
prototype
.
constructor
=
THREE
.
SceneLoader
;
THREE
.
SceneLoader
.
prototype
.
load
=
function
(
a
,
b
){
var
c
=
this
,
d
=
new
XMLHttpRequest
;
d
.
onreadystatechange
=
function
(){
if
(
d
.
readyState
===
4
)
if
(
d
.
status
===
200
||
d
.
status
===
0
){
var
e
=
JSON
.
parse
(
d
.
responseText
);
c
.
createScene
(
e
,
b
,
a
)}
else
console
.
error
(
"
THREE.SceneLoader: Couldn't load [
"
+
a
+
"
] [
"
+
d
.
status
+
"
]
"
)};
d
.
open
(
"
GET
"
,
a
,
true
);
d
.
overrideMimeType
&&
d
.
overrideMimeType
(
"
text/plain; charset=x-user-defined
"
);
d
.
setRequestHeader
(
"
Content-Type
"
,
"
text/plain
"
);
d
.
send
(
null
)};
THREE
.
SceneLoader
.
prototype
.
createScene
=
function
(
a
,
b
,
c
){
function
d
(
a
,
b
){
return
b
==
"
relativeToHTML
"
?
a
:
k
+
"
/
"
+
a
}
function
e
(
){
var
a
;
for
(
n
in
z
.
objects
)
if
(
!
N
.
objects
[
n
]){
p
=
z
.
objects
[
n
];
if
(
p
.
geometry
!==
void
0
){
if
(
I
=
N
.
geometries
[
p
.
geometry
]){
a
=
false
;
U
=
N
.
materials
[
p
.
materials
[
0
]];(
a
=
U
instanceof
THREE
.
ShaderMaterial
)
&&
I
.
computeTangents
();
v
=
p
.
position
;
E
=
p
.
rotation
;
A
=
p
.
quaternion
;
G
=
p
.
scale
;
x
=
p
.
matrix
;
A
=
0
;
p
.
materials
.
length
==
0
&&
(
U
=
new
THREE
.
MeshFaceMaterial
);
p
.
materials
.
length
>
1
&&
(
U
=
new
THREE
.
MeshFaceMaterial
);
a
=
new
THREE
.
Mesh
(
I
,
U
);
a
.
name
=
n
;
if
(
x
){
a
.
matrixAutoUpdate
=
false
;
a
.
matrix
.
set
(
x
[
0
],
x
[
1
],
x
[
2
],
x
[
3
],
x
[
4
],
x
[
5
],
x
[
6
],
x
[
7
],
x
[
8
],
x
[
9
],
x
[
10
],
x
[
11
],
x
[
12
],
x
[
13
],
x
[
14
],
x
[
15
])}
else
{
a
.
position
.
set
(
v
[
0
],
v
[
1
],
v
[
2
]);
if
(
A
){
a
.
quaternion
.
set
(
A
[
0
],
A
[
1
],
A
[
2
],
A
[
3
]);
a
.
useQuaternion
=
true
}
else
a
.
rotation
.
set
(
E
[
0
],
E
[
1
],
E
[
2
]);
a
.
scale
.
set
(
G
[
0
],
G
[
1
],
G
[
2
])}
a
.
visible
=
p
.
visible
;
a
.
castShadow
=
p
.
castShadow
;
a
.
receiveShadow
=
p
.
receiveShadow
;
N
.
scene
.
add
(
a
);
N
.
objects
[
n
]
=
a
}}
else
{
v
=
p
.
position
;
E
=
p
.
rotation
;
A
=
p
.
quaternion
;
G
=
p
.
scale
;
A
=
0
;
a
=
new
THREE
.
Object3D
;
a
.
name
=
n
;
a
.
position
.
set
(
v
[
0
],
v
[
1
],
v
[
2
]);
if
(
A
){
a
.
quaternion
.
set
(
A
[
0
],
A
[
1
],
A
[
2
],
A
[
3
]);
a
.
useQuaternion
=
true
}
else
a
.
rotation
.
set
(
E
[
0
],
E
[
1
],
E
[
2
]);
a
.
scale
.
set
(
G
[
0
],
G
[
1
],
G
[
2
]);
a
.
visible
=
p
.
visible
!==
void
0
?
p
.
visible
:
false
;
N
.
scene
.
add
(
a
);
N
.
objects
[
n
]
=
a
;
N
.
empties
[
n
]
=
a
}}}
function
f
(
a
){
return
function
(
b
){
N
.
geometries
[
a
]
=
b
;
e
();
Q
=
Q
-
1
;
l
.
onLoadComplete
();
j
()}}
function
h
(
a
){
return
function
(
b
){
N
.
geometries
[
a
]
=
b
}}
function
j
(){
l
.
callbackProgress
({
totalModels
:
ea
,
totalTextures
:
ja
,
loadedModels
:
ea
-
Q
,
loadedTextures
:
ja
-
F
}
,
N
);
l
.
onLoadProgress
();
Q
===
0
&&
F
===
0
&&
b
(
N
)}
var
l
=
this
,
k
=
THREE
.
Loader
.
prototype
.
extractUrlBase
(
c
),
i
,
m
,
n
,
o
,
u
,
q
,
r
,
p
,
x
,
w
,
H
,
v
,
E
,
A
,
G
,
C
,
P
,
I
,
U
,
V
,
S
,
z
,
O
,
Q
,
F
,
ea
,
ja
,
N
;
z
=
a
;
c
=
new
THREE
.
BinaryLoader
;
O
=
new
THREE
.
JSONLoader
;
F
=
Q
=
0
;
N
=
{
scene
:
new
THREE
.
Scene
,
geometries
:{},
materials
:{},
textures
:{},
objects
:{},
cameras
:{},
lights
:{},
fogs
:{},
empties
:{}};
if
(
z
.
transform
){
a
=
z
.
transform
.
position
;
w
=
z
.
transform
.
rotation
;
C
=
z
.
transform
.
scale
;
a
&&
N
.
scene
.
position
.
set
(
a
[
0
],
a
[
1
],
a
[
2
]);
w
&&
N
.
scene
.
rotation
.
set
(
w
[
0
],
w
[
1
],
w
[
2
]);
C
&&
N
.
scene
.
scale
.
set
(
C
[
0
],
C
[
1
],
C
[
2
]);
if
(
a
||
w
||
C
){
N
.
scene
.
updateMatrix
();
N
.
scene
.
updateMatrixWorld
()}}
a
=
function
(
a
){
return
function
(){
F
=
F
-
a
;
j
();
l
.
onLoadComplete
()}};
for
(
u
in
z
.
cameras
){
C
=
z
.
cameras
[
u
];
C
.
type
===
"
perspective
"
?
V
=
new
THREE
.
PerspectiveCamera
(
C
.
fov
,
C
.
aspect
,
C
.
near
,
C
.
far
):
C
.
type
===
"
ortho
"
&&
(
V
=
new
THREE
.
OrthographicCamera
(
C
.
left
,
C
.
right
,
C
.
top
,
C
.
bottom
,
C
.
near
,
C
.
far
));
v
=
C
.
position
;
w
=
C
.
target
;
C
=
C
.
up
;
V
.
position
.
set
(
v
[
0
],
v
[
1
],
v
[
2
]);
V
.
target
=
new
THREE
.
Vector3
(
w
[
0
],
w
[
1
],
w
[
2
]);
C
&&
V
.
up
.
set
(
C
[
0
],
C
[
1
],
C
[
2
]);
N
.
cameras
[
u
]
=
V
}
for
(
o
in
z
.
lights
){
w
=
z
.
lights
[
o
];
u
=
w
.
color
!==
void
0
?
w
.
color
:
16777215
;
V
=
w
.
intensity
!==
void
0
?
w
.
intensity
:
1
;
if
(
w
.
type
===
"
directional
"
){
v
=
w
.
direction
;
H
=
new
THREE
.
DirectionalLight
(
u
,
V
);
H
.
position
.
set
(
v
[
0
],
v
[
1
],
v
[
2
]);
H
.
position
.
normalize
()}
else
if
(
w
.
type
===
"
point
"
){
v
=
w
.
position
;
H
=
w
.
distance
;
H
=
new
THREE
.
PointLight
(
u
,
V
,
H
);
H
.
position
.
set
(
v
[
0
],
v
[
1
],
v
[
2
])}
else
w
.
type
===
"
ambient
"
&&
(
H
=
new
THREE
.
AmbientLight
(
u
));
N
.
scene
.
add
(
H
);
N
.
lights
[
o
]
=
H
}
for
(
q
in
z
.
fogs
){
o
=
z
.
fogs
[
q
];
o
.
type
===
"
linear
"
?
S
=
new
THREE
.
Fog
(
0
,
o
.
near
,
o
.
far
):
o
.
type
===
"
exp2
"
&&
(
S
=
new
THREE
.
FogExp2
(
0
,
o
.
density
));
C
=
o
.
color
;
S
.
color
.
setRGB
(
C
[
0
],
C
[
1
],
C
[
2
]);
N
.
fogs
[
q
]
=
S
}
if
(
N
.
cameras
&&
z
.
defaults
.
camera
)
N
.
currentCamera
=
N
.
cameras
[
z
.
defaults
.
camera
];
if
(
N
.
fogs
&&
z
.
defaults
.
fog
)
N
.
scene
.
fog
=
N
.
fogs
[
z
.
defaults
.
fog
];
C
=
z
.
defaults
.
bgcolor
;
N
.
bgColor
=
new
THREE
.
Color
;
N
.
bgColor
.
setRGB
(
C
[
0
],
C
[
1
],
C
[
2
]);
N
.
bgColorAlpha
=
z
.
defaults
.
bgalpha
;
for
(
i
in
z
.
geometries
){
q
=
z
.
geometries
[
i
];
if
(
q
.
type
==
"
bin_mesh
"
||
q
.
type
==
"
ascii_mesh
"
){
Q
=
Q
+
1
;
l
.
onLoadStart
()}}
ea
=
Q
;
for
(
i
in
z
.
geometries
){
q
=
z
.
geometries
[
i
];
if
(
q
.
type
==
=
"
cube
"
){
I
=
new
THREE
.
CubeGeometry
(
q
.
width
,
q
.
height
,
q
.
depth
,
q
.
segmentsWidth
,
q
.
segmentsHeight
,
q
.
segmentsDepth
,
null
,
q
.
flipped
,
q
.
sides
);
N
.
geometries
[
i
]
=
I
}
else
if
(
q
.
type
===
"
plane
"
){
I
=
new
THREE
.
PlaneGeometry
(
q
.
width
,
q
.
height
,
q
.
segmentsWidth
,
q
.
segmentsHeight
);
N
.
geometries
[
i
]
=
I
}
else
if
(
q
.
type
===
"
sphere
"
){
I
=
new
THREE
.
SphereGeometry
(
q
.
radius
,
q
.
segmentsWidth
,
q
.
segmentsHeight
);
N
.
geometries
[
i
]
=
I
}
else
if
(
q
.
type
===
"
cylinder
"
){
I
=
new
THREE
.
CylinderGeometry
(
q
.
topRad
,
q
.
botRad
,
q
.
height
,
q
.
radSegs
,
q
.
heightSegs
);
N
.
geometries
[
i
]
=
I
}
else
if
(
q
.
type
===
"
torus
"
){
I
=
new
THREE
.
TorusGeometry
(
q
.
radius
,
q
.
tube
,
q
.
segmentsR
,
q
.
segmentsT
);
N
.
geometries
[
i
]
=
I
}
else
if
(
q
.
type
===
"
icosahedron
"
){
I
=
new
THREE
.
IcosahedronGeometry
(
q
.
radius
,
q
.
subdivisions
);
N
.
geometries
[
i
]
=
I
}
else
if
(
q
.
type
===
"
bin_mesh
"
)
c
.
load
(
d
(
q
.
url
,
z
.
urlBaseType
),
f
(
i
));
else
if
(
q
.
type
===
"
ascii_mesh
"
)
O
.
load
(
d
(
q
.
url
,
z
.
urlBaseType
),
f
(
i
));
else
if
(
q
.
type
===
"
embedded_mesh
"
){
q
=
z
.
embeds
[
q
.
id
];
q
.
metadata
=
z
.
metadata
;
q
&&
O
.
createModel
(
q
,
h
(
i
),
""
)}}
for
(
r
in
z
.
textures
){
i
=
z
.
textures
[
r
];
if
(
i
.
url
instanceof
Array
){
F
=
F
+
i
.
url
.
length
;
for
(
q
=
0
;
q
<
i
.
url
.
length
;
q
++
)
l
.
onLoadStart
()}
else
{
F
=
F
+
1
;
l
.
onLoadStart
()}}
ja
=
F
;
for
(
r
in
z
.
textures
){
i
=
z
.
textures
[
r
];
if
(
i
.
mapping
!==
void
0
&&
THREE
[
i
.
mapping
]
!==
void
0
)
i
.
mapping
=
new
THREE
[
i
.
mapping
];
if
(
i
.
url
instanceof
Array
){
q
=
i
.
url
.
length
;
S
=
[];
for
(
c
=
0
;
c
<
q
;
c
++
)
S
[
c
]
=
d
(
i
.
url
[
c
],
z
.
urlBaseType
);
q
=
THREE
.
ImageUtils
.
loadTextureCube
(
S
,
i
.
mapping
,
a
(
q
))}
else
{
q
=
THREE
.
ImageUtils
.
loadTexture
(
d
(
i
.
url
,
z
.
urlBaseType
),
i
.
mapping
,
a
(
1
));
if
(
THREE
[
i
.
minFilter
]
!==
void
0
)
q
.
minFilter
=
THREE
[
i
.
minFilter
]
;
if
(
THREE
[
i
.
m
agFilter
]
!==
void
0
)
q
.
magFilter
=
THREE
[
i
.
magFilter
];
if
(
i
.
repeat
){
q
.
repeat
.
set
(
i
.
repeat
[
0
],
i
.
repeat
[
1
]);
if
(
i
.
repeat
[
0
]
!==
1
)
q
.
wrapS
=
THREE
.
RepeatWrapping
;
if
(
i
.
repeat
[
1
]
!==
1
)
q
.
wrapT
=
THREE
.
RepeatWrapping
}
i
.
offset
&&
q
.
offset
.
set
(
i
.
offset
[
0
],
i
.
offset
[
1
]);
if
(
i
.
wrap
){
S
=
{
repeat
:
THREE
.
RepeatWrapping
,
mirror
:
THREE
.
MirroredRepeatWrapping
};
if
(
S
[
i
.
wrap
[
0
]]
!==
void
0
)
q
.
wrapS
=
S
[
i
.
wrap
[
0
]];
if
(
S
[
i
.
wrap
[
1
]]
!==
void
0
)
q
.
wrapT
=
S
[
i
.
wrap
[
1
]]}}
N
.
textures
[
r
]
=
q
}
for
(
m
in
z
.
materials
){
x
=
z
.
materials
[
m
];
for
(
P
in
x
.
parameters
)
if
(
P
==
=
"
envMap
"
||
P
===
"
map
"
||
P
===
"
lightMap
"
)
x
.
parameters
[
P
]
=
N
.
textures
[
x
.
parameters
[
P
]];
else
if
(
P
===
"
shading
"
)
x
.
parameters
[
P
]
=
x
.
parameters
[
P
]
==
"
flat
"
?
THREE
.
FlatShading
:
THREE
.
SmoothShading
;
else
if
(
P
===
"
blending
"
)
x
.
parameters
[
P
]
=
x
.
parameters
[
P
]
in
THREE
?
THREE
[
x
.
parameters
[
P
]]:
THREE
.
NormalBlending
;
else
if
(
P
===
"
combine
"
)
x
.
parameters
[
P
]
=
x
.
parameters
[
P
]
==
"
MixOperation
"
?
THREE
.
MixOperation
:
THREE
.
MultiplyOperation
;
else
if
(
P
===
"
vertexColors
"
)
if
(
x
.
parameters
[
P
]
==
"
face
"
)
x
.
parameters
[
P
]
=
THREE
.
FaceColors
;
else
if
(
x
.
parameters
[
P
])
x
.
parameters
[
P
]
=
THREE
.
VertexColors
;
if
(
x
.
parameters
.
opacity
!==
void
0
&&
x
.
parameters
.
opacity
<
1
)
x
.
parameters
.
transparent
=
true
;
if
(
x
.
parameters
.
normalMap
){
r
=
THREE
.
ShaderUtils
.
lib
.
normal
;
a
=
THREE
.
UniformsUtils
.
clone
(
r
.
uniforms
);
i
=
x
.
parameters
.
color
;
q
=
x
.
parameters
.
specular
;
S
=
x
.
parameters
.
ambient
;
c
=
x
.
parameters
.
shininess
;
a
.
tNormal
.
texture
=
N
.
textures
[
x
.
parameters
.
normalMap
];
if
(
x
.
parameters
.
normalMapFactor
)
a
.
uNormalScale
.
value
=
x
.
parameters
.
normalMapFactor
;
if
(
x
.
parameters
.
map
){
a
.
tDiffuse
.
texture
=
x
.
parameters
.
map
;
a
.
enableDiffuse
.
value
=
true
}
if
(
x
.
parameters
.
lightMap
){
a
.
tAO
.
texture
=
x
.
parameters
.
lightMap
;
a
.
enableAO
.
value
=
true
}
if
(
x
.
parameters
.
specularMap
){
a
.
tSpecular
.
texture
=
N
.
textures
[
x
.
parameters
.
specularMap
];
a
.
enableSpecular
.
value
=
true
}
a
.
uDiffuseColor
.
value
.
setHex
(
i
);
a
.
uSpecularColor
.
value
.
setHex
(
q
);
a
.
uAmbientColor
.
value
.
setHex
(
S
);
a
.
uShininess
.
value
=
c
;
if
(
x
.
parameters
.
opacity
)
a
.
uOpacity
.
value
=
x
.
parameters
.
opacity
;
U
=
new
THREE
.
ShaderMaterial
({
fragmentShader
:
r
.
fragmentShader
,
vertexShader
:
r
.
vertexShader
,
uniforms
:
a
,
lights
:
true
,
fog
:
true
})}
else
U
=
new
THREE
[
x
.
type
](
x
.
parameters
);
N
.
materials
[
m
]
=
U
}
e
(
);
l
.
callbackSync
(
N
);
j
()};
THREE
.
TextureLoader
=
function
(){
THREE
.
EventTarget
.
call
(
this
);
this
.
crossOrigin
=
null
};
THREE
.
SceneLoader
.
prototype
.
createScene
=
function
(
a
,
b
,
c
){
function
d
(
a
,
b
){
return
b
==
"
relativeToHTML
"
?
a
:
k
+
"
/
"
+
a
}
function
e
(
a
,
b
){
var
c
;
for
(
n
in
b
)
if
(
N
.
objects
[
n
]
===
void
0
){
p
=
b
[
n
];
if
(
p
.
geometry
!==
void
0
){
if
(
I
=
N
.
geometries
[
p
.
geometry
]){
c
=
false
;
U
=
N
.
materials
[
p
.
materials
[
0
]];(
c
=
U
instanceof
THREE
.
ShaderMaterial
)
&&
I
.
computeTangents
();
v
=
p
.
position
;
E
=
p
.
rotation
;
A
=
p
.
quaternion
;
G
=
p
.
scale
;
x
=
p
.
matrix
;
A
=
0
;
p
.
materials
.
length
==
0
&&
(
U
=
new
THREE
.
MeshFaceMaterial
);
p
.
materials
.
length
>
1
&&
(
U
=
new
THREE
.
MeshFaceMaterial
);
c
=
new
THREE
.
Mesh
(
I
,
U
);
c
.
name
=
n
;
if
(
x
){
c
.
matrixAutoUpdate
=
false
;
c
.
matrix
.
set
(
x
[
0
],
x
[
1
],
x
[
2
],
x
[
3
],
x
[
4
],
x
[
5
],
x
[
6
],
x
[
7
],
x
[
8
],
x
[
9
],
x
[
10
],
x
[
11
],
x
[
12
],
x
[
13
],
x
[
14
],
x
[
15
])}
else
{
c
.
position
.
set
(
v
[
0
],
v
[
1
],
v
[
2
]);
if
(
A
){
c
.
quaternion
.
set
(
A
[
0
],
A
[
1
],
A
[
2
],
A
[
3
]);
c
.
useQuaternion
=
true
}
else
c
.
rotation
.
set
(
E
[
0
],
E
[
1
],
E
[
2
]);
c
.
scale
.
set
(
G
[
0
],
G
[
1
],
G
[
2
])}
c
.
visible
=
p
.
visible
;
c
.
castShadow
=
p
.
castShadow
;
c
.
receiveShadow
=
p
.
receiveShadow
;
a
.
add
(
c
);
N
.
objects
[
n
]
=
c
}}
else
{
v
=
p
.
position
;
E
=
p
.
rotation
;
A
=
p
.
quaternion
;
G
=
p
.
scale
;
A
=
0
;
c
=
new
THREE
.
Object3D
;
c
.
name
=
n
;
c
.
position
.
set
(
v
[
0
],
v
[
1
],
v
[
2
]);
if
(
A
){
c
.
quaternion
.
set
(
A
[
0
],
A
[
1
],
A
[
2
],
A
[
3
]);
c
.
useQuaternion
=
true
}
else
c
.
rotation
.
set
(
E
[
0
],
E
[
1
],
E
[
2
]);
c
.
scale
.
set
(
G
[
0
],
G
[
1
],
G
[
2
]);
c
.
visible
=
p
.
visible
!==
void
0
?
p
.
visible
:
false
;
a
.
add
(
c
);
N
.
objects
[
n
]
=
c
;
N
.
empties
[
n
]
=
c
}
p
.
children
!==
void
0
&&
e
(
c
,
p
.
children
)}}
function
f
(
a
){
return
function
(
b
){
N
.
geometries
[
a
]
=
b
;
e
(
N
.
scene
,
z
.
objects
);
Q
=
Q
-
1
;
l
.
onLoadComplete
();
j
()}}
function
h
(
a
){
return
function
(
b
){
N
.
geometries
[
a
]
=
b
}}
function
j
(){
l
.
callbackProgress
({
totalModels
:
ea
,
totalTextures
:
ja
,
loadedModels
:
ea
-
Q
,
loadedTextures
:
ja
-
F
},
N
);
l
.
onLoadProgress
();
Q
===
0
&&
F
===
0
&&
b
(
N
)}
var
l
=
this
,
k
=
THREE
.
Loader
.
prototype
.
extractUrlBase
(
c
),
i
,
m
,
n
,
o
,
u
,
q
,
r
,
p
,
x
,
w
,
H
,
v
,
E
,
A
,
G
,
C
,
P
,
I
,
U
,
V
,
S
,
z
,
O
,
Q
,
F
,
ea
,
ja
,
N
;
z
=
a
;
c
=
new
THREE
.
BinaryLoader
;
O
=
new
THREE
.
JSONLoader
;
F
=
Q
=
0
;
N
=
{
scene
:
new
THREE
.
Scene
,
geometries
:{},
materials
:{},
textures
:{},
objects
:{},
cameras
:{},
lights
:{},
fogs
:{},
empties
:{}};
if
(
z
.
transform
){
a
=
z
.
transform
.
position
;
w
=
z
.
transform
.
rotation
;
C
=
z
.
transform
.
scale
;
a
&&
N
.
scene
.
position
.
set
(
a
[
0
],
a
[
1
],
a
[
2
]);
w
&&
N
.
scene
.
rotation
.
set
(
w
[
0
],
w
[
1
],
w
[
2
]);
C
&&
N
.
scene
.
scale
.
set
(
C
[
0
],
C
[
1
],
C
[
2
]);
if
(
a
||
w
||
C
){
N
.
scene
.
updateMatrix
();
N
.
scene
.
updateMatrixWorld
()}}
a
=
function
(
a
){
return
function
(){
F
=
F
-
a
;
j
();
l
.
onLoadComplete
()}};
for
(
u
in
z
.
cameras
){
C
=
z
.
cameras
[
u
];
C
.
type
===
"
perspective
"
?
V
=
new
THREE
.
PerspectiveCamera
(
C
.
fov
,
C
.
aspect
,
C
.
near
,
C
.
far
):
C
.
type
===
"
ortho
"
&&
(
V
=
new
THREE
.
OrthographicCamera
(
C
.
left
,
C
.
right
,
C
.
top
,
C
.
bottom
,
C
.
near
,
C
.
far
));
v
=
C
.
position
;
w
=
C
.
target
;
C
=
C
.
up
;
V
.
position
.
set
(
v
[
0
],
v
[
1
],
v
[
2
]);
V
.
target
=
new
THREE
.
Vector3
(
w
[
0
],
w
[
1
],
w
[
2
]);
C
&&
V
.
up
.
set
(
C
[
0
],
C
[
1
],
C
[
2
]);
N
.
cameras
[
u
]
=
V
}
for
(
o
in
z
.
lights
){
w
=
z
.
lights
[
o
];
u
=
w
.
color
!==
void
0
?
w
.
color
:
16777215
;
V
=
w
.
intensity
!==
void
0
?
w
.
intensity
:
1
;
if
(
w
.
type
===
"
directional
"
){
v
=
w
.
direction
;
H
=
new
THREE
.
DirectionalLight
(
u
,
V
);
H
.
position
.
set
(
v
[
0
],
v
[
1
],
v
[
2
]);
H
.
position
.
normalize
()}
else
if
(
w
.
type
===
"
point
"
){
v
=
w
.
position
;
H
=
w
.
distance
;
H
=
new
THREE
.
PointLight
(
u
,
V
,
H
);
H
.
position
.
set
(
v
[
0
],
v
[
1
],
v
[
2
])}
else
w
.
type
===
"
ambient
"
&&
(
H
=
new
THREE
.
AmbientLight
(
u
));
N
.
scene
.
add
(
H
);
N
.
lights
[
o
]
=
H
}
for
(
q
in
z
.
fogs
){
o
=
z
.
fogs
[
q
];
o
.
type
===
"
linear
"
?
S
=
new
THREE
.
Fog
(
0
,
o
.
near
,
o
.
far
):
o
.
type
===
"
exp2
"
&&
(
S
=
new
THREE
.
FogExp2
(
0
,
o
.
density
));
C
=
o
.
color
;
S
.
color
.
setRGB
(
C
[
0
],
C
[
1
],
C
[
2
]);
N
.
fogs
[
q
]
=
S
}
if
(
N
.
cameras
&&
z
.
defaults
.
camera
)
N
.
currentCamera
=
N
.
cameras
[
z
.
defaults
.
camera
];
if
(
N
.
fogs
&&
z
.
defaults
.
fog
)
N
.
scene
.
fog
=
N
.
fogs
[
z
.
defaults
.
fog
];
C
=
z
.
defaults
.
bgcolor
;
N
.
bgColor
=
new
THREE
.
Color
;
N
.
bgColor
.
setRGB
(
C
[
0
],
C
[
1
],
C
[
2
]);
N
.
bgColorAlpha
=
z
.
defaults
.
bgalpha
;
for
(
i
in
z
.
geometries
){
q
=
z
.
geometries
[
i
];
if
(
q
.
type
==
"
bin_mesh
"
||
q
.
type
==
"
ascii_mesh
"
){
Q
=
Q
+
1
;
l
.
onLoadStart
()}}
ea
=
Q
;
for
(
i
in
z
.
geometries
){
q
=
z
.
geometries
[
i
];
if
(
q
.
type
===
"
cube
"
){
I
=
new
THREE
.
CubeGeometry
(
q
.
width
,
q
.
height
,
q
.
depth
,
q
.
segmentsWidth
,
q
.
segmentsHeight
,
q
.
segmentsDepth
,
null
,
q
.
flipped
,
q
.
sides
);
N
.
geometries
[
i
]
=
I
}
else
if
(
q
.
type
===
"
plane
"
){
I
=
new
THREE
.
PlaneGeometry
(
q
.
width
,
q
.
height
,
q
.
segmentsWidth
,
q
.
segmentsHeight
);
N
.
geometries
[
i
]
=
I
}
else
if
(
q
.
type
===
"
sphere
"
){
I
=
new
THREE
.
SphereGeometry
(
q
.
radius
,
q
.
segmentsWidth
,
q
.
segmentsHeight
);
N
.
geometries
[
i
]
=
I
}
else
if
(
q
.
type
===
"
cylinder
"
){
I
=
new
THREE
.
CylinderGeometry
(
q
.
topRad
,
q
.
botRad
,
q
.
height
,
q
.
radSegs
,
q
.
heightSegs
);
N
.
geometries
[
i
]
=
I
}
else
if
(
q
.
type
===
"
torus
"
){
I
=
new
THREE
.
TorusGeometry
(
q
.
radius
,
q
.
tube
,
q
.
segmentsR
,
q
.
segmentsT
);
N
.
geometries
[
i
]
=
I
}
else
if
(
q
.
type
===
"
icosahedron
"
){
I
=
new
THREE
.
IcosahedronGeometry
(
q
.
radius
,
q
.
subdivisions
);
N
.
geometries
[
i
]
=
I
}
else
if
(
q
.
type
===
"
bin_mesh
"
)
c
.
load
(
d
(
q
.
url
,
z
.
urlBaseType
),
f
(
i
));
else
if
(
q
.
type
===
"
ascii_mesh
"
)
O
.
load
(
d
(
q
.
url
,
z
.
urlBaseType
),
f
(
i
));
else
if
(
q
.
type
===
"
embedded_mesh
"
){
q
=
z
.
embeds
[
q
.
id
];
q
.
metadata
=
z
.
metadata
;
q
&&
O
.
createModel
(
q
,
h
(
i
),
""
)}}
for
(
r
in
z
.
textures
){
i
=
z
.
textures
[
r
];
if
(
i
.
url
instanceof
Array
){
F
=
F
+
i
.
url
.
length
;
for
(
q
=
0
;
q
<
i
.
url
.
length
;
q
++
)
l
.
onLoadStart
()}
else
{
F
=
F
+
1
;
l
.
onLoadStart
()}}
ja
=
F
;
for
(
r
in
z
.
textures
){
i
=
z
.
textures
[
r
];
if
(
i
.
mapping
!==
void
0
&&
THREE
[
i
.
mapping
]
!==
void
0
)
i
.
mapping
=
new
THREE
[
i
.
mapping
];
if
(
i
.
url
instanceof
Array
){
q
=
i
.
url
.
length
;
S
=
[];
for
(
c
=
0
;
c
<
q
;
c
++
)
S
[
c
]
=
d
(
i
.
url
[
c
],
z
.
urlBaseType
);
q
=
THREE
.
ImageUtils
.
loadTextureCube
(
S
,
i
.
mapping
,
a
(
q
))}
else
{
q
=
THREE
.
ImageUtils
.
loadTexture
(
d
(
i
.
url
,
z
.
urlBaseType
),
i
.
mapping
,
a
(
1
))
;
if
(
THREE
[
i
.
m
inFilter
]
!==
void
0
)
q
.
minFilter
=
THREE
[
i
.
minFilter
];
if
(
THREE
[
i
.
magFilter
]
!==
void
0
)
q
.
magFilter
=
THREE
[
i
.
magFilter
];
if
(
i
.
repeat
){
q
.
repeat
.
set
(
i
.
repeat
[
0
],
i
.
repeat
[
1
]);
if
(
i
.
repeat
[
0
]
!==
1
)
q
.
wrapS
=
THREE
.
RepeatWrapping
;
if
(
i
.
repeat
[
1
]
!==
1
)
q
.
wrapT
=
THREE
.
RepeatWrapping
}
i
.
offset
&&
q
.
offset
.
set
(
i
.
offset
[
0
],
i
.
offset
[
1
]);
if
(
i
.
wrap
){
S
=
{
repeat
:
THREE
.
RepeatWrapping
,
mirror
:
THREE
.
MirroredRepeatWrapping
};
if
(
S
[
i
.
wrap
[
0
]]
!==
void
0
)
q
.
wrapS
=
S
[
i
.
wrap
[
0
]];
if
(
S
[
i
.
wrap
[
1
]]
!==
void
0
)
q
.
wrapT
=
S
[
i
.
wrap
[
1
]]}}
N
.
textures
[
r
]
=
q
}
for
(
m
in
z
.
materials
){
x
=
z
.
materials
[
m
];
for
(
P
in
x
.
parameters
)
if
(
P
===
"
envMap
"
||
P
===
"
map
"
||
P
===
"
lightMap
"
)
x
.
parameters
[
P
]
=
N
.
textures
[
x
.
parameters
[
P
]];
else
if
(
P
===
"
shading
"
)
x
.
parameters
[
P
]
=
x
.
parameters
[
P
]
==
"
flat
"
?
THREE
.
FlatShading
:
THREE
.
SmoothShading
;
else
if
(
P
===
"
blending
"
)
x
.
parameters
[
P
]
=
x
.
parameters
[
P
]
in
THREE
?
THREE
[
x
.
parameters
[
P
]]:
THREE
.
NormalBlending
;
else
if
(
P
===
"
combine
"
)
x
.
parameters
[
P
]
=
x
.
parameters
[
P
]
==
"
MixOperation
"
?
THREE
.
MixOperation
:
THREE
.
MultiplyOperation
;
else
if
(
P
===
"
vertexColors
"
)
if
(
x
.
parameters
[
P
]
=
=
"
face
"
)
x
.
parameters
[
P
]
=
THREE
.
FaceColors
;
else
if
(
x
.
parameters
[
P
])
x
.
parameters
[
P
]
=
THREE
.
VertexColors
;
if
(
x
.
parameters
.
opacity
!==
void
0
&&
x
.
parameters
.
opacity
<
1
)
x
.
parameters
.
transparent
=
true
;
if
(
x
.
parameters
.
normalMap
){
r
=
THREE
.
ShaderUtils
.
lib
.
normal
;
a
=
THREE
.
UniformsUtils
.
clone
(
r
.
uniforms
);
i
=
x
.
parameters
.
color
;
q
=
x
.
parameters
.
specular
;
S
=
x
.
parameters
.
ambient
;
c
=
x
.
parameters
.
shininess
;
a
.
tNormal
.
texture
=
N
.
textures
[
x
.
parameters
.
normalMap
];
if
(
x
.
parameters
.
normalMapFactor
)
a
.
uNormalScale
.
value
=
x
.
parameters
.
normalMapFactor
;
if
(
x
.
parameters
.
map
){
a
.
tDiffuse
.
texture
=
x
.
parameters
.
map
;
a
.
enableDiffuse
.
value
=
true
}
if
(
x
.
parameters
.
lightMap
){
a
.
tAO
.
texture
=
x
.
parameters
.
lightMap
;
a
.
enableAO
.
value
=
true
}
if
(
x
.
parameters
.
specularMap
){
a
.
tSpecular
.
texture
=
N
.
textures
[
x
.
parameters
.
specularMap
];
a
.
enableSpecular
.
value
=
true
}
a
.
uDiffuseColor
.
value
.
setHex
(
i
);
a
.
uSpecularColor
.
value
.
setHex
(
q
);
a
.
uAmbientColor
.
value
.
setHex
(
S
);
a
.
uShininess
.
value
=
c
;
if
(
x
.
parameters
.
opacity
)
a
.
uOpacity
.
value
=
x
.
parameters
.
opacity
;
U
=
new
THREE
.
ShaderMaterial
({
fragmentShader
:
r
.
fragmentShader
,
vertexShader
:
r
.
vertexShader
,
uniforms
:
a
,
lights
:
true
,
fog
:
true
})}
else
U
=
new
THREE
[
x
.
type
](
x
.
parameters
);
N
.
materials
[
m
]
=
U
}
e
(
N
.
scene
,
z
.
objects
);
l
.
callbackSync
(
N
);
j
()};
THREE
.
TextureLoader
=
function
(){
THREE
.
EventTarget
.
call
(
this
);
this
.
crossOrigin
=
null
};
THREE
.
TextureLoader
.
prototype
=
{
constructor
:
THREE
.
TextureLoader
,
load
:
function
(
a
){
var
b
=
this
,
c
=
new
Image
;
c
.
addEventListener
(
"
load
"
,
function
(){
var
a
=
new
THREE
.
Texture
(
c
);
a
.
needsUpdate
=
true
;
b
.
dispatchEvent
({
type
:
"
load
"
,
content
:
a
})},
false
);
c
.
addEventListener
(
"
error
"
,
function
(){
b
.
dispatchEvent
({
type
:
"
error
"
,
message
:
"
Couldn't load URL [
"
+
a
+
"
]
"
})},
false
);
if
(
b
.
crossOrigin
)
c
.
crossOrigin
=
b
.
crossOrigin
;
c
.
src
=
a
}};
THREE
.
Material
=
function
(
a
){
a
=
a
||
{};
this
.
id
=
THREE
.
MaterialCount
++
;
this
.
name
=
""
;
this
.
opacity
=
a
.
opacity
!==
void
0
?
a
.
opacity
:
1
;
this
.
transparent
=
a
.
transparent
!==
void
0
?
a
.
transparent
:
false
;
this
.
blending
=
a
.
blending
!==
void
0
?
a
.
blending
:
THREE
.
NormalBlending
;
this
.
blendSrc
=
a
.
blendSrc
!==
void
0
?
a
.
blendSrc
:
THREE
.
SrcAlphaFactor
;
this
.
blendDst
=
a
.
blendDst
!==
void
0
?
a
.
blendDst
:
THREE
.
OneMinusSrcAlphaFactor
;
this
.
blendEquation
=
a
.
blendEquation
!==
void
0
?
a
.
blendEquation
:
THREE
.
AddEquation
;
this
.
depthTest
=
a
.
depthTest
!==
void
0
?
a
.
depthTest
:
true
;
this
.
depthWrite
=
a
.
depthWrite
!==
void
0
?
a
.
depthWrite
:
true
;
this
.
polygonOffset
=
a
.
polygonOffset
!==
void
0
?
a
.
polygonOffset
:
false
;
this
.
polygonOffsetFactor
=
a
.
polygonOffsetFactor
!==
void
0
?
a
.
polygonOffsetFactor
:
0
;
this
.
polygonOffsetUnits
=
a
.
polygonOffsetUnits
!==
void
0
?
a
.
polygonOffsetUnits
:
0
;
this
.
alphaTest
=
a
.
alphaTest
!==
void
0
?
a
.
alphaTest
:
0
;
this
.
overdraw
=
a
.
overdraw
!==
void
0
?
a
.
overdraw
:
false
;
this
.
visible
=
a
.
visible
!==
void
0
?
a
.
visible
:
true
;
this
.
doubleSided
=
a
.
doubleSided
!==
void
0
?
a
.
doubleSided
:
false
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录