Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
590768ef
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,发现更多精彩内容 >>
提交
590768ef
编写于
7月 12, 2018
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Editor: Fixes examples scale.
上级
9f365ad0
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
241 addition
and
106 deletion
+241
-106
editor/examples/camera.app.json
editor/examples/camera.app.json
+106
-43
editor/examples/particles.app.json
editor/examples/particles.app.json
+53
-17
editor/examples/pong.app.json
editor/examples/pong.app.json
+74
-39
editor/examples/shaders.app.json
editor/examples/shaders.app.json
+8
-7
未找到文件。
editor/examples/camera.app.json
浏览文件 @
590768ef
...
...
@@ -3,65 +3,72 @@
"type"
:
"App"
},
"project"
:
{
"gammaInput"
:
true
,
"gammaOutput"
:
true
,
"shadows"
:
true
,
"vr"
:
false
},
"camera"
:
{
"metadata"
:
{
"version"
:
4.
3
,
"version"
:
4.
5
,
"type"
:
"Object"
,
"generator"
:
"Object
Exporter
"
"generator"
:
"Object
3D.toJSON
"
},
"object"
:
{
"uuid"
:
"
C7FB195B-270E-47B4-95C9-1754652A9D11
"
,
"uuid"
:
"
60EBAF60-53DA-47B0-A028-8FC031B708F6
"
,
"type"
:
"PerspectiveCamera"
,
"name"
:
"Camera"
,
"layers"
:
1
,
"matrix"
:
[
0.970041
,
0
,
-0.242943
,
0
,
-0.048226
,
0.980099
,
-0.192562
,
0
,
0.238108
,
0.198509
,
0.950736
,
0
,
1.548
,
1.29
,
6.18
,
1
],
"fov"
:
50
,
"
aspect"
:
1.2252042007001167
,
"
zoom"
:
1
,
"near"
:
0.1
,
"far"
:
100000
,
"matrix"
:
[
0.9700406789779663
,
-2.851828329042405e-9
,
-0.24294254183769226
,
0
,
-0.04822639003396034
,
0.9800989627838135
,
-0.1925622522830963
,
0
,
0.23810774087905884
,
0.19850945472717285
,
0.950735867023468
,
0
,
154.7735595703125
,
129.03408813476562
,
617.992431640625
,
1
]
"focus"
:
10
,
"aspect"
:
1.428977
,
"filmGauge"
:
35
,
"filmOffset"
:
0
}
},
"scene"
:
{
"metadata"
:
{
"version"
:
4.
3
,
"version"
:
4.
5
,
"type"
:
"Object"
,
"generator"
:
"Object
Exporter
"
"generator"
:
"Object
3D.toJSON
"
},
"geometries"
:
[
{
"uuid"
:
"
51BB3E54-D2DF-4576-9953-FB8E940588B5
"
,
"uuid"
:
"
6D90C4BE-EBA6-4E21-8F54-7CFDAA61F30B
"
,
"type"
:
"PlaneGeometry"
,
"width"
:
10
00
,
"height"
:
10
00
,
"width"
:
10
,
"height"
:
10
,
"widthSegments"
:
1
,
"heightSegments"
:
1
},
{
"uuid"
:
"D
8E200D3-27BC-49F8-A5C5-7384206E70FE
"
,
"uuid"
:
"D
3008B2A-ACDD-43CC-87F7-4F942607D21A
"
,
"type"
:
"BoxGeometry"
,
"width"
:
1
00
,
"height"
:
1
00
,
"depth"
:
1
00
,
"width"
:
1
,
"height"
:
1
,
"depth"
:
1
,
"widthSegments"
:
1
,
"heightSegments"
:
1
,
"depthSegments"
:
1
},
{
"uuid"
:
"
25BA32DB-8B02-4ABA-A77C-69868C464A1A
"
,
"uuid"
:
"
F482ACD4-013A-49CF-AE0F-C9FF4ADAE409
"
,
"type"
:
"CylinderGeometry"
,
"radiusTop"
:
0
,
"radiusBottom"
:
40
,
"height"
:
75
,
"radiusBottom"
:
0.4
,
"height"
:
0.
75
,
"radialSegments"
:
4
,
"heightSegments"
:
1
,
"openEnded"
:
false
},
{
"uuid"
:
"
4DECFAB5-6FD1-4D84-9A29-565807B074EA
"
,
"uuid"
:
"
51CDDCED-BC71-4B1B-A485-725B6A48204B
"
,
"type"
:
"IcosahedronGeometry"
,
"radius"
:
40
,
"radius"
:
0.4
,
"detail"
:
2
}],
"materials"
:
[
...
...
@@ -71,7 +78,10 @@
"color"
:
16777215
,
"emissive"
:
0
,
"specular"
:
1118481
,
"shininess"
:
30
"shininess"
:
30
,
"depthFunc"
:
3
,
"depthTest"
:
true
,
"depthWrite"
:
true
},
{
"uuid"
:
"B5943856-E404-45D9-A427-4774202C2CD0"
,
...
...
@@ -79,7 +89,10 @@
"color"
:
37119
,
"emissive"
:
0
,
"specular"
:
1118481
,
"shininess"
:
30
"shininess"
:
30
,
"depthFunc"
:
3
,
"depthTest"
:
true
,
"depthWrite"
:
true
},
{
"uuid"
:
"3F872310-2067-4BE4-9250-5B3F4E43797E"
,
...
...
@@ -87,7 +100,10 @@
"color"
:
15859456
,
"emissive"
:
0
,
"specular"
:
1118481
,
"shininess"
:
30
"shininess"
:
30
,
"depthFunc"
:
3
,
"depthTest"
:
true
,
"depthWrite"
:
true
},
{
"uuid"
:
"E1826901-7922-4584-A25D-6D487E2C9BBD"
,
...
...
@@ -95,83 +111,130 @@
"color"
:
16711680
,
"emissive"
:
0
,
"specular"
:
1118481
,
"shininess"
:
30
"shininess"
:
30
,
"depthFunc"
:
3
,
"depthTest"
:
true
,
"depthWrite"
:
true
}],
"object"
:
{
"uuid"
:
"3741222A-BD8F-401C-A5D2-5A907E891896"
,
"type"
:
"Scene"
,
"name"
:
"Scene"
,
"layers"
:
1
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
],
"children"
:
[
{
"uuid"
:
"B7CBBC6F-EC26-49B5-8D0D-67D9C535924B"
,
"type"
:
"Group"
,
"name"
:
"Dummy"
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
100
,
400
,
1
],
"layers"
:
1
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
1
,
4
,
1
],
"children"
:
[
{
"uuid"
:
"60B69C58-4201-43FD-815E-AD2EDFBBD0CE"
,
"type"
:
"PerspectiveCamera"
,
"name"
:
"PerspectiveCamera"
,
"layers"
:
1
,
"matrix"
:
[
-1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
-1
,
0
,
0
,
0
,
0
,
1
],
"fov"
:
50
,
"zoom"
:
1
,
"near"
:
0.1
,
"far"
:
100
,
"focus"
:
10
,
"aspect"
:
1
,
"near"
:
100
,
"far"
:
10000
,
"matrix"
:
[
-1
,
0
,
-1.2246468525851679e-16
,
0
,
0
,
1
,
0
,
0
,
1.2246468525851679e-16
,
0
,
-1
,
0
,
0
,
0
,
0
,
1
]
"filmGauge"
:
35
,
"filmOffset"
:
0
}]
},
{
"uuid"
:
"A460C230-DC88-4A8F-A3FB-AA0FE735F3ED"
,
"type"
:
"Mesh"
,
"name"
:
"Plane"
,
"geometry"
:
"51BB3E54-D2DF-4576-9953-FB8E940588B5"
,
"material"
:
"4AE8130E-B6A8-47BC-ACCF-060973C74044"
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
0.040785226970911026
,
-0.9991679191589355
,
0
,
0
,
0.9991679191589355
,
0.040785226970911026
,
0
,
0
,
-50
,
0
,
1
]
"layers"
:
1
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
0.040785
,
-0.999168
,
0
,
0
,
0.999168
,
0.040785
,
0
,
0
,
-0.5
,
0
,
1
],
"geometry"
:
"6D90C4BE-EBA6-4E21-8F54-7CFDAA61F30B"
,
"material"
:
"4AE8130E-B6A8-47BC-ACCF-060973C74044"
},
{
"uuid"
:
"26DAAD69-725D-43B7-AF9D-990A99DEF8C5"
,
"type"
:
"Mesh"
,
"name"
:
"Box"
,
"geometry"
:
"D8E200D3-27BC-49F8-A5C5-7384206E70FE"
,
"material"
:
"B5943856-E404-45D9-A427-4774202C2CD0"
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
]
"layers"
:
1
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
],
"geometry"
:
"D3008B2A-ACDD-43CC-87F7-4F942607D21A"
,
"material"
:
"B5943856-E404-45D9-A427-4774202C2CD0"
},
{
"uuid"
:
"AAAFF2D6-4725-4AFC-A9FE-26419B11011F"
,
"type"
:
"Mesh"
,
"name"
:
"Cylinder"
,
"geometry"
:
"25BA32DB-8B02-4ABA-A77C-69868C464A1A"
,
"material"
:
"3F872310-2067-4BE4-9250-5B3F4E43797E"
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
-130
,
-15
,
0
,
1
]
"layers"
:
1
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
-1.3
,
-0.15
,
0
,
1
],
"geometry"
:
"F482ACD4-013A-49CF-AE0F-C9FF4ADAE409"
,
"material"
:
"3F872310-2067-4BE4-9250-5B3F4E43797E"
},
{
"uuid"
:
"B855E267-A266-4098-ACD6-6A1FDE7B88BA"
,
"type"
:
"Mesh"
,
"name"
:
"Icosahedron"
,
"geometry"
:
"4DECFAB5-6FD1-4D84-9A29-565807B074EA"
,
"material"
:
"E1826901-7922-4584-A25D-6D487E2C9BBD"
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
130
,
-10
,
0
,
1
]
"layers"
:
1
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
1.3
,
-0.1
,
0
,
1
],
"geometry"
:
"51CDDCED-BC71-4B1B-A485-725B6A48204B"
,
"material"
:
"E1826901-7922-4584-A25D-6D487E2C9BBD"
},
{
"uuid"
:
"E2939A7B-5E40-438A-8C1B-32126FBC6892"
,
"type"
:
"PointLight"
,
"name"
:
"PointLight 1"
,
"layers"
:
1
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
-0.939
,
1.271
,
-1.143
,
1
],
"color"
:
9474221
,
"intensity"
:
0.75
,
"distance"
:
0
,
"decay"
:
1
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
-93.86000061035156
,
127.12999725341797
,
-114.30000305175781
,
1
]
"shadow"
:
{
"camera"
:
{
"uuid"
:
"EFF42F46-1E27-4B36-B9D9-CF7D879D258E"
,
"type"
:
"PerspectiveCamera"
,
"layers"
:
1
,
"fov"
:
90
,
"zoom"
:
1
,
"near"
:
0.5
,
"far"
:
500
,
"focus"
:
10
,
"aspect"
:
1
,
"filmGauge"
:
35
,
"filmOffset"
:
0
}
}
},
{
"uuid"
:
"3412781E-27CC-43C3-A5DB-54C0C8E42ED6"
,
"type"
:
"PointLight"
,
"name"
:
"PointLight 2"
,
"layers"
:
1
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0.881
,
0.083
,
1.254
,
1
],
"color"
:
12773063
,
"intensity"
:
1
,
"distance"
:
0
,
"decay"
:
1
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
88.12999725341797
,
8.3100004196167
,
125.44999694824219
,
1
]
}]
"shadow"
:
{
"camera"
:
{
"uuid"
:
"81E800FE-E8A7-4A9E-AFAA-4F04FD56AFE4"
,
"type"
:
"PerspectiveCamera"
,
"layers"
:
1
,
"fov"
:
90
,
"zoom"
:
1
,
"near"
:
0.5
,
"far"
:
500
,
"focus"
:
10
,
"aspect"
:
1
,
"filmGauge"
:
35
,
"filmOffset"
:
0
}
}
}],
"background"
:
11184810
}
},
"scripts"
:
{
...
...
@@ -183,7 +246,7 @@
"B7CBBC6F-EC26-49B5-8D0D-67D9C535924B"
:
[
{
"name"
:
"Orbit"
,
"source"
:
"function update( event ) {
\n\n\t
var time = event.time * 0.001;
\n\n\t
this.position.x = Math.sin( time ) * 4
00;
\n\t
this.position.z = Math.cos( time ) * 400
;
\n\t
this.lookAt( scene.position );
\n\n
}"
"source"
:
"function update( event ) {
\n\n\t
var time = event.time * 0.001;
\n\n\t
this.position.x = Math.sin( time ) * 4
;
\n\t
this.position.z = Math.cos( time ) * 4
;
\n\t
this.lookAt( scene.position );
\n\n
}"
}]
}
}
editor/examples/particles.app.json
浏览文件 @
590768ef
...
...
@@ -3,42 +3,45 @@
"type"
:
"App"
},
"project"
:
{
"gammaInput"
:
true
,
"gammaOutput"
:
true
,
"shadows"
:
true
,
"vr"
:
false
},
"camera"
:
{
"metadata"
:
{
"version"
:
4.
4
,
"version"
:
4.
5
,
"type"
:
"Object"
,
"generator"
:
"Object3D.toJSON"
},
"object"
:
{
"uuid"
:
"
763F3000-7D7C-4BE6-80B6-914DEEBD9AA2
"
,
"uuid"
:
"
056199EB-6985-481B-97CC-A57FB7C87809
"
,
"type"
:
"PerspectiveCamera"
,
"name"
:
"Camera"
,
"matrix"
:
[
0.7071067690849304
,
-3.398992198810902e-11
,
-0.7071068286895752
,
0
,
-0.2357022613286972
,
0.9428090453147888
,
-0.235702246427536
,
0
,
0.6666666865348816
,
0.3333333134651184
,
0.6666666269302368
,
0
,
41.824005126953125
,
20.912002563476562
,
41.824005126953125
,
1
],
"layers"
:
1
,
"matrix"
:
[
0.707107
,
0
,
-0.707107
,
0
,
-0.235702
,
0.942809
,
-0.235702
,
0
,
0.666667
,
0.333333
,
0.666667
,
0
,
4.182
,
2.091
,
4.182
,
1
],
"fov"
:
50
,
"zoom"
:
1
,
"near"
:
0.1
,
"far"
:
100000
,
"focus"
:
10
,
"aspect"
:
0.
46657381615598886
,
"aspect"
:
0.
666193
,
"filmGauge"
:
35
,
"filmOffset"
:
0
}
},
"scene"
:
{
"metadata"
:
{
"version"
:
4.
4
,
"version"
:
4.
5
,
"type"
:
"Object"
,
"generator"
:
"Object3D.toJSON"
},
"geometries"
:
[
{
"uuid"
:
"
E80D9EC5-D722-4812-8226-5F355EAC9B96
"
,
"uuid"
:
"
C3C0CE7D-10B8-43FC-8F74-011CC6E57800
"
,
"type"
:
"PlaneGeometry"
,
"width"
:
100
0
,
"height"
:
100
0
,
"width"
:
100
,
"height"
:
100
,
"widthSegments"
:
1
,
"heightSegments"
:
1
}],
...
...
@@ -49,51 +52,84 @@
"color"
:
5465019
,
"roughness"
:
1
,
"metalness"
:
0
,
"emissive"
:
0
"emissive"
:
0
,
"depthFunc"
:
3
,
"depthTest"
:
true
,
"depthWrite"
:
true
},
{
"uuid"
:
"F5361474-F5F1-412F-8D99-3699B868092D"
,
"type"
:
"SpriteMaterial"
,
"color"
:
16777215
"color"
:
16777215
,
"transparent"
:
true
,
"depthFunc"
:
3
,
"depthTest"
:
true
,
"depthWrite"
:
true
}],
"object"
:
{
"uuid"
:
"3741222A-BD8F-401C-A5D2-5A907E891896"
,
"type"
:
"Scene"
,
"name"
:
"Scene"
,
"layers"
:
1
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
],
"children"
:
[
{
"uuid"
:
"05B57416-1BE5-4A96-BB05-9D9CD112D52B"
,
"type"
:
"Mesh"
,
"name"
:
"Ground"
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
0.0007959486683830619
,
-0.9999997019767761
,
0
,
0
,
0.9999997019767761
,
0.0007959486683830619
,
0
,
0
,
-0.5
,
0
,
1
],
"geometry"
:
"E80D9EC5-D722-4812-8226-5F355EAC9B96"
,
"layers"
:
1
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
0.000796
,
-1
,
0
,
0
,
1
,
0.000796
,
0
,
0
,
-0.5
,
0
,
1
],
"geometry"
:
"C3C0CE7D-10B8-43FC-8F74-011CC6E57800"
,
"material"
:
"3A9449D2-62DB-4BB4-ABBD-6F3F9D46DE1A"
},
{
"uuid"
:
"0A3CB873-07E6-4EEB-830B-68192504111B"
,
"type"
:
"Sprite"
,
"name"
:
"Particle"
,
"matrix"
:
[
0.4000000059604645
,
0
,
0
,
0
,
0
,
0.4000000059604645
,
0
,
0
,
0
,
0
,
0.4000000059604645
,
0
,
0
,
0
,
0
,
1
],
"layers"
:
1
,
"matrix"
:
[
0.04
,
0
,
0
,
0
,
0
,
0.04
,
0
,
0
,
0
,
0
,
0.04
,
0
,
0
,
0
,
0
,
1
],
"material"
:
"F5361474-F5F1-412F-8D99-3699B868092D"
},
{
"uuid"
:
"40E5CDA4-0E39-4265-9293-3E9EC3207F61"
,
"type"
:
"PointLight"
,
"name"
:
"PointLight"
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
11.828879356384277
,
0
,
1
],
"layers"
:
1
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
1.183
,
0
,
1
],
"color"
:
16777215
,
"intensity"
:
1
,
"distance"
:
0
,
"decay"
:
1
}]
"decay"
:
1
,
"shadow"
:
{
"camera"
:
{
"uuid"
:
"B6D3493E-E5C9-4D65-9E26-BB788D127BE1"
,
"type"
:
"PerspectiveCamera"
,
"layers"
:
1
,
"fov"
:
90
,
"zoom"
:
1
,
"near"
:
0.5
,
"far"
:
500
,
"focus"
:
10
,
"aspect"
:
1
,
"filmGauge"
:
35
,
"filmOffset"
:
0
}
}
}],
"background"
:
2171689
,
"fog"
:
{
"type"
:
"Fog"
,
"color"
:
2171688
,
"near"
:
1
,
"far"
:
50
}
}
},
"scripts"
:
{
"3741222A-BD8F-401C-A5D2-5A907E891896"
:
[
{
"name"
:
"Fountain"
,
"source"
:
"var original = this.getObjectByName( 'Particle' );
\n\n
var particles = [];
\n\n
for ( var i = 0; i < 100; i ++ ) {
\n\n\t
var particle = original.clone();
\n\t
particle.userData.velocity = new THREE.Vector3();
\n\t
this.add( particle );
\n\n\t
particles.push( particle );
\n\n
}
\n\n
function update( event ) {
\n\t\n\t
var particle = particles.shift();
\n\t
particles.push( particle );
\n\t\t\n\t
var velocity = particle.userData.velocity;
\n\t
velocity.x = Math.random()
- 0.5;
\n\t
velocity.y = Math.random() + 1;
\n\t
velocity.z = Math.random() - 0.5;
\n\n\t
for ( var i = 0; i < particles.length; i ++ ) {
\n\n\t\t
var particle = particles[ i ];
\n\n\t\t
var velocity = particle.userData.velocity;
\n\n\t\t
velocity.y -= 0.
098;
\n\n\t\t
particle.position.add( velocity );
\n\n\t\t
if ( particle.position.y < 0 ) {
\n\n\t\t\t
particle.position.y = 0;
\n\n\t\t\t
velocity.y = - velocity.y;
\n\t\t\t
velocity.multiplyScalar( 0.6 );
\n\n\t\t
}
\n\n\t
}
\n\n
}"
"source"
:
"var original = this.getObjectByName( 'Particle' );
\n\n
var particles = [];
\n\n
for ( var i = 0; i < 100; i ++ ) {
\n\n\t
var particle = original.clone();
\n\t
particle.userData.velocity = new THREE.Vector3();
\n\t
this.add( particle );
\n\n\t
particles.push( particle );
\n\n
}
\n\n
function update( event ) {
\n\t\n\t
var particle = particles.shift();
\n\t
particles.push( particle );
\n\t\t\n\t
var velocity = particle.userData.velocity;
\n\t
velocity.x = Math.random()
* 0.1 - 0.05;
\n\t
velocity.y = Math.random() * 0.1 + 0.1;
\n\t
velocity.z = Math.random() * 0.1 - 0.05;
\n\n\t
for ( var i = 0; i < particles.length; i ++ ) {
\n\n\t\t
var particle = particles[ i ];
\n\n\t\t
var velocity = particle.userData.velocity;
\n\n\t\t
velocity.y -= 0.0
098;
\n\n\t\t
particle.position.add( velocity );
\n\n\t\t
if ( particle.position.y < 0 ) {
\n\n\t\t\t
particle.position.y = 0;
\n\n\t\t\t
velocity.y = - velocity.y;
\n\t\t\t
velocity.multiplyScalar( 0.6 );
\n\n\t\t
}
\n\n\t
}
\n\n
}"
}]
}
}
editor/examples/pong.app.json
浏览文件 @
590768ef
...
...
@@ -3,69 +3,74 @@
"type"
:
"App"
},
"project"
:
{
"shadows"
:
false
,
"gammaInput"
:
true
,
"gammaOutput"
:
true
,
"shadows"
:
true
,
"vr"
:
false
},
"camera"
:
{
"metadata"
:
{
"version"
:
4.
4
,
"version"
:
4.
5
,
"type"
:
"Object"
,
"generator"
:
"Object3D.toJSON"
},
"object"
:
{
"uuid"
:
"
B901700E-2B1B-4D74-9201-164193F8304E
"
,
"uuid"
:
"
4AC7ADED-CC22-4B16-8218-2E0A0C38C8F8
"
,
"type"
:
"PerspectiveCamera"
,
"name"
:
"Camera"
,
"matrix"
:
[
0.9522120356559753
,
4.608077919243669e-9
,
-0.3054378032684326
,
0
,
-0.17742955684661865
,
0.8139732480049133
,
-0.553142249584198
,
0
,
0.24861818552017212
,
0.5809023976325989
,
0.7750750780105591
,
0
,
18.645999908447266
,
43.56800079345703
,
58.13100051879883
,
1
],
"focalLength"
:
10
,
"zoom"
:
1
,
"layers"
:
1
,
"matrix"
:
[
0.952212
,
0
,
-0.305438
,
0
,
-0.17743
,
0.813973
,
-0.553142
,
0
,
0.248618
,
0.580902
,
0.775075
,
0
,
1.865
,
4.357
,
5.813
,
1
],
"fov"
:
50
,
"
aspect"
:
1.3217270194986073
,
"
zoom"
:
1
,
"near"
:
0.1
,
"far"
:
100000
"far"
:
100000
,
"focus"
:
10
,
"aspect"
:
1.428977
,
"filmGauge"
:
35
,
"filmOffset"
:
0
}
},
"scene"
:
{
"metadata"
:
{
"version"
:
4.
4
,
"version"
:
4.
5
,
"type"
:
"Object"
,
"generator"
:
"Object3D.toJSON"
},
"geometries"
:
[
{
"uuid"
:
"
713F75F5-5D04-4069-89CB-2035F5619AC3
"
,
"uuid"
:
"
490CEBA3-6A25-4BE1-B517-C5FB11A5D18A
"
,
"type"
:
"PlaneGeometry"
,
"width"
:
6
0
,
"height"
:
4
0
,
"width"
:
6
,
"height"
:
4
,
"widthSegments"
:
1
,
"heightSegments"
:
1
},
{
"uuid"
:
"
4537EA66-3CD6-43A1-97A9-EB59F3258BF9
"
,
"uuid"
:
"
D9A92F2D-2F08-4851-99C7-12D8D1CA13C7
"
,
"type"
:
"BoxGeometry"
,
"width"
:
1
,
"height"
:
1
,
"depth"
:
1
,
"width"
:
0.
1
,
"height"
:
0.
1
,
"depth"
:
0.
1
,
"widthSegments"
:
1
,
"heightSegments"
:
1
,
"depthSegments"
:
1
},
{
"uuid"
:
"
3C546CA4-FF0F-4BA1-9406-0CD0D560A396
"
,
"uuid"
:
"
5E63B8CF-E225-4ABC-994A-4D06BD4E21EB
"
,
"type"
:
"BoxGeometry"
,
"width"
:
2
,
"height"
:
2
,
"depth"
:
1
0
,
"width"
:
0.
2
,
"height"
:
0.
2
,
"depth"
:
1
,
"widthSegments"
:
1
,
"heightSegments"
:
1
,
"depthSegments"
:
1
},
{
"uuid"
:
"
4628F4A7-D572-45C2-9A67-807D71FF19EC
"
,
"uuid"
:
"
D61532B4-24C3-4BC4-B56B-7245E8163E09
"
,
"type"
:
"BoxGeometry"
,
"width"
:
2
,
"height"
:
2
,
"depth"
:
1
0
,
"width"
:
0.
2
,
"height"
:
0.
2
,
"depth"
:
1
,
"widthSegments"
:
1
,
"heightSegments"
:
1
,
"depthSegments"
:
1
...
...
@@ -77,7 +82,10 @@
"color"
:
16777215
,
"emissive"
:
0
,
"specular"
:
16777215
,
"shininess"
:
30
"shininess"
:
30
,
"depthFunc"
:
3
,
"depthTest"
:
true
,
"depthWrite"
:
true
},
{
"uuid"
:
"B1CAF098-FE36-45E1-BEBE-8D6AC04821CC"
,
...
...
@@ -85,7 +93,10 @@
"color"
:
16711680
,
"emissive"
:
0
,
"specular"
:
1118481
,
"shininess"
:
30
"shininess"
:
30
,
"depthFunc"
:
3
,
"depthTest"
:
true
,
"depthWrite"
:
true
},
{
"uuid"
:
"FBDBE66D-B613-4741-802D-5AE1DE07DE46"
,
...
...
@@ -93,61 +104,85 @@
"color"
:
2752767
,
"emissive"
:
0
,
"specular"
:
1118481
,
"shininess"
:
30
"shininess"
:
30
,
"depthFunc"
:
3
,
"depthTest"
:
true
,
"depthWrite"
:
true
}],
"object"
:
{
"uuid"
:
"31517222-A9A7-4EAF-B5F6-60751C0BABA3"
,
"type"
:
"Scene"
,
"name"
:
"Scene"
,
"layers"
:
1
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
],
"children"
:
[
{
"uuid"
:
"B47D0BFC-D63A-4CBB-985E-9C4DBDF086E4"
,
"type"
:
"Mesh"
,
"name"
:
"Ground"
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
0.0007960238144733012
,
-0.9999997019767761
,
0
,
0
,
0.9999997019767761
,
0.0007960238144733012
,
0
,
0
,
-1
,
0
,
1
],
"geometry"
:
"713F75F5-5D04-4069-89CB-2035F5619AC3"
,
"layers"
:
1
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
0.000796
,
-1
,
0
,
0
,
1
,
0.000796
,
0
,
0
,
-0.1
,
0
,
1
],
"geometry"
:
"490CEBA3-6A25-4BE1-B517-C5FB11A5D18A"
,
"material"
:
"7EDF7C08-6325-418A-BBAB-89341C694730"
},
{
"uuid"
:
"CE13E58A-4E8B-4F72-9E2E-7DE57C58F989"
,
"type"
:
"Mesh"
,
"name"
:
"Ball"
,
"layers"
:
1
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
],
"geometry"
:
"
4537EA66-3CD6-43A1-97A9-EB59F3258BF9
"
,
"geometry"
:
"
D9A92F2D-2F08-4851-99C7-12D8D1CA13C7
"
,
"material"
:
"B1CAF098-FE36-45E1-BEBE-8D6AC04821CC"
},
{
"uuid"
:
"2AAEA3AA-EC45-492B-B450-10473D1EC6C5"
,
"type"
:
"Mesh"
,
"name"
:
"Pad 1"
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
-24
,
0
,
0
,
1
],
"geometry"
:
"3C546CA4-FF0F-4BA1-9406-0CD0D560A396"
,
"layers"
:
1
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
-2.4
,
0
,
0
,
1
],
"geometry"
:
"5E63B8CF-E225-4ABC-994A-4D06BD4E21EB"
,
"material"
:
"FBDBE66D-B613-4741-802D-5AE1DE07DE46"
},
{
"uuid"
:
"F1DD46A7-6584-4A37-BC76-852C3911077E"
,
"type"
:
"Mesh"
,
"name"
:
"Pad 2"
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
24
,
0
,
0
,
1
],
"geometry"
:
"4628F4A7-D572-45C2-9A67-807D71FF19EC"
,
"layers"
:
1
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
2.4
,
0
,
0
,
1
],
"geometry"
:
"D61532B4-24C3-4BC4-B56B-7245E8163E09"
,
"material"
:
"FBDBE66D-B613-4741-802D-5AE1DE07DE46"
},
{
"uuid"
:
"C62AAE9F-9E51-46A5-BD2B-71BA804FC0B3"
,
"type"
:
"DirectionalLight"
,
"name"
:
"DirectionalLight 3"
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
10
,
20
,
15
,
1
],
"name"
:
"DirectionalLight"
,
"layers"
:
1
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
1
,
2
,
1.5
,
1
],
"color"
:
16777215
,
"intensity"
:
1
}]
"intensity"
:
1
,
"shadow"
:
{
"camera"
:
{
"uuid"
:
"2CF1F42A-8992-4E8D-8D94-7CC20979344C"
,
"type"
:
"OrthographicCamera"
,
"layers"
:
1
,
"zoom"
:
1
,
"left"
:
-5
,
"right"
:
5
,
"top"
:
5
,
"bottom"
:
-5
,
"near"
:
0.5
,
"far"
:
500
}
}
}],
"background"
:
11184810
}
},
"scripts"
:
{
"31517222-A9A7-4EAF-B5F6-60751C0BABA3"
:
[
{
"name"
:
"Game logic"
,
"source"
:
"var ball = this.getObjectByName( 'Ball' );
\n\n
var position = ball.position;
\n\n
var velocity = new THREE.Vector3();
\n\n
var direction = new THREE.Vector3();
\n
direction.x = Math.random() - 0.5;
\n
direction.z = Math.random() - 0.5;
\n
direction.normalize()
;
\n\n
var pad1 = this.getObjectByName( 'Pad 1' );
\n
var pad2 = this.getObjectByName( 'Pad 2' );
\n\n
var raycaster = new THREE.Raycaster();
\n
var objects = [ pad1, pad2 ];
\n\n
//
\n\n
function mousemove( event ) {
\n\n\t
pad1.position.z = ( event.clientX / player.width ) * 30 - 15;
\n\t
pad2.position.z = - pad1.position.z;
\n\n
}
\n\n
function update( event ) {
\n\t\n\t
if ( position.x < -30 || position.x > 30 ) direction.x = - direction.x;
\n\t
if ( position.z < -20 || position.z > 20 ) direction.z = - direction.z;
\n\t\n\t
position.x = Math.max( - 30, Math.min( 30, position.x ) );
\n\t
position.z = Math.max( - 20, Math.min( 20, position.z ) );
\n\t\n\t
raycaster.set( position, direction );
\n\t\n\t
var intersections = raycaster.intersectObjects( objects );
\n\t\n\t
if ( intersections.length > 0 ) {
\n\n\t\t
var intersection = intersections[ 0 ];
\n\t\t\n\t\t
if ( intersection.distance <
1 ) {
\n\t\t\t\n\t\t\t
direction.reflect( intersection.face.normal );
\n\t\t\t\n\t\t
}
\n\t\t\n\t
}
\n\n\t
position.add( velocity.copy( direction ).multiplyScalar( event.delta / 20 ) );
\n\n
}"
"source"
:
"var ball = this.getObjectByName( 'Ball' );
\n\n
var position = ball.position;
\n\n
var velocity = new THREE.Vector3();
\n\n
var direction = new THREE.Vector3();
\n
direction.x = Math.random() - 0.5;
\n
direction.z = Math.random() - 0.5;
\n
direction.normalize()
.multiplyScalar( 0.1 );
\n\n
var pad1 = this.getObjectByName( 'Pad 1' );
\n
var pad2 = this.getObjectByName( 'Pad 2' );
\n\n
var raycaster = new THREE.Raycaster();
\n
var objects = [ pad1, pad2 ];
\n\n
//
\n\n
function mousemove( event ) {
\n\n\t
pad1.position.z = ( event.clientX / player.width ) * 3 - 1.5;
\n\t
pad2.position.z = - pad1.position.z;
\n\n
}
\n\n
function update( event ) {
\n\t\n\t
if ( position.x < -3 || position.x > 3 ) direction.x = - direction.x;
\n\t
if ( position.z < -2 || position.z > 2 ) direction.z = - direction.z;
\n\t\n\t
position.x = Math.max( - 3, Math.min( 3, position.x ) );
\n\t
position.z = Math.max( - 2, Math.min( 2, position.z ) );
\n\t\n\t
raycaster.set( position, direction );
\n\t\n\t
var intersections = raycaster.intersectObjects( objects );
\n\t\n\t
if ( intersections.length > 0 ) {
\n\n\t\t
var intersection = intersections[ 0 ];
\n\t\t\n\t\t
if ( intersection.distance < 0.
1 ) {
\n\t\t\t\n\t\t\t
direction.reflect( intersection.face.normal );
\n\t\t\t\n\t\t
}
\n\t\t\n\t
}
\n\n\t
position.add( velocity.copy( direction ).multiplyScalar( event.delta / 20 ) );
\n\n
}"
}]
}
}
editor/examples/shaders.app.json
浏览文件 @
590768ef
...
...
@@ -10,28 +10,29 @@
},
"camera"
:
{
"metadata"
:
{
"version"
:
4.
4
,
"version"
:
4.
5
,
"type"
:
"Object"
,
"generator"
:
"Object3D.toJSON"
},
"object"
:
{
"uuid"
:
"
FC3E973B-5A4A-4177-BD9C-A58E61E0593B
"
,
"uuid"
:
"
4AC7ADED-CC22-4B16-8218-2E0A0C38C8F8
"
,
"type"
:
"PerspectiveCamera"
,
"name"
:
"Camera"
,
"layers"
:
1
,
"matrix"
:
[
0.605503
,
0
,
-0.795843
,
0
,
-0.261526
,
0.944464
,
-0.198978
,
0
,
0.751645
,
0.328615
,
0.571876
,
0
,
2.571484
,
1.124239
,
1.956469
,
1
],
"fov"
:
50
,
"zoom"
:
1
,
"near"
:
0.1
,
"far"
:
10000
,
"focus"
:
10
,
"aspect"
:
1.
368715
,
"aspect"
:
1.
428977
,
"filmGauge"
:
35
,
"filmOffset"
:
0
}
},
"scene"
:
{
"metadata"
:
{
"version"
:
4.
4
,
"version"
:
4.
5
,
"type"
:
"Object"
,
"generator"
:
"Object3D.toJSON"
},
...
...
@@ -50,11 +51,9 @@
"depthTest"
:
true
,
"depthWrite"
:
true
,
"wireframe"
:
true
,
"skinning"
:
false
,
"morphTargets"
:
false
,
"uniforms"
:
{
"time"
:
{
"value"
:
0
.0
"value"
:
0
}
},
"vertexShader"
:
"uniform float time;
\n
varying vec3 vPosition;
\n
void main() {
\n\t
vPosition = position;
\n\t
vPosition.x += sin( time + vPosition.z * 4.0 ) / 4.0;
\n\t
vPosition.y += cos( time + vPosition.z * 4.0 ) / 4.0;
\n\t
gl_Position = projectionMatrix * modelViewMatrix * vec4( vPosition, 1.0 );
\n
}"
,
...
...
@@ -64,12 +63,14 @@
"uuid"
:
"5FC9ACA9-2A93-474D-AA32-FACC76551914"
,
"type"
:
"Scene"
,
"name"
:
"Scene"
,
"layers"
:
1
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
],
"children"
:
[
{
"uuid"
:
"FC7B6CF2-6386-4F47-9CE6-8ADB9FCA6E1F"
,
"type"
:
"Mesh"
,
"name"
:
"Icosahedron 1"
,
"layers"
:
1
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
],
"geometry"
:
"EA781333-F3AE-470D-9110-A9724FCB42AA"
,
"material"
:
"50ED51F1-DEA4-4B61-8082-BF41609E8C27"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录