Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
4f5aff0d
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,发现更多精彩内容 >>
提交
4f5aff0d
编写于
6月 16, 2018
作者:
M
Mugen87
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Examples: Clean up
上级
eb5c3439
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
42 addition
and
42 deletion
+42
-42
examples/js/RollerCoaster.js
examples/js/RollerCoaster.js
+42
-42
未找到文件。
examples/js/RollerCoaster.js
浏览文件 @
4f5aff0d
...
...
@@ -19,7 +19,7 @@ function RollerCoasterGeometry( curve, divisions ) {
var
quaternion
=
new
THREE
.
Quaternion
();
var
prevQuaternion
=
new
THREE
.
Quaternion
();
prevQuaternion
.
setFromAxisAngle
(
up
,
Math
.
PI
/
2
);
prevQuaternion
.
setFromAxisAngle
(
up
,
Math
.
PI
/
2
);
var
point
=
new
THREE
.
Vector3
();
var
prevPoint
=
new
THREE
.
Vector3
();
...
...
@@ -28,13 +28,13 @@ function RollerCoasterGeometry( curve, divisions ) {
// shapes
var
step
=
[
new
THREE
.
Vector3
(
-
0.225
,
0
,
0
),
new
THREE
.
Vector3
(
0
,
-
0.050
,
0
),
new
THREE
.
Vector3
(
0
,
-
0.175
,
0
),
new
THREE
.
Vector3
(
-
0.225
,
0
,
0
),
new
THREE
.
Vector3
(
0
,
-
0.050
,
0
),
new
THREE
.
Vector3
(
0
,
-
0.175
,
0
),
new
THREE
.
Vector3
(
0
,
-
0.050
,
0
),
new
THREE
.
Vector3
(
0.225
,
0
,
0
),
new
THREE
.
Vector3
(
0
,
-
0.175
,
0
)
new
THREE
.
Vector3
(
0
,
-
0.050
,
0
),
new
THREE
.
Vector3
(
0.225
,
0
,
0
),
new
THREE
.
Vector3
(
0
,
-
0.175
,
0
)
];
var
PI2
=
Math
.
PI
*
2
;
...
...
@@ -64,7 +64,7 @@ function RollerCoasterGeometry( curve, divisions ) {
function
drawShape
(
shape
,
color
)
{
normal
.
set
(
0
,
0
,
-
1
).
applyQuaternion
(
quaternion
);
normal
.
set
(
0
,
0
,
-
1
).
applyQuaternion
(
quaternion
);
for
(
var
j
=
0
;
j
<
shape
.
length
;
j
++
)
{
...
...
@@ -92,7 +92,7 @@ function RollerCoasterGeometry( curve, divisions ) {
}
}
;
}
var
vector1
=
new
THREE
.
Vector3
();
var
vector2
=
new
THREE
.
Vector3
();
...
...
@@ -171,7 +171,7 @@ function RollerCoasterGeometry( curve, divisions ) {
}
}
;
}
var
offset
=
new
THREE
.
Vector3
();
...
...
@@ -195,9 +195,9 @@ function RollerCoasterGeometry( curve, divisions ) {
}
extrudeShape
(
tube1
,
offset
.
set
(
0
,
-
0.125
,
0
),
color2
);
extrudeShape
(
tube2
,
offset
.
set
(
0.2
,
0
,
0
),
color1
);
extrudeShape
(
tube2
,
offset
.
set
(
-
0.2
,
0
,
0
),
color1
);
extrudeShape
(
tube1
,
offset
.
set
(
0
,
-
0.125
,
0
),
color2
);
extrudeShape
(
tube2
,
offset
.
set
(
0.2
,
0
,
0
),
color1
);
extrudeShape
(
tube2
,
offset
.
set
(
-
0.2
,
0
,
0
),
color1
);
prevPoint
.
copy
(
point
);
prevQuaternion
.
copy
(
quaternion
);
...
...
@@ -210,7 +210,7 @@ function RollerCoasterGeometry( curve, divisions ) {
this
.
addAttribute
(
'
normal
'
,
new
THREE
.
BufferAttribute
(
new
Float32Array
(
normals
),
3
)
);
this
.
addAttribute
(
'
color
'
,
new
THREE
.
BufferAttribute
(
new
Float32Array
(
colors
),
3
)
);
}
;
}
RollerCoasterGeometry
.
prototype
=
Object
.
create
(
THREE
.
BufferGeometry
.
prototype
);
...
...
@@ -231,21 +231,21 @@ function RollerCoasterLiftersGeometry( curve, divisions ) {
// shapes
var
tube1
=
[
new
THREE
.
Vector3
(
0
,
0.05
,
-
0.05
),
new
THREE
.
Vector3
(
0
,
0.05
,
0.05
),
new
THREE
.
Vector3
(
0
,
-
0.05
,
0
)
new
THREE
.
Vector3
(
0
,
0.05
,
-
0.05
),
new
THREE
.
Vector3
(
0
,
0.05
,
0.05
),
new
THREE
.
Vector3
(
0
,
-
0.05
,
0
)
];
var
tube2
=
[
new
THREE
.
Vector3
(
-
0.05
,
0
,
0.05
),
new
THREE
.
Vector3
(
-
0.05
,
0
,
-
0.05
),
new
THREE
.
Vector3
(
0.05
,
0
,
0
)
new
THREE
.
Vector3
(
-
0.05
,
0
,
0.05
),
new
THREE
.
Vector3
(
-
0.05
,
0
,
-
0.05
),
new
THREE
.
Vector3
(
0.05
,
0
,
0
)
];
var
tube3
=
[
new
THREE
.
Vector3
(
0.05
,
0
,
-
0.05
),
new
THREE
.
Vector3
(
0.05
,
0
,
0.05
),
new
THREE
.
Vector3
(
-
0.05
,
0
,
0
)
new
THREE
.
Vector3
(
0.05
,
0
,
-
0.05
),
new
THREE
.
Vector3
(
0.05
,
0
,
0.05
),
new
THREE
.
Vector3
(
-
0.05
,
0
,
0
)
];
var
vector1
=
new
THREE
.
Vector3
();
...
...
@@ -317,7 +317,7 @@ function RollerCoasterLiftersGeometry( curve, divisions ) {
}
}
;
}
var
fromPoint
=
new
THREE
.
Vector3
();
var
toPoint
=
new
THREE
.
Vector3
();
...
...
@@ -335,31 +335,31 @@ function RollerCoasterLiftersGeometry( curve, divisions ) {
if
(
point
.
y
>
10
)
{
fromPoint
.
set
(
-
0.75
,
-
0.35
,
0
);
fromPoint
.
set
(
-
0.75
,
-
0.35
,
0
);
fromPoint
.
applyQuaternion
(
quaternion
);
fromPoint
.
add
(
point
);
toPoint
.
set
(
0.75
,
-
0.35
,
0
);
toPoint
.
set
(
0.75
,
-
0.35
,
0
);
toPoint
.
applyQuaternion
(
quaternion
);
toPoint
.
add
(
point
);
extrudeShape
(
tube1
,
fromPoint
,
toPoint
);
fromPoint
.
set
(
-
0.7
,
-
0.3
,
0
);
fromPoint
.
set
(
-
0.7
,
-
0.3
,
0
);
fromPoint
.
applyQuaternion
(
quaternion
);
fromPoint
.
add
(
point
);
toPoint
.
set
(
-
0.7
,
-
point
.
y
,
0
);
toPoint
.
set
(
-
0.7
,
-
point
.
y
,
0
);
toPoint
.
applyQuaternion
(
quaternion
);
toPoint
.
add
(
point
);
extrudeShape
(
tube2
,
fromPoint
,
toPoint
);
fromPoint
.
set
(
0.7
,
-
0.3
,
0
);
fromPoint
.
set
(
0.7
,
-
0.3
,
0
);
fromPoint
.
applyQuaternion
(
quaternion
);
fromPoint
.
add
(
point
);
toPoint
.
set
(
0.7
,
-
point
.
y
,
0
);
toPoint
.
set
(
0.7
,
-
point
.
y
,
0
);
toPoint
.
applyQuaternion
(
quaternion
);
toPoint
.
add
(
point
);
...
...
@@ -367,11 +367,11 @@ function RollerCoasterLiftersGeometry( curve, divisions ) {
}
else
{
fromPoint
.
set
(
0
,
-
0.2
,
0
);
fromPoint
.
set
(
0
,
-
0.2
,
0
);
fromPoint
.
applyQuaternion
(
quaternion
);
fromPoint
.
add
(
point
);
toPoint
.
set
(
0
,
-
point
.
y
,
0
);
toPoint
.
set
(
0
,
-
point
.
y
,
0
);
toPoint
.
applyQuaternion
(
quaternion
);
toPoint
.
add
(
point
);
...
...
@@ -384,7 +384,7 @@ function RollerCoasterLiftersGeometry( curve, divisions ) {
this
.
addAttribute
(
'
position
'
,
new
THREE
.
BufferAttribute
(
new
Float32Array
(
vertices
),
3
)
);
this
.
addAttribute
(
'
normal
'
,
new
THREE
.
BufferAttribute
(
new
Float32Array
(
normals
),
3
)
);
}
;
}
RollerCoasterLiftersGeometry
.
prototype
=
Object
.
create
(
THREE
.
BufferGeometry
.
prototype
);
...
...
@@ -399,7 +399,7 @@ function RollerCoasterShadowGeometry( curve, divisions ) {
var
quaternion
=
new
THREE
.
Quaternion
();
var
prevQuaternion
=
new
THREE
.
Quaternion
();
prevQuaternion
.
setFromAxisAngle
(
up
,
Math
.
PI
/
2
);
prevQuaternion
.
setFromAxisAngle
(
up
,
Math
.
PI
/
2
);
var
point
=
new
THREE
.
Vector3
();
...
...
@@ -423,19 +423,19 @@ function RollerCoasterShadowGeometry( curve, divisions ) {
quaternion
.
setFromAxisAngle
(
up
,
angle
);
vector1
.
set
(
-
0.3
,
0
,
0
);
vector1
.
set
(
-
0.3
,
0
,
0
);
vector1
.
applyQuaternion
(
quaternion
);
vector1
.
add
(
point
);
vector2
.
set
(
0.3
,
0
,
0
);
vector2
.
set
(
0.3
,
0
,
0
);
vector2
.
applyQuaternion
(
quaternion
);
vector2
.
add
(
point
);
vector3
.
set
(
0.3
,
0
,
0
);
vector3
.
set
(
0.3
,
0
,
0
);
vector3
.
applyQuaternion
(
prevQuaternion
);
vector3
.
add
(
prevPoint
);
vector4
.
set
(
-
0.3
,
0
,
0
);
vector4
.
set
(
-
0.3
,
0
,
0
);
vector4
.
applyQuaternion
(
prevQuaternion
);
vector4
.
add
(
prevPoint
);
...
...
@@ -454,7 +454,7 @@ function RollerCoasterShadowGeometry( curve, divisions ) {
this
.
addAttribute
(
'
position
'
,
new
THREE
.
BufferAttribute
(
new
Float32Array
(
vertices
),
3
)
);
}
;
}
RollerCoasterShadowGeometry
.
prototype
=
Object
.
create
(
THREE
.
BufferGeometry
.
prototype
);
...
...
@@ -485,7 +485,7 @@ function SkyGeometry() {
this
.
addAttribute
(
'
position
'
,
new
THREE
.
BufferAttribute
(
new
Float32Array
(
vertices
),
3
)
);
}
;
}
SkyGeometry
.
prototype
=
Object
.
create
(
THREE
.
BufferGeometry
.
prototype
);
...
...
@@ -497,7 +497,7 @@ function TreesGeometry( landscape ) {
var
colors
=
[];
var
raycaster
=
new
THREE
.
Raycaster
();
raycaster
.
ray
.
direction
.
set
(
0
,
-
1
,
0
);
raycaster
.
ray
.
direction
.
set
(
0
,
-
1
,
0
);
for
(
var
i
=
0
;
i
<
2000
;
i
++
)
{
...
...
@@ -539,6 +539,6 @@ function TreesGeometry( landscape ) {
this
.
addAttribute
(
'
position
'
,
new
THREE
.
BufferAttribute
(
new
Float32Array
(
vertices
),
3
)
);
this
.
addAttribute
(
'
color
'
,
new
THREE
.
BufferAttribute
(
new
Float32Array
(
colors
),
3
)
);
}
;
}
TreesGeometry
.
prototype
=
Object
.
create
(
THREE
.
BufferGeometry
.
prototype
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录