Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
25b71ec2
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,发现更多精彩内容 >>
提交
25b71ec2
编写于
2月 13, 2018
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improved GLTFLoader example.
上级
e6de696f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
13 addition
and
40 deletion
+13
-40
examples/webgl_loader_gltf.html
examples/webgl_loader_gltf.html
+13
-40
未找到文件。
examples/webgl_loader_gltf.html
浏览文件 @
25b71ec2
...
...
@@ -37,9 +37,8 @@
<script
src=
"../build/three.js"
></script>
<script
src=
"js/loaders/GLTFLoader.js"
></script>
<script
src=
"js/controls/OrbitControls.js"
></script>
<script
src=
"js/loaders/GLTFLoader.js"
></script>
<script
src=
"js/Detector.js"
></script>
<script
src=
"js/libs/stats.min.js"
></script>
...
...
@@ -66,41 +65,8 @@
controls
.
target
.
set
(
0
,
-
0.2
,
-
0.2
);
controls
.
update
();
scene
=
new
THREE
.
Scene
();
scene
.
background
=
new
THREE
.
Color
(
0x443333
);
scene
.
fog
=
new
THREE
.
Fog
(
0x443333
,
2
,
10
);
light
=
new
THREE
.
HemisphereLight
(
0xffffff
,
0x444444
);
light
.
position
.
set
(
0
,
2
,
0
);
scene
.
add
(
light
);
light
=
new
THREE
.
DirectionalLight
(
0xffffff
);
light
.
position
.
set
(
0
,
2
,
1
);
light
.
castShadow
=
true
;
light
.
shadow
.
camera
.
top
=
1.8
;
light
.
shadow
.
camera
.
bottom
=
-
1.8
;
light
.
shadow
.
camera
.
left
=
-
1.2
;
light
.
shadow
.
camera
.
right
=
1.2
;
scene
.
add
(
light
);
// ground
var
plane
=
new
THREE
.
Mesh
(
new
THREE
.
PlaneBufferGeometry
(
20
,
20
),
new
THREE
.
MeshPhongMaterial
(
{
color
:
0x999999
,
specular
:
0x101010
}
)
);
plane
.
rotation
.
x
=
-
Math
.
PI
/
2
;
plane
.
position
.
y
=
-
1
;
plane
.
receiveShadow
=
true
;
scene
.
add
(
plane
);
var
grid
=
new
THREE
.
GridHelper
(
20
,
20
,
0x000000
,
0x000000
);
grid
.
position
.
y
=
-
0.99
;
grid
.
material
.
opacity
=
0.2
;
grid
.
material
.
transparent
=
true
;
scene
.
add
(
grid
);
// envmap
var
path
=
'
textures/cube/skybox/
'
;
var
path
=
'
textures/cube/skybox
sun25deg
/
'
;
var
format
=
'
.jpg
'
;
var
envMap
=
new
THREE
.
CubeTextureLoader
().
load
(
[
path
+
'
px
'
+
format
,
path
+
'
nx
'
+
format
,
...
...
@@ -108,6 +74,17 @@
path
+
'
pz
'
+
format
,
path
+
'
nz
'
+
format
]
);
scene
=
new
THREE
.
Scene
();
scene
.
background
=
envMap
;
light
=
new
THREE
.
HemisphereLight
(
0xbbbbff
,
0x444422
);
light
.
position
.
set
(
0
,
1
,
0
);
scene
.
add
(
light
);
light
=
new
THREE
.
DirectionalLight
(
0xffffff
);
light
.
position
.
set
(
-
10
,
6
,
-
10
);
scene
.
add
(
light
);
// model
var
loader
=
new
THREE
.
GLTFLoader
();
loader
.
load
(
'
models/gltf/DamagedHelmet/glTF/DamagedHelmet.gltf
'
,
function
(
gltf
)
{
...
...
@@ -117,8 +94,6 @@
if
(
child
.
isMesh
)
{
child
.
material
.
envMap
=
envMap
;
child
.
material
.
needsUpdate
=
true
;
child
.
castShadow
=
true
;
}
...
...
@@ -132,8 +107,6 @@
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
gammaOutput
=
true
;
renderer
.
shadowMap
.
enabled
=
true
;
renderer
.
shadowMap
.
type
=
THREE
.
PCFSoftShadowMap
;
container
.
appendChild
(
renderer
.
domElement
);
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录