Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
d2e36426
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,发现更多精彩内容 >>
提交
d2e36426
编写于
10月 27, 2015
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Simplified misc_lights_test example.
上级
f366b451
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
15 addition
and
21 deletion
+15
-21
examples/misc_lights_test.html
examples/misc_lights_test.html
+15
-21
未找到文件。
examples/misc_lights_test.html
浏览文件 @
d2e36426
...
...
@@ -43,7 +43,6 @@
var
camera
,
scene
,
canvasRenderer
,
webglRenderer
;
var
mesh
,
zmesh
,
geometry
;
var
materialSpheres
,
materialTorus
;
var
directionalLight
,
pointLight
;
...
...
@@ -52,8 +51,6 @@
var
windowHalfX
=
window
.
innerWidth
/
2
;
var
windowHalfY
=
window
.
innerHeight
/
2
;
var
lightAdded
=
false
;
var
clock
=
new
THREE
.
Clock
();
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
...
...
@@ -74,11 +71,11 @@
// Spheres
var
geometry
=
new
THREE
.
SphereGeometry
(
100
,
16
,
8
);
materialSpheres
=
new
THREE
.
MeshLambertMaterial
(
{
color
:
0xffffff
,
shading
:
THREE
.
FlatShading
,
overdraw
:
0.5
}
);
var
material
=
new
THREE
.
MeshLambertMaterial
(
{
color
:
0xffffff
,
shading
:
THREE
.
FlatShading
,
overdraw
:
0.5
}
);
for
(
var
i
=
0
;
i
<
30
;
i
++
)
{
mesh
=
new
THREE
.
Mesh
(
geometry
,
material
Spheres
);
mesh
=
new
THREE
.
Mesh
(
geometry
,
material
);
mesh
.
position
.
x
=
500
*
(
Math
.
random
()
-
0.5
);
mesh
.
position
.
y
=
500
*
(
Math
.
random
()
-
0.5
);
mesh
.
position
.
z
=
500
*
(
Math
.
random
()
-
0.5
);
...
...
@@ -89,8 +86,9 @@
// Torus
materialTorus
=
new
THREE
.
MeshLambertMaterial
(
{
color
:
0xffffff
,
overdraw
:
0.5
}
);
mesh
=
new
THREE
.
Mesh
(
new
THREE
.
TorusGeometry
(
100
,
25
,
15
,
30
),
materialTorus
);
var
geometry
=
new
THREE
.
TorusGeometry
(
100
,
25
,
15
,
30
);
var
material
=
new
THREE
.
MeshLambertMaterial
(
{
color
:
0xffffff
,
overdraw
:
0.5
}
);
mesh
=
new
THREE
.
Mesh
(
geometry
,
material
);
scene
.
add
(
mesh
);
// Lights
...
...
@@ -100,12 +98,19 @@
directionalLight
=
new
THREE
.
DirectionalLight
(
0xffffff
);
directionalLight
.
position
.
set
(
0
,
-
70
,
100
).
normalize
();
//scene.add( directionalLight );
setTimeout
(
function
()
{
scene
.
add
(
directionalLight
);
},
3000
);
pointLight
=
new
THREE
.
PointLight
(
0xffaa00
);
scene
.
add
(
pointLight
);
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
new
THREE
.
MeshBasicMaterial
(
{
color
:
0xffaa00
}
)
);
var
geometry
=
new
THREE
.
SphereGeometry
(
100
,
8
,
4
);
var
material
=
new
THREE
.
MeshBasicMaterial
(
{
color
:
0xffaa00
}
);
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
material
);
mesh
.
scale
.
set
(
0.05
,
0.05
,
0.05
);
pointLight
.
add
(
mesh
);
...
...
@@ -169,18 +174,6 @@
function
render
()
{
var
delta
=
clock
.
getDelta
();
var
r
=
clock
.
getElapsedTime
();
if
(
!
lightAdded
&&
r
>=
3.0
)
{
scene
.
add
(
directionalLight
);
materialTorus
.
needsUpdate
=
true
;
materialSpheres
.
needsUpdate
=
true
;
lightAdded
=
true
;
}
camera
.
position
.
x
+=
(
mouseX
-
camera
.
position
.
x
)
*
0.05
;
camera
.
position
.
y
+=
(
-
mouseY
-
camera
.
position
.
y
)
*
0.05
;
...
...
@@ -209,6 +202,7 @@
}
var
r
=
clock
.
getElapsedTime
();
pointLight
.
position
.
x
=
200
*
Math
.
cos
(
r
);
pointLight
.
position
.
z
=
200
*
Math
.
sin
(
r
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录