Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
a5dc13b1
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,发现更多精彩内容 >>
提交
a5dc13b1
编写于
7月 31, 2018
作者:
S
sunag
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update code style all sea3d examples
上级
67e1da95
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
103 addition
and
102 deletion
+103
-102
examples/webgl_loader_sea3d_bvh_retarget.html
examples/webgl_loader_sea3d_bvh_retarget.html
+2
-3
examples/webgl_loader_sea3d_hierarchy.html
examples/webgl_loader_sea3d_hierarchy.html
+10
-10
examples/webgl_loader_sea3d_keyframe.html
examples/webgl_loader_sea3d_keyframe.html
+38
-36
examples/webgl_loader_sea3d_morph.html
examples/webgl_loader_sea3d_morph.html
+11
-11
examples/webgl_loader_sea3d_skinning.html
examples/webgl_loader_sea3d_skinning.html
+29
-29
examples/webgl_loader_sea3d_sound.html
examples/webgl_loader_sea3d_sound.html
+13
-13
未找到文件。
examples/webgl_loader_sea3d_bvh_retarget.html
浏览文件 @
a5dc13b1
...
...
@@ -157,12 +157,11 @@
scene
.
add
(
bvhSkeletonHelper
);
scene
.
add
(
boneContainer
);
// play animation
bvhMixer
=
new
THREE
.
AnimationMixer
(
bvhSkeletonHelper
);
// get offsets when it is in T-Pose
options
.
offsets
=
THREE
.
SkeletonUtils
.
getSkeletonOffsets
(
player
,
bvhSkeletonHelper
,
options
);
// play animation
bvhMixer
=
new
THREE
.
AnimationMixer
(
bvhSkeletonHelper
);
bvhMixer
.
clipAction
(
result
.
clip
).
setEffectiveWeight
(
1.0
).
play
();
}
);
...
...
examples/webgl_loader_sea3d_hierarchy.html
浏览文件 @
a5dc13b1
...
...
@@ -59,11 +59,11 @@
if
(
!
Detector
.
webgl
)
Detector
.
addGetWebGLMessage
();
console
.
log
(
"
Visit https://github.com/sunag/sea3d to all codes and builds under development.
"
);
console
.
log
(
"
Visit https://github.com/sunag/sea3d to all codes and builds under development.
"
);
var
container
,
stats
;
var
camera
,
scene
,
renderer
,
composer
,
controls
;
var
camera
,
scene
,
renderer
,
composer
;
var
loader
;
...
...
@@ -77,30 +77,30 @@
loader
=
new
THREE
.
SEA3D
(
{
autoPlay
:
false
,
// Auto play animations
container
:
scene
// Container to add models
autoPlay
:
false
,
// Auto play animations
container
:
scene
// Container to add models
}
);
loader
.
onComplete
=
function
(
e
)
{
loader
.
onComplete
=
function
(
e
)
{
// play all animations
for
(
var
i
=
0
;
i
<
loader
.
meshes
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
loader
.
meshes
.
length
;
i
++
)
{
if
(
loader
.
meshes
[
i
].
animator
)
loader
.
meshes
[
i
].
animator
.
play
(
"
root
"
);
if
(
loader
.
meshes
[
i
].
animator
)
loader
.
meshes
[
i
].
animator
.
play
(
"
root
"
);
}
// Get the first camera from SEA3D Studio
// use loader.get... to get others objects
var
cam
=
loader
.
cameras
[
0
];
var
cam
=
loader
.
cameras
[
0
];
camera
.
position
.
copy
(
cam
.
position
);
camera
.
rotation
.
copy
(
cam
.
rotation
);
controls
=
new
THREE
.
OrbitControls
(
camera
);
new
THREE
.
OrbitControls
(
camera
);
animate
();
...
...
examples/webgl_loader_sea3d_keyframe.html
浏览文件 @
a5dc13b1
...
...
@@ -56,11 +56,11 @@
if
(
!
Detector
.
webgl
)
Detector
.
addGetWebGLMessage
();
console
.
log
(
"
Visit https://github.com/sunag/sea3d to all codes and builds under development.
"
);
console
.
log
(
"
Visit https://github.com/sunag/sea3d to all codes and builds under development.
"
);
var
container
,
stats
;
var
camera
,
scene
,
renderer
,
composer
,
controls
,
demoAt
=
-
1
;
var
camera
,
scene
,
renderer
,
composer
,
demoAt
=
-
1
;
var
loader
;
...
...
@@ -74,25 +74,25 @@
loader
=
new
THREE
.
SEA3D
(
{
autoPlay
:
false
,
// Manual play animations
container
:
scene
// Container to add models
autoPlay
:
false
,
// Manual play animations
container
:
scene
// Container to add models
}
);
loader
.
onComplete
=
function
(
e
)
{
loader
.
onComplete
=
function
(
e
)
{
// Get the first camera from 3ds Max
// use loader.get... to get others objects
var
cam
=
loader
.
cameras
[
0
];
var
cam
=
loader
.
cameras
[
0
];
camera
.
position
.
copy
(
cam
.
position
);
camera
.
rotation
.
copy
(
cam
.
rotation
);
controls
=
new
THREE
.
OrbitControls
(
camera
);
new
THREE
.
OrbitControls
(
camera
);
// events
window
.
addEventListener
(
'
click
'
,
onMouseClick
,
false
);
window
.
addEventListener
(
'
click
'
,
onMouseClick
,
false
);
animate
();
...
...
@@ -104,14 +104,14 @@
// Animation Functions
//
function
playAll
(
id
,
crossfade
,
offset
)
{
function
playAll
(
id
,
crossfade
,
offset
)
{
// play all animations
for
(
var
i
=
0
;
i
<
loader
.
meshes
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
loader
.
meshes
.
length
;
i
++
)
{
if
(
loader
.
meshes
[
i
].
animator
)
loader
.
meshes
[
i
].
animator
.
play
(
id
,
crossfade
,
offset
);
if
(
loader
.
meshes
[
i
].
animator
)
loader
.
meshes
[
i
].
animator
.
play
(
id
,
crossfade
,
offset
);
}
...
...
@@ -119,10 +119,10 @@
function
setTimeScale
(
timeScale
)
{
for
(
var
i
=
0
;
i
<
loader
.
meshes
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
loader
.
meshes
.
length
;
i
++
)
{
if
(
loader
.
meshes
[
i
].
animator
)
loader
.
meshes
[
i
].
animator
.
setTimeScale
(
timeScale
);
if
(
loader
.
meshes
[
i
].
animator
)
loader
.
meshes
[
i
].
animator
.
setTimeScale
(
timeScale
);
}
...
...
@@ -130,10 +130,10 @@
function
stopAll
()
{
for
(
var
i
=
0
;
i
<
loader
.
meshes
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
loader
.
meshes
.
length
;
i
++
)
{
if
(
loader
.
meshes
[
i
].
animator
)
loader
.
meshes
[
i
].
animator
.
stop
();
if
(
loader
.
meshes
[
i
].
animator
)
loader
.
meshes
[
i
].
animator
.
stop
();
}
...
...
@@ -201,9 +201,9 @@
//
function
description
(
msg
)
{
function
description
(
msg
)
{
document
.
getElementById
(
'
description
'
).
innerHTML
=
(
demoAt
+
1
)
+
"
-
"
+
msg
;
document
.
getElementById
(
'
description
'
).
innerHTML
=
(
demoAt
+
1
)
+
"
-
"
+
msg
;
}
...
...
@@ -211,62 +211,64 @@
// 0 at 3 demos
switch
(
demoAt
=
++
demoAt
%
4
)
{
switch
(
demoAt
=
++
demoAt
%
4
)
{
// play all animation to sequence "crash#1"
// play all animation to sequence "crash#1"
case
0
:
playAll
(
"
crash#1
"
,
.
5
);
setTimeScale
(
1
);
playAll
(
"
crash#1
"
,
.
5
);
setTimeScale
(
1
);
description
(
"
crash#1 - crossfade 0.5 seconds
"
);
description
(
"
crash#1 - crossfade 0.5 seconds
"
);
break
;
// play all animation to sequence "crash#2"
// play all animation to sequence "crash#2"
case
1
:
playAll
(
"
crash#2
"
,
.
5
);
playAll
(
"
crash#2
"
,
.
5
);
description
(
"
crash#2 - crossfade 0.5 seconds
"
);
description
(
"
crash#2 - crossfade 0.5 seconds
"
);
break
;
// play animation in single object
// play animation in single object
case
2
:
stopAll
();
var
fracture99
=
loader
.
getMesh
(
"
Object099
"
);
var
fracture99
=
loader
.
getMesh
(
"
Object099
"
);
//fracture99.animator.setTimeScale( 1 );
//fracture99.animator.playing
//fracture99.animator.currentAnimation
//fracture99.animator.previousAnimation
fracture99
.
animator
.
play
(
"
crash#2
"
,
.
5
,
0
);
fracture99
.
animator
.
play
(
"
crash#2
"
,
.
5
,
0
);
//fracture99.animator.stop();
//fracture99.animator.pause();
//fracture99.animator.resume();
description
(
"
crash#2 in single object - crossfade 0.5 seconds
"
);
description
(
"
crash#2 in single object - crossfade 0.5 seconds
"
);
break
;
// set time scale
// set time scale
case
3
:
playAll
(
"
crash#2
"
,
.
5
);
setTimeScale
(
.
1
);
playAll
(
"
crash#2
"
,
.
5
);
setTimeScale
(
.
1
);
description
(
"
time scale / 10 - crossfade 0.5 seconds
"
);
description
(
"
time scale / 10 - crossfade 0.5 seconds
"
);
break
;
}
}
//
...
...
examples/webgl_loader_sea3d_morph.html
浏览文件 @
a5dc13b1
...
...
@@ -56,11 +56,11 @@
if
(
!
Detector
.
webgl
)
Detector
.
addGetWebGLMessage
();
console
.
log
(
"
Visit https://github.com/sunag/sea3d to all codes and builds under development.
"
);
console
.
log
(
"
Visit https://github.com/sunag/sea3d to all codes and builds under development.
"
);
var
container
,
stats
;
var
camera
,
scene
,
renderer
,
composer
,
controls
,
teapot
;
var
camera
,
scene
,
renderer
,
composer
,
teapot
;
var
loader
;
...
...
@@ -74,26 +74,26 @@
loader
=
new
THREE
.
SEA3D
(
{
autoPlay
:
true
,
// Auto play animations
scripts
:
false
,
// Disable embed scripts
container
:
scene
// Container to add models
autoPlay
:
true
,
// Auto play animations
scripts
:
false
,
// Disable embed scripts
container
:
scene
// Container to add models
}
);
loader
.
onComplete
=
function
(
e
)
{
loader
.
onComplete
=
function
(
e
)
{
// Get the first camera from SEA3D Studio
// use loader.get... to get others objects
var
cam
=
loader
.
cameras
[
0
];
var
cam
=
loader
.
cameras
[
0
];
camera
.
position
.
copy
(
cam
.
position
);
camera
.
rotation
.
copy
(
cam
.
rotation
);
controls
=
new
THREE
.
OrbitControls
(
camera
);
new
THREE
.
OrbitControls
(
camera
);
// get mesh
teapot
=
loader
.
getMesh
(
"
Teapot01
"
);
teapot
=
loader
.
getMesh
(
"
Teapot01
"
);
// events
...
...
@@ -161,8 +161,8 @@
// change morph weight: 0 at 1
// names from modifier Morph of 3ds Max
teapot
.
setWeight
(
"
OldTeapot
"
,
mouseX
/
window
.
innerWidth
);
teapot
.
setWeight
(
"
Sphere
"
,
mouseY
/
window
.
innerHeight
);
teapot
.
setWeight
(
"
OldTeapot
"
,
mouseX
/
window
.
innerWidth
);
teapot
.
setWeight
(
"
Sphere
"
,
mouseY
/
window
.
innerHeight
);
}
...
...
examples/webgl_loader_sea3d_skinning.html
浏览文件 @
a5dc13b1
...
...
@@ -58,11 +58,11 @@
if
(
!
Detector
.
webgl
)
Detector
.
addGetWebGLMessage
();
console
.
log
(
"
Visit https://github.com/sunag/sea3d to all codes and builds under development.
"
);
console
.
log
(
"
Visit https://github.com/sunag/sea3d to all codes and builds under development.
"
);
var
container
,
stats
;
var
camera
,
scene
,
renderer
,
composer
,
controls
,
player
,
hat
;
var
camera
,
scene
,
renderer
,
composer
,
player
,
hat
;
var
loader
;
...
...
@@ -76,26 +76,26 @@
loader
=
new
THREE
.
SEA3D
(
{
autoPlay
:
true
,
// Auto play animations
container
:
scene
,
// Container to add models
multiplier
:
.
6
// Light multiplier
autoPlay
:
true
,
// Auto play animations
container
:
scene
,
// Container to add models
multiplier
:
.
6
// Light multiplier
}
);
loader
.
onComplete
=
function
(
e
)
{
loader
.
onComplete
=
function
(
e
)
{
// Get the first camera from SEA3D Studio
// use loader.get... to get others objects
var
cam
=
loader
.
cameras
[
0
];
var
cam
=
loader
.
cameras
[
0
];
camera
.
position
.
copy
(
cam
.
position
);
camera
.
rotation
.
copy
(
cam
.
rotation
);
controls
=
new
THREE
.
OrbitControls
(
camera
);
// get meshes
player
=
loader
.
getMesh
(
"
Player
"
);
hat
=
loader
.
getMesh
(
"
Hat
"
);
player
=
loader
.
getMesh
(
"
Player
"
);
hat
=
loader
.
getMesh
(
"
Hat
"
);
// on animation complete example
...
...
@@ -103,9 +103,9 @@
// or
player
.
animation
[
'
pass#1
'
].
addEventListener
(
THREE
.
SEA3D
.
Animation
.
COMPLETE
,
function
(
e
)
{
player
.
animation
[
'
pass#1
'
].
addEventListener
(
THREE
.
SEA3D
.
Animation
.
COMPLETE
,
function
(
e
)
{
console
.
log
(
"
Animation completed!
"
,
e
);
console
.
log
(
"
Animation completed!
"
,
e
);
}
);
...
...
@@ -124,34 +124,34 @@
function
updatePlayerCountDescription
(
count
)
{
document
.
getElementById
(
"
playercount
"
).
innerText
=
"
Numbers of players
"
+
count
+
"
| Middle click to clone
"
;
document
.
getElementById
(
"
playercount
"
).
innerText
=
"
Numbers of players
"
+
count
+
"
| Middle click to clone
"
;
}
var
cloneAsset
=
function
()
{
var
cloneAsset
=
function
()
{
var
count
=
2
,
size
=
25
;
return
function
()
{
return
function
()
{
updatePlayerCountDescription
(
count
);
var
PHI
=
Math
.
PI
*
2
*
(
Math
.
sqrt
(
5
)
+
1
)
/
2
;
// golden ratio
var
angle
=
PHI
*
count
++
;
var
PHI
=
Math
.
PI
*
2
*
(
Math
.
sqrt
(
5
)
+
1
)
/
2
;
// golden ratio
var
angle
=
PHI
*
count
++
;
var
container
=
new
THREE
.
Object3D
();
container
.
position
.
z
=
(
size
*
count
)
*
Math
.
cos
(
angle
);
container
.
position
.
x
=
(
size
*
count
)
*
Math
.
sin
(
angle
);
scene
.
add
(
container
);
var
domain
=
loader
.
clone
(
{
autoPlay
:
true
,
container
:
container
,
lights
:
false
});
}
var
domain
=
loader
.
clone
(
{
autoPlay
:
true
,
container
:
container
,
lights
:
false
}
);
};
}();
...
...
@@ -205,10 +205,10 @@
function
onRightClick
(
e
)
{
// play character animation
if
(
player
.
currentAnimation
.
name
==
"
idle
"
)
player
.
play
(
"
run
"
,
.
5
);
// play "pass#1" to caller .onComplete animation example
if
(
player
.
currentAnimation
.
name
==
"
idle
"
)
player
.
play
(
"
run
"
,
.
5
);
// play "pass#1" to caller .onComplete animation example
else
player
.
play
(
"
idle
"
,
.
5
);
player
.
play
(
"
idle
"
,
.
5
);
e
.
preventDefault
();
...
...
@@ -216,11 +216,11 @@
function
onMouseClick
(
e
)
{
if
(
e
.
button
===
0
)
{
if
(
e
.
button
===
0
)
{
hat
.
visible
=
!
hat
.
visible
;
hat
.
visible
=
!
hat
.
visible
;
}
else
if
(
e
.
button
===
1
)
{
}
else
if
(
e
.
button
===
1
)
{
cloneAsset
();
...
...
examples/webgl_loader_sea3d_sound.html
浏览文件 @
a5dc13b1
...
...
@@ -103,7 +103,7 @@
if
(
!
Detector
.
webgl
)
Detector
.
addGetWebGLMessage
();
console
.
log
(
"
Visit https://github.com/sunag/sea3d to all codes and builds under development.
"
);
console
.
log
(
"
Visit https://github.com/sunag/sea3d to all codes and builds under development.
"
);
var
container
,
raycaster
,
stats
;
...
...
@@ -126,12 +126,12 @@
loader
=
new
THREE
.
SEA3D
(
{
autoPlay
:
true
,
// Auto play animations
container
:
scene
// Container to add models
autoPlay
:
true
,
// Auto play animations
container
:
scene
// Container to add models
}
);
loader
.
onComplete
=
function
(
e
)
{
loader
.
onComplete
=
function
(
e
)
{
audioListener
=
loader
.
audioListener
;
...
...
@@ -144,19 +144,19 @@
// sound asset 1
lightOutside
=
loader
.
getLight
(
"
Light1
"
);
lightOutside
=
loader
.
getLight
(
"
Light1
"
);
var
soundOutside
=
loader
.
getSound3D
(
"
Point001
"
);
var
soundOutside
=
loader
.
getSound3D
(
"
Point001
"
);
soundOutsideAnalyser
=
new
THREE
.
AudioAnalyser
(
soundOutside
,
32
);
// sound asset 2 + area
lightArea
=
loader
.
getLight
(
"
Light2
"
);
lightArea
=
loader
.
getLight
(
"
Light2
"
);
soundArea
=
loader
.
getSound3D
(
"
Point002
"
);
soundArea
=
loader
.
getSound3D
(
"
Point002
"
);
soundAreaAnalyser
=
new
THREE
.
AudioAnalyser
(
soundArea
,
512
);
collisionArea
=
loader
.
getMesh
(
"
Torus003
"
);
collisionArea
=
loader
.
getMesh
(
"
Torus003
"
);
animate
();
...
...
@@ -394,18 +394,18 @@
function
updateSoundFilter
()
{
// difference position between sound and listener
var
difPos
=
new
THREE
.
Vector3
().
setFromMatrixPosition
(
soundArea
.
matrixWorld
).
sub
(
audioPos
);
var
difPos
=
new
THREE
.
Vector3
().
setFromMatrixPosition
(
soundArea
.
matrixWorld
).
sub
(
audioPos
);
var
length
=
difPos
.
length
();
// pick a vector from camera to sound
raycaster
.
set
(
audioPos
,
difPos
.
normalize
()
);
// intersecting sound1
if
(
length
>
50
&&
raycaster
.
intersectObjects
(
[
collisionArea
]
).
length
)
{
if
(
length
>
50
&&
raycaster
.
intersectObjects
(
[
collisionArea
]
).
length
)
{
if
(
soundArea
.
getFilters
()[
0
]
!==
soundFilter
)
soundArea
.
setFilters
(
[
soundFilter
]
);
if
(
soundArea
.
getFilters
()[
0
]
!==
soundFilter
)
soundArea
.
setFilters
(
[
soundFilter
]
);
}
else
if
(
soundArea
.
getFilters
()[
0
]
===
soundFilter
)
{
}
else
if
(
soundArea
.
getFilters
()[
0
]
===
soundFilter
)
{
soundArea
.
setFilters
(
[]
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录