Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
2494a9a4
T
three.js
项目概览
Ablesons
/
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,发现更多精彩内容 >>
提交
2494a9a4
编写于
1月 19, 2012
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adapted SceneLoader for the new IcosahedronGeometry.
上级
f24745dd
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
29 addition
and
28 deletion
+29
-28
build/Three.js
build/Three.js
+21
-21
build/custom/ThreeExtras.js
build/custom/ThreeExtras.js
+5
-5
examples/scenes/test_scene.js
examples/scenes/test_scene.js
+2
-1
src/extras/loaders/SceneLoader.js
src/extras/loaders/SceneLoader.js
+1
-1
未找到文件。
build/Three.js
浏览文件 @
2494a9a4
此差异已折叠。
点击以展开。
build/custom/ThreeExtras.js
浏览文件 @
2494a9a4
...
...
@@ -328,11 +328,11 @@ empties:{}};a=!1;for(p in B.objects)if(r=B.objects[p],r.meshCollider){a=!0;break
x
.
near
,
x
.
far
):
"
ortho
"
==
x
.
type
&&
(
E
=
new
THREE
.
OrthographicCamera
(
x
.
left
,
x
.
right
,
x
.
top
,
x
.
bottom
,
x
.
near
,
x
.
far
)),
v
=
x
.
position
,
t
=
x
.
target
,
x
=
x
.
up
,
E
.
position
.
set
(
v
[
0
],
v
[
1
],
v
[
2
]),
E
.
target
=
new
THREE
.
Vector3
(
t
[
0
],
t
[
1
],
t
[
2
]),
x
&&
E
.
up
.
set
(
x
[
0
],
x
[
1
],
x
[
2
]),
C
.
cameras
[
l
]
=
E
;
for
(
o
in
B
.
lights
)
t
=
B
.
lights
[
o
],
l
=
void
0
!==
t
.
color
?
t
.
color
:
16777215
,
E
=
void
0
!==
t
.
intensity
?
t
.
intensity
:
1
,
"
directional
"
==
t
.
type
?(
v
=
t
.
direction
,
s
=
new
THREE
.
DirectionalLight
(
l
,
E
),
s
.
position
.
set
(
v
[
0
],
v
[
1
],
v
[
2
]),
s
.
position
.
normalize
()):
"
point
"
==
t
.
type
?
(
v
=
t
.
position
,
s
=
t
.
distance
,
s
=
new
THREE
.
PointLight
(
l
,
E
,
s
),
s
.
position
.
set
(
v
[
0
],
v
[
1
],
v
[
2
])):
"
ambient
"
==
t
.
type
&&
(
s
=
new
THREE
.
AmbientLight
(
l
)),
C
.
scene
.
add
(
s
),
C
.
lights
[
o
]
=
s
;
for
(
n
in
B
.
fogs
)
o
=
B
.
fogs
[
n
],
"
linear
"
==
o
.
type
?
I
=
new
THREE
.
Fog
(
0
,
o
.
near
,
o
.
far
):
"
exp2
"
==
o
.
type
&&
(
I
=
new
THREE
.
FogExp2
(
0
,
o
.
density
)),
x
=
o
.
color
,
I
.
color
.
setRGB
(
x
[
0
],
x
[
1
],
x
[
2
]),
C
.
fogs
[
n
]
=
I
;
if
(
C
.
cameras
&&
B
.
defaults
.
camera
)
C
.
currentCamera
=
C
.
cameras
[
B
.
defaults
.
camera
];
if
(
C
.
fogs
&&
B
.
defaults
.
fog
)
C
.
scene
.
fog
=
C
.
fogs
[
B
.
defaults
.
fog
];
x
=
B
.
defaults
.
bgcolor
;
C
.
bgColor
=
new
THREE
.
Color
;
C
.
bgColor
.
setRGB
(
x
[
0
],
x
[
1
],
x
[
2
]);
C
.
bgColorAlpha
=
B
.
defaults
.
bgalpha
;
for
(
j
in
B
.
geometries
)
if
(
n
=
B
.
geometries
[
j
],
"
bin_mesh
"
==
n
.
type
||
"
ascii_mesh
"
==
n
.
type
)
D
+=
1
,
i
.
onLoadStart
();
y
=
D
;
for
(
j
in
B
.
geometries
)
n
=
B
.
geometries
[
j
],
"
cube
"
==
n
.
type
?(
F
=
new
THREE
.
CubeGeometry
(
n
.
width
,
n
.
height
,
n
.
depth
,
n
.
segmentsWidth
,
n
.
segmentsHeight
,
n
.
segmentsDepth
,
null
,
n
.
flipped
,
n
.
sides
),
C
.
geometries
[
j
]
=
F
):
"
plane
"
==
n
.
type
?(
F
=
new
THREE
.
PlaneGeometry
(
n
.
width
,
n
.
height
,
n
.
segmentsWidth
,
n
.
segmentsHeight
),
C
.
geometries
[
j
]
=
F
):
"
sphere
"
==
n
.
type
?(
F
=
new
THREE
.
SphereGeometry
(
n
.
radius
,
n
.
segmentsWidth
,
n
.
segmentsHeight
),
C
.
geometries
[
j
]
=
F
):
"
cylinder
"
==
n
.
type
?(
F
=
new
THREE
.
CylinderGeometry
(
n
.
topRad
,
n
.
botRad
,
n
.
height
,
n
.
radSegs
,
n
.
heightSegs
),
C
.
geometries
[
j
]
=
F
):
"
torus
"
==
n
.
type
?(
F
=
new
THREE
.
TorusGeometry
(
n
.
radius
,
n
.
tube
,
n
.
segmentsR
,
n
.
segmentsT
),
C
.
geometries
[
j
]
=
F
):
"
icosahedron
"
==
n
.
type
?(
F
=
new
THREE
.
IcosahedronGeometry
(
n
.
subdivisions
),
C
.
geometries
[
j
]
=
F
):
"
bin_mesh
"
==
n
.
type
?
c
.
load
(
d
(
n
.
url
,
B
.
urlBaseType
),
g
(
j
)):
"
ascii_mesh
"
==
n
.
type
?
G
.
load
(
d
(
n
.
url
,
B
.
urlBaseType
),
g
(
j
)):
"
embedded_mesh
"
==
n
.
type
&&
(
n
=
B
.
embeds
[
n
.
id
])
&&
G
.
createModel
(
n
,
e
(
j
),
""
);
for
(
q
in
B
.
textures
)
if
(
j
=
B
.
textures
[
q
],
j
.
url
instanceof
Array
){
H
+=
j
.
url
.
length
;
for
(
n
=
0
;
n
<
j
.
url
.
length
;
n
++
)
i
.
onLoadStart
()}
else
H
+=
1
,
i
.
onLoadStart
();
L
=
H
;
for
(
q
in
B
.
textures
){
j
=
B
.
textures
[
q
];
if
(
void
0
!=
j
.
mapping
&&
void
0
!=
THREE
[
j
.
mapping
])
j
.
mapping
=
new
THREE
[
j
.
mapping
];
if
(
j
.
url
instanceof
Array
){
n
=
[];
for
(
var
K
=
0
;
K
<
j
.
url
.
length
;
K
++
)
n
[
K
]
=
d
(
j
.
url
[
K
],
B
.
urlBaseType
);
n
=
THREE
.
ImageUtils
.
loadTextureCube
(
n
,
j
.
mapping
,
a
)}
else
{
n
=
THREE
.
ImageUtils
.
loadTexture
(
d
(
j
.
url
,
B
.
urlBaseType
),
j
.
mapping
,
a
);
if
(
void
0
!=
THREE
[
j
.
minFilter
])
n
.
minFilter
=
THREE
[
j
.
minFilter
];
if
(
void
0
!=
THREE
[
j
.
magFilter
])
n
.
magFilter
=
THREE
[
j
.
magFilter
];
if
(
j
.
repeat
){
n
.
repeat
.
set
(
j
.
repeat
[
0
],
j
.
repeat
[
1
]);
if
(
1
!=
j
.
repeat
[
0
])
n
.
wrapS
=
THREE
.
RepeatWrapping
;
if
(
1
!=
j
.
repeat
[
1
])
n
.
wrapT
=
THREE
.
RepeatWrapping
}
j
.
offset
&&
n
.
offset
.
set
(
j
.
offset
[
0
],
j
.
offset
[
1
]);
if
(
j
.
wrap
){
I
=
{
repeat
:
THREE
.
RepeatWrapping
,
mirror
:
THREE
.
MirroredRepeatWrapping
};
if
(
void
0
!==
I
[
j
.
wrap
[
0
]])
n
.
wrapS
=
I
[
j
.
wrap
[
0
]];
if
(
void
0
!==
I
[
j
.
wrap
[
1
]])
n
.
wrapT
=
I
[
j
.
wrap
[
1
]]}}
C
.
textures
[
q
]
=
n
}
for
(
m
in
B
.
materials
){
q
=
B
.
materials
[
m
];
for
(
A
in
q
.
parameters
)
if
(
"
envMap
"
==
A
||
"
map
"
==
A
||
"
lightMap
"
==
A
)
q
.
parameters
[
A
]
=
C
.
textures
[
q
.
parameters
[
A
]];
else
if
(
"
shading
"
==
A
)
q
.
parameters
[
A
]
=
"
flat
"
==
q
.
parameters
[
A
]?
THREE
.
FlatShading
:
THREE
.
SmoothShading
;
else
if
(
"
blending
"
==
A
)
q
.
parameters
[
A
]
=
THREE
[
q
.
parameters
[
A
]]?
THREE
[
q
.
parameters
[
A
]]:
THREE
.
NormalBlending
;
else
if
(
"
combine
"
==
A
)
q
.
parameters
[
A
]
=
"
MixOperation
"
==
q
.
parameters
[
A
]?
THREE
.
MixOperation
:
THREE
.
MultiplyOperation
;
else
if
(
"
vertexColors
"
==
A
)
if
(
"
face
"
==
q
.
parameters
[
A
])
q
.
parameters
[
A
]
=
THREE
.
FaceColors
;
else
if
(
q
.
parameters
[
A
])
q
.
parameters
[
A
]
=
THREE
.
VertexColors
;
if
(
void
0
!==
q
.
parameters
.
opacity
&&
1
>
q
.
parameters
.
opacity
)
q
.
parameters
.
transparent
=!
0
;
if
(
q
.
parameters
.
normalMap
){
j
=
THREE
.
ShaderUtils
.
lib
.
normal
;
a
=
THREE
.
UniformsUtils
.
clone
(
j
.
uniforms
);
n
=
q
.
parameters
.
color
;
I
=
q
.
parameters
.
specular
;
c
=
q
.
parameters
.
ambient
;
G
=
q
.
parameters
.
shininess
;
a
.
tNormal
.
texture
=
C
.
textures
[
q
.
parameters
.
normalMap
];
if
(
q
.
parameters
.
normalMapFactor
)
a
.
uNormalScale
.
value
=
F
):
"
sphere
"
==
n
.
type
?(
F
=
new
THREE
.
SphereGeometry
(
n
.
radius
,
n
.
segmentsWidth
,
n
.
segmentsHeight
),
C
.
geometries
[
j
]
=
F
):
"
cylinder
"
==
n
.
type
?(
F
=
new
THREE
.
CylinderGeometry
(
n
.
topRad
,
n
.
botRad
,
n
.
height
,
n
.
radSegs
,
n
.
heightSegs
),
C
.
geometries
[
j
]
=
F
):
"
torus
"
==
n
.
type
?(
F
=
new
THREE
.
TorusGeometry
(
n
.
radius
,
n
.
tube
,
n
.
segmentsR
,
n
.
segmentsT
),
C
.
geometries
[
j
]
=
F
):
"
icosahedron
"
==
n
.
type
?(
F
=
new
THREE
.
IcosahedronGeometry
(
n
.
radius
,
n
.
subdivisions
),
C
.
geometries
[
j
]
=
F
):
"
bin_mesh
"
==
n
.
type
?
c
.
load
(
d
(
n
.
url
,
B
.
urlBaseType
),
g
(
j
)):
"
ascii_mesh
"
==
n
.
type
?
G
.
load
(
d
(
n
.
url
,
B
.
urlBaseType
),
g
(
j
)):
"
embedded_mesh
"
==
n
.
type
&&
(
n
=
B
.
embeds
[
n
.
id
])
&&
G
.
createModel
(
n
,
e
(
j
),
""
);
for
(
q
in
B
.
textures
)
if
(
j
=
B
.
textures
[
q
],
j
.
url
instanceof
Array
){
H
+=
j
.
url
.
length
;
for
(
n
=
0
;
n
<
j
.
url
.
length
;
n
++
)
i
.
onLoadStart
()}
else
H
+=
1
,
i
.
onLoadStart
();
L
=
H
;
for
(
q
in
B
.
textures
){
j
=
B
.
textures
[
q
];
if
(
void
0
!=
j
.
mapping
&&
void
0
!=
THREE
[
j
.
mapping
])
j
.
mapping
=
new
THREE
[
j
.
mapping
];
if
(
j
.
url
instanceof
Array
){
n
=
[];
for
(
var
K
=
0
;
K
<
j
.
url
.
length
;
K
++
)
n
[
K
]
=
d
(
j
.
url
[
K
],
B
.
urlBaseType
);
n
=
THREE
.
ImageUtils
.
loadTextureCube
(
n
,
j
.
mapping
,
a
)}
else
{
n
=
THREE
.
ImageUtils
.
loadTexture
(
d
(
j
.
url
,
B
.
urlBaseType
),
j
.
mapping
,
a
);
if
(
void
0
!=
THREE
[
j
.
minFilter
])
n
.
minFilter
=
THREE
[
j
.
minFilter
];
if
(
void
0
!=
THREE
[
j
.
magFilter
])
n
.
magFilter
=
THREE
[
j
.
magFilter
];
if
(
j
.
repeat
){
n
.
repeat
.
set
(
j
.
repeat
[
0
],
j
.
repeat
[
1
]);
if
(
1
!=
j
.
repeat
[
0
])
n
.
wrapS
=
THREE
.
RepeatWrapping
;
if
(
1
!=
j
.
repeat
[
1
])
n
.
wrapT
=
THREE
.
RepeatWrapping
}
j
.
offset
&&
n
.
offset
.
set
(
j
.
offset
[
0
],
j
.
offset
[
1
]);
if
(
j
.
wrap
){
I
=
{
repeat
:
THREE
.
RepeatWrapping
,
mirror
:
THREE
.
MirroredRepeatWrapping
};
if
(
void
0
!==
I
[
j
.
wrap
[
0
]])
n
.
wrapS
=
I
[
j
.
wrap
[
0
]];
if
(
void
0
!==
I
[
j
.
wrap
[
1
]])
n
.
wrapT
=
I
[
j
.
wrap
[
1
]]}}
C
.
textures
[
q
]
=
n
}
for
(
m
in
B
.
materials
){
q
=
B
.
materials
[
m
];
for
(
A
in
q
.
parameters
)
if
(
"
envMap
"
==
A
||
"
map
"
==
A
||
"
lightMap
"
==
A
)
q
.
parameters
[
A
]
=
C
.
textures
[
q
.
parameters
[
A
]];
else
if
(
"
shading
"
==
A
)
q
.
parameters
[
A
]
=
"
flat
"
==
q
.
parameters
[
A
]?
THREE
.
FlatShading
:
THREE
.
SmoothShading
;
else
if
(
"
blending
"
==
A
)
q
.
parameters
[
A
]
=
THREE
[
q
.
parameters
[
A
]]?
THREE
[
q
.
parameters
[
A
]]:
THREE
.
NormalBlending
;
else
if
(
"
combine
"
==
A
)
q
.
parameters
[
A
]
=
"
MixOperation
"
==
q
.
parameters
[
A
]?
THREE
.
MixOperation
:
THREE
.
MultiplyOperation
;
else
if
(
"
vertexColors
"
==
A
)
if
(
"
face
"
==
q
.
parameters
[
A
])
q
.
parameters
[
A
]
=
THREE
.
FaceColors
;
else
if
(
q
.
parameters
[
A
])
q
.
parameters
[
A
]
=
THREE
.
VertexColors
;
if
(
void
0
!==
q
.
parameters
.
opacity
&&
1
>
q
.
parameters
.
opacity
)
q
.
parameters
.
transparent
=!
0
;
if
(
q
.
parameters
.
normalMap
){
j
=
THREE
.
ShaderUtils
.
lib
.
normal
;
a
=
THREE
.
UniformsUtils
.
clone
(
j
.
uniforms
);
n
=
q
.
parameters
.
color
;
I
=
q
.
parameters
.
specular
;
c
=
q
.
parameters
.
ambient
;
G
=
q
.
parameters
.
shininess
;
a
.
tNormal
.
texture
=
C
.
textures
[
q
.
parameters
.
normalMap
];
if
(
q
.
parameters
.
normalMapFactor
)
a
.
uNormalScale
.
value
=
q
.
parameters
.
normalMapFactor
;
if
(
q
.
parameters
.
map
)
a
.
tDiffuse
.
texture
=
q
.
parameters
.
map
,
a
.
enableDiffuse
.
value
=!
0
;
if
(
q
.
parameters
.
lightMap
)
a
.
tAO
.
texture
=
q
.
parameters
.
lightMap
,
a
.
enableAO
.
value
=!
0
;
if
(
q
.
parameters
.
specularMap
)
a
.
tSpecular
.
texture
=
C
.
textures
[
q
.
parameters
.
specularMap
],
a
.
enableSpecular
.
value
=!
0
;
a
.
uDiffuseColor
.
value
.
setHex
(
n
);
a
.
uSpecularColor
.
value
.
setHex
(
I
);
a
.
uAmbientColor
.
value
.
setHex
(
c
);
a
.
uShininess
.
value
=
G
;
if
(
q
.
parameters
.
opacity
)
a
.
uOpacity
.
value
=
q
.
parameters
.
opacity
;
q
=
new
THREE
.
ShaderMaterial
({
fragmentShader
:
j
.
fragmentShader
,
vertexShader
:
j
.
vertexShader
,
uniforms
:
a
,
lights
:
!
0
,
fog
:
!
0
})}
else
q
=
new
THREE
[
q
.
type
](
q
.
parameters
);
C
.
materials
[
m
]
=
q
}
f
();
i
.
callbackSync
(
C
);
h
()};
THREE
.
UTF8Loader
=
function
(){};
THREE
.
UTF8Loader
.
prototype
=
new
THREE
.
UTF8Loader
;
THREE
.
UTF8Loader
.
prototype
.
constructor
=
THREE
.
UTF8Loader
;
THREE
.
UTF8Loader
.
prototype
.
load
=
function
(
a
,
b
,
c
){
if
(
a
instanceof
Object
)
console
.
warn
(
"
DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData ).
"
),
c
=
a
,
a
=
c
.
model
,
b
=
c
.
callback
,
c
=
{
scale
:
c
.
scale
,
offsetX
:
c
.
offsetX
,
offsetY
:
c
.
offsetY
,
offsetZ
:
c
.
offsetZ
};
var
d
=
new
XMLHttpRequest
,
f
=
void
0
!==
c
.
scale
?
c
.
scale
:
1
,
g
=
void
0
!==
c
.
offsetX
?
c
.
offsetX
:
0
,
e
=
void
0
!==
c
.
offsetY
?
c
.
offsetY
:
0
,
h
=
void
0
!==
c
.
offsetZ
?
c
.
offsetZ
:
0
;
d
.
onreadystatechange
=
function
(){
4
==
d
.
readyState
?
200
==
d
.
status
||
0
==
d
.
status
?
THREE
.
UTF8Loader
.
prototype
.
createModel
(
d
.
responseText
,
...
...
examples/scenes/test_scene.js
浏览文件 @
2494a9a4
...
...
@@ -60,7 +60,7 @@
"
materials
"
:
[
"
faceted_white
"
],
"
position
"
:
[
20
,
10
,
-
60
],
"
rotation
"
:
[
0
,
0
,
0
],
"
scale
"
:
[
20
,
20
,
20
],
"
scale
"
:
[
1
,
1
,
1
],
"
visible
"
:
true
},
...
...
@@ -178,6 +178,7 @@
"
icosahedron
"
:
{
"
type
"
:
"
icosahedron
"
,
"
radius
"
:
20
,
"
subdivisions
"
:
2
},
...
...
src/extras/loaders/SceneLoader.js
浏览文件 @
2494a9a4
...
...
@@ -562,7 +562,7 @@ THREE.SceneLoader.prototype.createScene = function ( json, callbackFinished, url
}
else
if
(
g
.
type
==
"
icosahedron
"
)
{
geometry
=
new
THREE
.
IcosahedronGeometry
(
g
.
subdivisions
);
geometry
=
new
THREE
.
IcosahedronGeometry
(
g
.
radius
,
g
.
subdivisions
);
result
.
geometries
[
dg
]
=
geometry
;
}
else
if
(
g
.
type
==
"
bin_mesh
"
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录