Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
709f59de
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,发现更多精彩内容 >>
提交
709f59de
编写于
7月 27, 2015
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #6914 from sunag/dev
sea3d revision 2 + morph example
上级
6a2c7e2c
0931cd71
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
825 addition
and
437 deletion
+825
-437
examples/index.html
examples/index.html
+1
-0
examples/js/loaders/sea3d/SEA3DLoader.js
examples/js/loaders/sea3d/SEA3DLoader.js
+408
-351
examples/models/sea3d/sound.sea
examples/models/sea3d/sound.sea
+0
-0
examples/webgl_loader_sea3d.html
examples/webgl_loader_sea3d.html
+16
-17
examples/webgl_loader_sea3d_hierarchy.html
examples/webgl_loader_sea3d_hierarchy.html
+11
-15
examples/webgl_loader_sea3d_keyframe.html
examples/webgl_loader_sea3d_keyframe.html
+14
-19
examples/webgl_loader_sea3d_morph.html
examples/webgl_loader_sea3d_morph.html
+205
-0
examples/webgl_loader_sea3d_skinning.html
examples/webgl_loader_sea3d_skinning.html
+18
-18
examples/webgl_loader_sea3d_sound.html
examples/webgl_loader_sea3d_sound.html
+56
-14
src/extras/audio/Audio.js
src/extras/audio/Audio.js
+96
-3
未找到文件。
examples/index.html
浏览文件 @
709f59de
...
@@ -266,6 +266,7 @@
...
@@ -266,6 +266,7 @@
"
webgl_loader_sea3d
"
,
"
webgl_loader_sea3d
"
,
"
webgl_loader_sea3d_hierarchy
"
,
"
webgl_loader_sea3d_hierarchy
"
,
"
webgl_loader_sea3d_keyframe
"
,
"
webgl_loader_sea3d_keyframe
"
,
"
webgl_loader_sea3d_morph
"
,
"
webgl_loader_sea3d_skinning
"
,
"
webgl_loader_sea3d_skinning
"
,
"
webgl_loader_sea3d_sound
"
,
"
webgl_loader_sea3d_sound
"
,
"
webgl_loader_scene
"
,
"
webgl_loader_scene
"
,
...
...
examples/js/loaders/sea3d/SEA3DLoader.js
浏览文件 @
709f59de
...
@@ -5,11 +5,42 @@
...
@@ -5,11 +5,42 @@
* http://sea3d.poonya.com/
* http://sea3d.poonya.com/
*/
*/
//
// SEA3D
//
THREE
.
SEA3D
=
function
(
config
)
{
this
.
config
=
config
||
{};
if
(
this
.
config
.
autoPlay
===
undefined
)
this
.
config
.
autoPlay
=
false
;
if
(
this
.
config
.
flip
===
undefined
)
this
.
config
.
flip
=
true
;
if
(
this
.
config
.
parser
==
undefined
)
this
.
config
.
parser
=
THREE
.
SEA3D
.
AUTO
;
if
(
this
.
config
.
multiplier
==
undefined
)
this
.
config
.
multiplier
=
1
;
if
(
this
.
config
.
tangent
==
undefined
)
this
.
config
.
tangent
=
true
;
if
(
this
.
config
.
bounding
==
undefined
)
this
.
config
.
bounding
=
true
;
if
(
this
.
config
.
standardMaterial
==
undefined
)
this
.
config
.
standardMaterial
=
true
;
if
(
this
.
config
.
audioRolloffFactor
==
undefined
)
this
.
config
.
audioRolloffFactor
=
10
;
this
.
container
=
this
.
config
.
container
||
new
THREE
.
Object3D
();
this
.
objects
=
{};
}
THREE
.
SEA3D
.
prototype
=
{
constructor
:
THREE
.
SEA3D
,
addEventListener
:
THREE
.
EventDispatcher
.
prototype
.
addEventListener
,
hasEventListener
:
THREE
.
EventDispatcher
.
prototype
.
hasEventListener
,
removeEventListener
:
THREE
.
EventDispatcher
.
prototype
.
removeEventListener
,
dispatchEvent
:
THREE
.
EventDispatcher
.
prototype
.
dispatchEvent
}
//
//
// Shader
// Shader
//
//
THREE
.
ShaderLib
.
replaceCode
=
function
(
src
,
target
,
replace
)
{
THREE
.
SEA3D
.
ShaderLib
=
{};
THREE
.
SEA3D
.
ShaderLib
.
replaceCode
=
function
(
src
,
target
,
replace
)
{
for
(
var
i
=
0
;
i
<
target
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
target
.
length
;
i
++
)
{
var
tar
=
target
[
i
],
var
tar
=
target
[
i
],
rep
=
replace
[
i
],
rep
=
replace
[
i
],
...
@@ -20,59 +51,90 @@ THREE.ShaderLib.replaceCode = function(src, target, replace) {
...
@@ -20,59 +51,90 @@ THREE.ShaderLib.replaceCode = function(src, target, replace) {
}
}
return
src
;
return
src
;
}
};
// TODO: Emissive to Ambient Color Extension
THREE
.
ShaderLib
[
'
phong
'
].
fragmentShader_StandardMaterial
=
THREE
.
SEA3D
.
ShaderLib
.
fragStdMtl
=
THREE
.
SEA3D
.
ShaderLib
.
replaceCode
(
THREE
.
ShaderLib
.
phong
.
fragmentShader
,
[
THREE
.
ShaderLib
.
replaceCode
(
THREE
.
ShaderLib
[
'
phong
'
].
fragmentShader
,
[
// Target
// Target
'
outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + totalAmbientLight ) * specular + totalSpecularLight + totalEmissiveLight;
'
,
// METAL
'
outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + totalAmbientLight ) * specular + totalSpecularLight + totalEmissiveLight;
'
,
// METAL
'
outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + totalAmbientLight ) + totalSpecularLight + totalEmissiveLight;
'
'
outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + totalAmbientLight ) + totalSpecularLight + totalEmissiveLight;
'
],
[
],
[
// Replace To
// Replace To
'
outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + totalAmbientLight + totalEmissiveLight ) * specular + totalSpecularLight;
'
,
// METAL
'
outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + totalAmbientLight + totalEmissiveLight ) * specular + totalSpecularLight;
'
,
// METAL
'
outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + totalAmbientLight + totalEmissiveLight ) + totalSpecularLight;
'
'
outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + totalAmbientLight + totalEmissiveLight ) + totalSpecularLight;
'
]
);
]
);
//
//
//
Material ( Emissive to Ambient Color Extension )
//
Standard Material
//
//
THREE
.
MeshPhongMaterial
.
prototype
.
emissiveToAmbientColor
=
false
;
THREE
.
SEA3D
.
StandardMaterial
=
function
()
{
THREE
.
MeshPhongMaterial
.
prototype
.
CLONE
=
THREE
.
MeshPhongMaterial
.
prototype
.
clone
;
THREE
.
MeshPhongMaterial
.
call
(
this
);
THREE
.
MeshPhongMaterial
.
prototype
.
clone
=
function
()
{
var
mat
=
this
.
CLONE
();
};
mat
.
emissiveToAmbientColor
=
this
.
emissiveToAmbientColor
;
return
mat
;
THREE
.
SEA3D
.
StandardMaterial
.
prototype
=
Object
.
create
(
THREE
.
MeshPhongMaterial
.
prototype
);
}
THREE
.
SEA3D
.
StandardMaterial
.
prototype
.
constructor
=
THREE
.
SEA3D
.
StandardMaterial
;
THREE
.
SEA3D
.
StandardMaterial
.
prototype
.
copy
=
function
(
source
)
{
THREE
.
MeshPhongMaterial
.
prototype
.
copy
.
call
(
this
,
source
);
return
this
;
};
THREE
.
SEA3D
.
StandardMaterial
.
prototype
.
clone
=
function
()
{
THREE
.
MeshPhongMaterial
.
prototype
.
__defineSetter__
(
"
__webglShader
"
,
function
(
val
){
return
new
THREE
.
SEA3D
.
StandardMaterial
().
copy
(
this
);
if
(
this
.
emissiveToAmbientColor
)
val
.
fragmentShader
=
THREE
.
ShaderLib
[
'
phong
'
].
fragmentShader_StandardMaterial
;
};
THREE
.
SEA3D
.
StandardMaterial
.
prototype
.
__defineSetter__
(
"
__webglShader
"
,
function
(
val
)
{
val
.
fragmentShader
=
THREE
.
SEA3D
.
ShaderLib
.
fragStdMtl
;
this
.
__webglShader__
=
val
;
this
.
__webglShader__
=
val
;
});
});
THREE
.
MeshPhongMaterial
.
prototype
.
__defineGetter__
(
"
__webglShader
"
,
function
(){
THREE
.
SEA3D
.
StandardMaterial
.
prototype
.
__defineGetter__
(
"
__webglShader
"
,
function
()
{
return
this
.
__webglShader__
;
return
this
.
__webglShader__
;
});
});
//
//
//
Mesh
//
Container
//
//
// Local Animation
THREE
.
SEA3D
.
Object3D
=
function
(
)
{
THREE
.
Object3D
.
prototype
.
UPDATEMATRIXWORLD
=
THREE
.
Mesh
.
prototype
.
updateMatrixWorld
;
THREE
.
Object3D
.
prototype
.
updateMatrixWorld
=
function
(
force
)
{
THREE
.
Object3D
.
call
(
this
);
if
(
this
.
animateMatrix
)
{
this
.
UPDATEMATRIXWORLD
(
force
);
};
THREE
.
SEA3D
.
Object3D
.
prototype
=
Object
.
create
(
THREE
.
Object3D
.
prototype
);
THREE
.
SEA3D
.
Object3D
.
prototype
.
constructor
=
THREE
.
SEA3D
.
Object3D
;
// Relative Animation Extension
// TODO: It can be done with shader
THREE
.
SEA3D
.
Object3D
.
prototype
.
updateAnimateMatrix
=
function
(
force
)
{
THREE
.
Mesh
.
prototype
.
updateMatrixWorld
.
call
(
this
,
force
);
this
.
animateMatrix
.
compose
(
this
.
animatePosition
,
this
.
animateQuaternion
,
this
.
animateScale
);
this
.
animateMatrix
.
compose
(
this
.
animatePosition
,
this
.
animateQuaternion
,
this
.
animateScale
);
this
.
matrixWorld
.
multiplyMatrices
(
this
.
matrixWorld
,
this
.
animateMatrix
);
this
.
matrixWorld
.
multiplyMatrices
(
this
.
matrixWorld
,
this
.
animateMatrix
);
}
else
this
.
UPDATEMATRIXWORLD
(
force
);
}
THREE
.
Object3D
.
prototype
.
setAnimateMatrix
=
function
(
val
)
{
};
if
(
this
.
getAnimateMatrix
()
==
val
)
return
;
THREE
.
SEA3D
.
Object3D
.
prototype
.
setAnimateMatrix
=
function
(
val
)
{
if
(
this
.
getAnimateMatrix
()
==
val
)
return
;
if
(
val
)
{
if
(
val
)
{
this
.
animateMatrix
=
new
THREE
.
Matrix4
();
this
.
animateMatrix
=
new
THREE
.
Matrix4
();
...
@@ -80,50 +142,106 @@ THREE.Object3D.prototype.setAnimateMatrix = function(val) {
...
@@ -80,50 +142,106 @@ THREE.Object3D.prototype.setAnimateMatrix = function(val) {
this
.
animatePosition
=
new
THREE
.
Vector3
();
this
.
animatePosition
=
new
THREE
.
Vector3
();
this
.
animateQuaternion
=
new
THREE
.
Quaternion
();
this
.
animateQuaternion
=
new
THREE
.
Quaternion
();
this
.
animateScale
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
animateScale
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
updateMatrixWorld
=
THREE
.
SEA3D
.
Object3D
.
prototype
.
updateAnimateMatrix
;
}
else
{
}
else
{
delete
this
.
animateMatrix
;
delete
this
.
animateMatrix
;
delete
this
.
animatePosition
;
delete
this
.
animatePosition
;
delete
this
.
animateQuaternion
;
delete
this
.
animateQuaternion
;
delete
this
.
animateScale
;
delete
this
.
animateScale
;
this
.
updateMatrixWorld
=
THREE
.
Mesh
.
prototype
.
updateMatrixWorld
;
}
}
this
.
matrixWorldNeedsUpdate
=
true
;
this
.
matrixWorldNeedsUpdate
=
true
;
}
THREE
.
Object3D
.
prototype
.
getAnimateMatrix
=
function
()
{
};
THREE
.
SEA3D
.
Object3D
.
prototype
.
getAnimateMatrix
=
function
()
{
return
this
.
animateMatrix
!=
null
;
return
this
.
animateMatrix
!=
null
;
}
THREE
.
Mesh
.
prototype
.
setWeight
=
function
(
name
,
val
)
{
};
//
// Mesh
//
THREE
.
SEA3D
.
Mesh
=
function
(
geometry
,
material
)
{
THREE
.
Mesh
.
call
(
this
,
geometry
,
material
);
};
THREE
.
SEA3D
.
Mesh
.
prototype
=
Object
.
create
(
THREE
.
Mesh
.
prototype
);
THREE
.
SEA3D
.
Mesh
.
prototype
.
constructor
=
THREE
.
Mesh
;
THREE
.
SEA3D
.
Mesh
.
prototype
.
setAnimateMatrix
=
THREE
.
SEA3D
.
Object3D
.
prototype
.
setAnimateMatrix
;
THREE
.
SEA3D
.
Mesh
.
prototype
.
getAnimateMatrix
=
THREE
.
SEA3D
.
Object3D
.
prototype
.
getAnimateMatrix
;
THREE
.
SEA3D
.
Mesh
.
prototype
.
setWeight
=
function
(
name
,
val
)
{
this
.
morphTargetInfluences
[
this
.
geometry
.
morphTargets
[
name
]
]
=
val
;
this
.
morphTargetInfluences
[
this
.
geometry
.
morphTargets
[
name
]
]
=
val
;
}
THREE
.
Mesh
.
prototype
.
getWeight
=
function
(
name
)
{
};
THREE
.
SEA3D
.
Mesh
.
prototype
.
getWeight
=
function
(
name
)
{
return
this
.
morphTargetInfluences
[
this
.
geometry
.
morphTargets
[
name
]
];
return
this
.
morphTargetInfluences
[
this
.
geometry
.
morphTargets
[
name
]
];
}
THREE
.
Mesh
.
prototype
.
DISPOSE
=
THREE
.
Mesh
.
prototype
.
dispose
;
};
THREE
.
Mesh
.
prototype
.
dispose
=
function
()
{
if
(
this
.
animation
)
this
.
animation
.
dispose
();
this
.
DISPOSE
();
}
THREE
.
Mesh
.
prototype
.
CLONE
=
THREE
.
Mesh
.
prototype
.
clone
;
THREE
.
SEA3D
.
Mesh
.
prototype
.
dispose
=
function
()
{
THREE
.
Mesh
.
prototype
.
clone
=
function
(
object
)
{
var
cloned
=
THREE
.
Mesh
.
prototype
.
CLONE
.
call
(
this
,
object
);
if
(
cloned
.
animation
)
if
(
this
.
animation
)
cloned
.
animation
=
this
.
animation
.
clone
(
cloned
);
this
.
animation
.
dispose
(
);
return
cloned
;
this
.
animations
=
null
;
}
THREE
.
Mesh
.
prototype
.
dispose
.
call
(
this
);
};
THREE
.
SEA3D
.
Mesh
.
prototype
.
copy
=
function
(
source
)
{
THREE
.
Mesh
.
prototype
.
copy
.
call
(
this
,
source
);
if
(
this
.
animation
)
this
.
animation
=
source
.
animation
.
clone
(
this
);
return
this
;
};
THREE
.
SEA3D
.
Mesh
.
prototype
.
clone
=
function
(
object
)
{
return
new
THREE
.
SEA3D
.
Mesh
(
this
.
geometry
,
this
.
material
).
copy
(
this
);
};
//
//
// Skinning
// Skinning
//
//
THREE
.
SkinnedMesh
.
prototype
.
stop
=
function
()
{
THREE
.
SEA3D
.
SkinnedMesh
=
function
(
geometry
,
material
,
useVertexTexture
)
{
THREE
.
SkinnedMesh
.
call
(
this
,
geometry
,
material
,
useVertexTexture
);
};
THREE
.
SEA3D
.
SkinnedMesh
.
prototype
=
Object
.
create
(
THREE
.
SkinnedMesh
.
prototype
);
THREE
.
SEA3D
.
SkinnedMesh
.
prototype
.
constructor
=
THREE
.
SEA3D
.
SkinnedMesh
;
THREE
.
SEA3D
.
SkinnedMesh
.
prototype
.
setAnimateMatrix
=
THREE
.
SEA3D
.
Mesh
.
prototype
.
setAnimateMatrix
;
THREE
.
SEA3D
.
SkinnedMesh
.
prototype
.
getAnimateMatrix
=
THREE
.
SEA3D
.
Mesh
.
prototype
.
getAnimateMatrix
;
THREE
.
SEA3D
.
SkinnedMesh
.
prototype
.
setWeight
=
THREE
.
SEA3D
.
Mesh
.
prototype
.
setWeight
;
THREE
.
SEA3D
.
SkinnedMesh
.
prototype
.
getWeight
=
THREE
.
SEA3D
.
Mesh
.
prototype
.
getWeight
;
THREE
.
SEA3D
.
SkinnedMesh
.
prototype
.
isPlaying
=
false
;
THREE
.
SEA3D
.
SkinnedMesh
.
prototype
.
stop
=
function
()
{
if
(
this
.
currentAnimation
)
{
if
(
this
.
currentAnimation
)
{
this
.
currentAnimation
.
stop
();
this
.
currentAnimation
.
stop
();
this
.
currentAnimation
=
null
;
this
.
currentAnimation
=
null
;
...
@@ -131,23 +249,21 @@ THREE.SkinnedMesh.prototype.stop = function() {
...
@@ -131,23 +249,21 @@ THREE.SkinnedMesh.prototype.stop = function() {
}
}
}
}
THREE
.
SkinnedMesh
.
prototype
.
pause
=
function
()
{
THREE
.
S
EA3D
.
S
kinnedMesh
.
prototype
.
pause
=
function
()
{
if
(
this
.
isPlaying
)
{
if
(
this
.
isPlaying
)
{
this
.
currentAnimation
.
pause
();
this
.
currentAnimation
.
pause
();
this
.
isPlaying
=
false
;
this
.
isPlaying
=
false
;
}
}
}
}
THREE
.
SkinnedMesh
.
prototype
.
resume
=
function
()
{
THREE
.
S
EA3D
.
S
kinnedMesh
.
prototype
.
resume
=
function
()
{
if
(
!
this
.
isPlaying
&&
this
.
currentAnimation
)
{
if
(
!
this
.
isPlaying
&&
this
.
currentAnimation
)
{
this
.
currentAnimation
.
pause
();
this
.
currentAnimation
.
pause
();
this
.
isPlaying
=
true
;
this
.
isPlaying
=
true
;
}
}
}
}
THREE
.
SkinnedMesh
.
prototype
.
isPlaying
=
false
;
THREE
.
SEA3D
.
SkinnedMesh
.
prototype
.
play
=
function
(
name
,
crossfade
,
offset
)
{
THREE
.
SkinnedMesh
.
prototype
.
play
=
function
(
name
,
crossfade
,
offset
)
{
this
.
previousAnimation
=
this
.
currentAnimation
;
this
.
previousAnimation
=
this
.
currentAnimation
;
this
.
currentAnimation
=
this
.
animations
[
name
];
this
.
currentAnimation
=
this
.
animations
[
name
];
...
@@ -159,7 +275,7 @@ THREE.SkinnedMesh.prototype.play = function(name, crossfade, offset) {
...
@@ -159,7 +275,7 @@ THREE.SkinnedMesh.prototype.play = function(name, crossfade, offset) {
this
.
previousAnimation
.
play
(
this
.
previousAnimation
.
currentTime
,
this
.
previousAnimation
.
weight
);
this
.
previousAnimation
.
play
(
this
.
previousAnimation
.
currentTime
,
this
.
previousAnimation
.
weight
);
this
.
currentAnimation
.
play
(
offset
!==
undefined
?
offset
:
this
.
currentAnimation
.
currentTime
,
this
.
currentAnimation
.
weight
);
this
.
currentAnimation
.
play
(
offset
!==
undefined
?
offset
:
this
.
currentAnimation
.
currentTime
,
this
.
currentAnimation
.
weight
);
THREE
.
AnimationHandler
.
addCrossfade
(
this
,
crossfade
);
THREE
.
SEA3D
.
AnimationHandler
.
addCrossfade
(
this
,
crossfade
);
}
else
{
}
else
{
this
.
currentAnimation
.
play
(
offset
!==
undefined
?
offset
:
this
.
currentAnimation
.
currentTime
,
1
);
this
.
currentAnimation
.
play
(
offset
!==
undefined
?
offset
:
this
.
currentAnimation
.
currentTime
,
1
);
...
@@ -168,7 +284,7 @@ THREE.SkinnedMesh.prototype.play = function(name, crossfade, offset) {
...
@@ -168,7 +284,7 @@ THREE.SkinnedMesh.prototype.play = function(name, crossfade, offset) {
this
.
isPlaying
=
true
;
this
.
isPlaying
=
true
;
}
}
THREE
.
SkinnedMesh
.
prototype
.
setAnimations
=
function
(
animations
)
{
THREE
.
S
EA3D
.
S
kinnedMesh
.
prototype
.
setAnimations
=
function
(
animations
)
{
this
.
animations
=
[];
this
.
animations
=
[];
this
.
weightSchedule
=
[];
this
.
weightSchedule
=
[];
this
.
warpSchedule
=
[];
this
.
warpSchedule
=
[];
...
@@ -180,7 +296,7 @@ THREE.SkinnedMesh.prototype.setAnimations = function(animations) {
...
@@ -180,7 +296,7 @@ THREE.SkinnedMesh.prototype.setAnimations = function(animations) {
var
ns
=
animations
[
i
].
name
;
var
ns
=
animations
[
i
].
name
;
var
name
=
ns
.
substring
(
nsIndex
);
var
name
=
ns
.
substring
(
nsIndex
);
this
.
animations
[
i
]
=
new
THREE
.
Animation
(
this
,
animations
[
i
]
);
this
.
animations
[
i
]
=
new
THREE
.
SEA3D
.
Animation
(
this
,
animations
[
i
]
);
this
.
animations
[
i
].
loop
=
animations
[
i
].
repeat
;
this
.
animations
[
i
].
loop
=
animations
[
i
].
repeat
;
this
.
animations
[
i
].
name
=
name
;
this
.
animations
[
i
].
name
=
name
;
...
@@ -188,35 +304,39 @@ THREE.SkinnedMesh.prototype.setAnimations = function(animations) {
...
@@ -188,35 +304,39 @@ THREE.SkinnedMesh.prototype.setAnimations = function(animations) {
}
}
}
}
THREE
.
SkinnedMesh
.
prototype
.
boneByName
=
function
(
name
)
{
THREE
.
S
EA3D
.
S
kinnedMesh
.
prototype
.
boneByName
=
function
(
name
)
{
var
bones
=
this
.
bones
;
var
bones
=
this
.
bones
;
for
(
var
i
=
0
,
bl
=
bones
.
length
;
i
<
bl
;
i
++
)
{
for
(
var
i
=
0
,
bl
=
bones
.
length
;
i
<
bl
;
i
++
)
{
if
(
name
==
bones
[
i
].
name
)
{
if
(
name
==
bones
[
i
].
name
)
return
bones
[
i
];
return
bones
[
i
];
}
}
}
}
}
THREE
.
S
kinnedMesh
.
prototype
.
DISPOSE
=
THREE
.
SkinnedMesh
.
prototype
.
dispose
;
THREE
.
S
EA3D
.
SkinnedMesh
.
prototype
.
dispose
=
function
()
{
THREE
.
SkinnedMesh
.
prototype
.
dispose
=
function
()
{
this
.
stop
();
this
.
stop
();
if
(
this
.
animation
)
this
.
animation
.
dispose
();
this
.
animations
=
null
;
this
.
animations
=
null
;
this
.
DISPOSE
();
THREE
.
SkinnedMesh
.
prototype
.
dispose
.
call
(
this
);
}
}
THREE
.
SkinnedMesh
.
prototype
.
CLONE
=
THREE
.
SkinnedMesh
.
prototype
.
clone
;
THREE
.
SEA3D
.
SkinnedMesh
.
prototype
.
copy
=
function
(
source
)
{
THREE
.
SkinnedMesh
.
prototype
.
clone
=
function
(
object
)
{
var
cloned
=
THREE
.
SkinnedMesh
.
prototype
.
CLONE
.
call
(
this
,
object
);
THREE
.
SkinnedMesh
.
prototype
.
copy
.
call
(
this
,
source
);
if
(
cloned
.
animation
)
if
(
this
.
animation
)
cloned
.
animation
=
this
.
animation
.
clone
(
cloned
);
this
.
animation
=
source
.
animation
.
clone
(
this
);
cloned
.
animations
=
[];
this
.
animations
=
[];
if
(
this
.
geometry
.
animations
)
{
if
(
source
.
geometry
.
animations
)
{
var
refAnimations
=
this
.
geometry
.
animations
;
var
refAnimations
=
source
.
geometry
.
animations
;
var
nsIndex
=
refAnimations
[
0
].
name
.
indexOf
(
"
/
"
)
+
1
;
var
nsIndex
=
refAnimations
[
0
].
name
.
indexOf
(
"
/
"
)
+
1
;
for
(
var
i
=
0
;
i
<
refAnimations
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
refAnimations
.
length
;
i
++
)
{
...
@@ -225,26 +345,34 @@ THREE.SkinnedMesh.prototype.clone = function ( object ) {
...
@@ -225,26 +345,34 @@ THREE.SkinnedMesh.prototype.clone = function ( object ) {
data
.
initialized
=
false
;
data
.
initialized
=
false
;
cloned
.
animations
[
i
]
=
new
THREE
.
Animation
(
cloned
,
data
);
this
.
animations
[
i
]
=
new
THREE
.
SEA3D
.
Animation
(
this
,
data
);
cloned
.
animations
[
i
].
loop
=
refAnimations
[
i
].
repeat
;
this
.
animations
[
i
].
loop
=
refAnimations
[
i
].
repeat
;
cloned
.
animations
[
i
].
name
=
name
;
this
.
animations
[
i
].
name
=
name
;
}
}
}
}
return
cloned
;
return
this
;
}
};
THREE
.
SEA3D
.
SkinnedMesh
.
prototype
.
clone
=
function
(
object
)
{
return
new
THREE
.
SEA3D
.
SkinnedMesh
(
this
.
geometry
,
this
.
material
,
this
.
useVertexTexture
).
copy
(
this
);
};
//
//
//
Three.JS Skeleton Animation Crossfade Extension
//
Animation Update
//
//
THREE
.
AnimationHandler
.
crossfade
=
[];
THREE
.
SEA3D
.
AnimationHandler
=
{
THREE
.
AnimationHandler
.
UPDATE
=
THREE
.
AnimationHandler
.
update
;
crossfade
:
[],
update
:
function
(
dt
)
{
THREE
.
AnimationHandler
.
update
=
function
(
dt
)
{
var
i
,
cf
=
THREE
.
SEA3D
.
AnimationHandler
.
crossfade
;
var
i
,
cf
=
THREE
.
AnimationHandler
.
crossfade
;
// Crossfade
// crossfade
i
=
0
;
i
=
0
;
while
(
i
<
cf
.
length
)
{
while
(
i
<
cf
.
length
)
{
var
mesh
=
cf
[
i
];
var
mesh
=
cf
[
i
];
...
@@ -265,145 +393,56 @@ THREE.AnimationHandler.update = function( dt ) {
...
@@ -265,145 +393,56 @@ THREE.AnimationHandler.update = function( dt ) {
++
i
;
++
i
;
mesh
.
previousAnimation
.
weight
=
1
-
mesh
.
currentAnimation
.
weight
;
mesh
.
previousAnimation
.
weight
=
1
-
mesh
.
currentAnimation
.
weight
;
}
}
THREE
.
AnimationHandler
.
UPDATE
(
dt
);
SEA3D
.
AnimationHandler
.
update
(
dt
);
}
THREE
.
AnimationHandler
.
addCrossfade
=
function
(
mesh
,
crossfade
)
{
},
if
(
mesh
.
crossfade
!==
undefined
)
THREE
.
AnimationHandler
.
crossfade
.
splice
(
THREE
.
AnimationHandler
.
crossfade
.
indexOf
(
mesh
),
1
);
mesh
.
crossfade
=
crossfade
;
addCrossfade
:
function
(
mesh
,
crossfade
)
{
THREE
.
AnimationHandler
.
crossfade
.
push
(
mesh
);
if
(
mesh
.
crossfade
!==
undefined
)
}
THREE
.
SEA3D
.
AnimationHandler
.
crossfade
.
splice
(
THREE
.
SEA3D
.
AnimationHandler
.
crossfade
.
indexOf
(
mesh
),
1
);
//
mesh
.
crossfade
=
crossfade
;
// Animation Event Extension
//
THREE
.
Animation
.
prototype
.
STOP
=
THREE
.
Animation
.
prototype
.
stop
;
THREE
.
SEA3D
.
AnimationHandler
.
crossfade
.
push
(
mesh
);
THREE
.
Animation
.
prototype
.
stop
=
function
()
{
if
(
this
.
onComplete
)
this
.
onComplete
(
this
);
this
.
STOP
();
}
}
THREE
.
Animation
.
prototype
.
RESET
=
THREE
.
Animation
.
prototype
.
reset
;
THREE
.
Animation
.
prototype
.
reset
=
function
()
{
if
(
this
.
onReset
)
this
.
onReset
(
this
);
this
.
RESET
();
}
}
//
//
//
Sound3D
//
Animation Event
//
//
THREE
.
Sound3D
=
function
(
src
,
volume
,
distance
)
{
THREE
.
SEA3D
.
Animation
=
function
(
root
,
data
)
{
THREE
.
Object3D
.
call
(
this
);
this
.
audio
=
new
Audio
();
this
.
audio
.
src
=
src
;
this
.
audio
.
load
();
this
.
distance
=
distance
!==
undefined
?
distance
:
1000
;
this
.
volume
=
volume
!==
undefined
?
volume
:
1
;
this
.
playing
=
false
;
}
THREE
.
Sound3D
.
prototype
=
Object
.
create
(
THREE
.
Object3D
.
prototype
);
THREE
.
Sound3D
.
prototype
.
loop
=
false
;
THREE
.
Sound3D
.
prototype
.
play
=
function
(
offset
)
{
if
(
offset
!==
undefined
&&
this
.
audio
.
duration
>
0
)
{
this
.
audio
.
currentTime
=
offset
;
}
this
.
audio
.
loop
=
this
.
loop
;
this
.
audio
.
play
();
if
(
!
this
.
playing
)
{
this
.
index
=
THREE
.
Sound3D
.
sounds
.
length
;
THREE
.
Sound3D
.
sounds
.
push
(
this
);
this
.
playing
=
true
;
}
}
THREE
.
Sound3D
.
prototype
.
stop
=
function
()
{
if
(
this
.
audio
.
duration
>
0
)
this
.
audio
.
currentTime
=
0
;
this
.
pause
();
}
THREE
.
Sound3D
.
prototype
.
pause
=
function
()
{
this
.
audio
.
pause
();
if
(
this
.
playing
)
{
THREE
.
Sound3D
.
sounds
.
splice
(
this
.
index
,
1
);
this
.
playing
=
false
;
}
}
THREE
.
Sound3D
.
prototype
.
update
=
function
(
camera
)
{
var
soundPosition
=
new
THREE
.
Vector3
();
soundPosition
.
setFromMatrixPosition
(
this
.
matrixWorld
);
var
cameraPosition
=
new
THREE
.
Vector3
();
THREE
.
Animation
.
call
(
this
,
root
,
data
);
cameraPosition
.
setFromMatrixPosition
(
camera
.
matrixWorld
);
var
distance
=
soundPosition
.
distanceTo
(
cameraPosition
);
};
var
volume
=
this
.
volume
*
(
1
-
(
distance
/
(
this
.
distance
*
3
)
));
THREE
.
SEA3D
.
Animation
.
prototype
=
Object
.
create
(
THREE
.
Animation
.
prototype
);
THREE
.
SEA3D
.
Animation
.
prototype
.
constructor
=
THREE
.
SEA3D
.
Animation
;
this
.
audio
.
volume
=
Math
.
max
(
0
,
Math
.
min
(
1
,
volume
));
THREE
.
SEA3D
.
Animation
.
prototype
.
stop
=
function
()
{
}
THREE
.
Sound3D
.
sounds
=
[];
if
(
this
.
onComplete
)
this
.
onComplete
(
this
);
THREE
.
Sound3D
.
update
=
function
(
camera
)
{
THREE
.
Animation
.
prototype
.
stop
.
call
(
this
);
var
sounds
=
THREE
.
Sound3D
.
sounds
;
for
(
var
i
=
0
;
i
<
sounds
.
length
;
i
++
)
{
sounds
[
i
].
update
(
camera
);
}
}
//
};
// SEA3D
//
THREE
.
SEA3D
=
function
(
config
)
{
THREE
.
SEA3D
.
Animation
.
prototype
.
reset
=
function
()
{
this
.
config
=
config
||
{};
if
(
this
.
config
.
autoPlay
===
undefined
)
this
.
config
.
autoPlay
=
false
;
if
(
this
.
onReset
)
if
(
this
.
config
.
flip
===
undefined
)
this
.
config
.
flip
=
true
;
this
.
onReset
(
this
);
if
(
this
.
config
.
parser
==
undefined
)
this
.
config
.
parser
=
THREE
.
SEA3D
.
AUTO
;
if
(
this
.
config
.
multiplier
==
undefined
)
this
.
config
.
multiplier
=
1
;
if
(
this
.
config
.
tangent
==
undefined
)
this
.
config
.
tangent
=
true
;
if
(
this
.
config
.
bounding
==
undefined
)
this
.
config
.
bounding
=
true
;
if
(
this
.
config
.
ambientColor
==
undefined
)
this
.
config
.
ambientColor
=
true
;
this
.
container
=
this
.
config
.
container
||
new
THREE
.
Object3D
();
THREE
.
Animation
.
prototype
.
reset
.
call
(
this
);
this
.
objects
=
{};
}
THREE
.
SEA3D
.
prototype
=
{
};
constructor
:
THREE
.
SEA3D
,
addEventListener
:
THREE
.
EventDispatcher
.
prototype
.
addEventListener
,
hasEventListener
:
THREE
.
EventDispatcher
.
prototype
.
hasEventListener
,
removeEventListener
:
THREE
.
EventDispatcher
.
prototype
.
removeEventListener
,
dispatchEvent
:
THREE
.
EventDispatcher
.
prototype
.
dispatchEvent
}
//
//
// Config
// Config
...
@@ -621,19 +660,17 @@ THREE.SEA3D.prototype.updateAnimationSet = function(obj3d) {
...
@@ -621,19 +660,17 @@ THREE.SEA3D.prototype.updateAnimationSet = function(obj3d) {
var
buf
=
THREE
.
SEA3D
.
BUFFER2
;
var
buf
=
THREE
.
SEA3D
.
BUFFER2
;
var
anmSet
=
obj3d
.
animation
.
animationSet
;
var
anmSet
=
obj3d
.
animation
.
animationSet
;
var
relative
=
obj3d
.
animation
.
relative
;
var
relative
=
obj3d
.
animation
.
relative
;
var
anms
=
anmSet
.
animations
;
if
(
anmSet
.
flip
)
if
(
anmSet
.
flip
&&
!
anms
.
length
)
return
;
return
;
var
anms
=
anmSet
.
animations
;
var
dataList
=
anms
[
0
].
dataList
;
var
t_anm
=
[];
for
(
var
i
=
0
;
i
<
anms
.
length
;
i
++
)
{
var
dataList
=
anms
[
i
].
dataList
;
var
t_anm
=
[],
j
;
for
(
j
=
0
;
j
<
dataList
.
length
;
j
++
)
{
for
(
i
=
0
;
i
<
dataList
.
length
;
i
++
)
{
var
data
=
dataList
[
j
];
var
data
=
dataList
[
i
];
var
raw
=
dataList
[
j
].
data
;
var
raw
=
dataList
[
i
].
data
;
var
kind
=
data
.
kind
;
var
kind
=
data
.
kind
;
var
numFrames
=
raw
.
length
/
data
.
blockLength
;
var
numFrames
=
raw
.
length
/
data
.
blockLength
;
...
@@ -736,7 +773,6 @@ THREE.SEA3D.prototype.updateAnimationSet = function(obj3d) {
...
@@ -736,7 +773,6 @@ THREE.SEA3D.prototype.updateAnimationSet = function(obj3d) {
tar
.
remove
(
ct
);
tar
.
remove
(
ct
);
}
}
}
anmSet
.
flip
=
true
;
anmSet
.
flip
=
true
;
}
}
...
@@ -769,7 +805,9 @@ THREE.SEA3D.prototype.vectorToUV = function(list) {
...
@@ -769,7 +805,9 @@ THREE.SEA3D.prototype.vectorToUV = function(list) {
}
}
THREE
.
SEA3D
.
prototype
.
toVector3
=
function
(
data
)
{
THREE
.
SEA3D
.
prototype
.
toVector3
=
function
(
data
)
{
return
new
THREE
.
Vector3
(
data
.
x
,
data
.
y
,
data
.
z
);
return
new
THREE
.
Vector3
(
data
.
x
,
data
.
y
,
data
.
z
);
}
}
THREE
.
SEA3D
.
prototype
.
scaleColor
=
function
(
color
,
scale
)
{
THREE
.
SEA3D
.
prototype
.
scaleColor
=
function
(
color
,
scale
)
{
...
@@ -781,14 +819,17 @@ THREE.SEA3D.prototype.scaleColor = function(color, scale) {
...
@@ -781,14 +819,17 @@ THREE.SEA3D.prototype.scaleColor = function(color, scale) {
}
}
THREE
.
SEA3D
.
prototype
.
updateScene
=
function
()
{
THREE
.
SEA3D
.
prototype
.
updateScene
=
function
()
{
if
(
this
.
materials
!=
undefined
)
{
if
(
this
.
materials
!=
undefined
)
{
for
(
var
i
=
0
,
l
=
this
.
materials
.
length
;
i
<
l
;
++
i
)
{
for
(
var
i
=
0
,
l
=
this
.
materials
.
length
;
i
<
l
;
++
i
)
{
this
.
materials
[
i
].
needsUpdate
=
true
;
this
.
materials
[
i
].
needsUpdate
=
true
;
}
}
}
}
}
}
THREE
.
SEA3D
.
prototype
.
addSceneObject
=
function
(
sea
)
{
THREE
.
SEA3D
.
prototype
.
addSceneObject
=
function
(
sea
)
{
var
obj3d
=
sea
.
tag
;
var
obj3d
=
sea
.
tag
;
obj3d
.
props
=
sea
.
properties
;
obj3d
.
props
=
sea
.
properties
;
...
@@ -810,14 +851,19 @@ THREE.SEA3D.prototype.addSceneObject = function(sea) {
...
@@ -810,14 +851,19 @@ THREE.SEA3D.prototype.addSceneObject = function(sea) {
this
.
config
.
container
.
add
(
obj3d
);
this
.
config
.
container
.
add
(
obj3d
);
else
else
this
.
container
.
add
(
obj3d
);
this
.
container
.
add
(
obj3d
);
}
}
THREE
.
SEA3D
.
prototype
.
bufferToTexture
=
function
(
raw
)
{
THREE
.
SEA3D
.
prototype
.
bufferToTexture
=
function
(
raw
)
{
return
"
data:image/png;base64,
"
+
SEA3D
.
Stream
.
bufferToBase64
(
raw
);
return
"
data:image/png;base64,
"
+
SEA3D
.
Stream
.
bufferToBase64
(
raw
);
}
}
THREE
.
SEA3D
.
prototype
.
bufferToSound
=
function
(
raw
)
{
THREE
.
SEA3D
.
prototype
.
bufferToSound
=
function
(
raw
)
{
return
"
data:audio/mp3;base64,
"
+
SEA3D
.
Stream
.
bufferToBase64
(
raw
);
return
"
data:audio/mp3;base64,
"
+
SEA3D
.
Stream
.
bufferToBase64
(
raw
);
}
}
THREE
.
SEA3D
.
prototype
.
applyDefaultAnimation
=
function
(
sea
,
ANIMATOR_CLASS
)
{
THREE
.
SEA3D
.
prototype
.
applyDefaultAnimation
=
function
(
sea
,
ANIMATOR_CLASS
)
{
...
@@ -1431,7 +1477,7 @@ THREE.SEA3D.prototype.readLine = function(sea) {
...
@@ -1431,7 +1477,7 @@ THREE.SEA3D.prototype.readLine = function(sea) {
//
//
THREE
.
SEA3D
.
prototype
.
readContainer3D
=
function
(
sea
)
{
THREE
.
SEA3D
.
prototype
.
readContainer3D
=
function
(
sea
)
{
var
container
=
new
THREE
.
Object3D
();
var
container
=
new
THREE
.
SEA3D
.
Object3D
();
this
.
containers
=
this
.
containers
||
[];
this
.
containers
=
this
.
containers
||
[];
this
.
containers
.
push
(
this
.
objects
[
"
c3d/
"
+
sea
.
name
]
=
sea
.
tag
=
container
);
this
.
containers
.
push
(
this
.
objects
[
"
c3d/
"
+
sea
.
name
]
=
sea
.
tag
=
container
);
...
@@ -1542,14 +1588,16 @@ THREE.SEA3D.prototype.readMesh = function(sea) {
...
@@ -1542,14 +1588,16 @@ THREE.SEA3D.prototype.readMesh = function(sea) {
geo
.
morphTargets
=
this
.
getMorpher
(
morpher
,
sea
.
geometry
);
geo
.
morphTargets
=
this
.
getMorpher
(
morpher
,
sea
.
geometry
);
if
(
skeleton
)
{
if
(
skeleton
)
{
mesh
=
new
THREE
.
SkinnedMesh
(
geo
,
mat
,
false
);
mesh
=
new
THREE
.
S
EA3D
.
S
kinnedMesh
(
geo
,
mat
,
false
);
if
(
skeletonAnimation
)
{
if
(
skeletonAnimation
)
{
mesh
.
setAnimations
(
geo
.
animations
);
mesh
.
setAnimations
(
geo
.
animations
);
if
(
this
.
config
.
autoPlay
)
mesh
.
play
(
mesh
.
animations
[
0
].
name
);
if
(
this
.
config
.
autoPlay
)
mesh
.
play
(
mesh
.
animations
[
0
].
name
);
}
}
}
else
{
}
else
{
mesh
=
new
THREE
.
Mesh
(
geo
,
mat
);
mesh
=
new
THREE
.
SEA3D
.
Mesh
(
geo
,
mat
);
if
(
vtxAnm
)
if
(
vtxAnm
)
geo
.
morphTargets
=
this
.
getVertexAnimation
(
vtxAnm
);
geo
.
morphTargets
=
this
.
getVertexAnimation
(
vtxAnm
);
...
@@ -1574,13 +1622,21 @@ THREE.SEA3D.prototype.readMesh = function(sea) {
...
@@ -1574,13 +1622,21 @@ THREE.SEA3D.prototype.readMesh = function(sea) {
//
//
THREE
.
SEA3D
.
prototype
.
readSoundPoint
=
function
(
sea
)
{
THREE
.
SEA3D
.
prototype
.
readSoundPoint
=
function
(
sea
)
{
var
sound3d
=
new
THREE
.
Sound3D
(
sea
.
sound
.
tag
,
sea
.
volume
,
sea
.
distance
);
if
(
sea
.
autoPlay
)
{
if
(
!
this
.
audioListener
)
{
sound3d
.
loop
=
true
;
this
.
audioListener
=
new
THREE
.
AudioListener
()
;
sound3d
.
play
(
);
this
.
container
.
add
(
this
.
audioListener
);
}
}
var
sound3d
=
new
THREE
.
Audio
(
this
.
audioListener
);
sound3d
.
load
(
sea
.
sound
.
tag
);
sound3d
.
autoplay
=
sea
.
autoPlay
;
sound3d
.
setLoop
(
sea
.
autoPlay
);
sound3d
.
setVolume
(
sea
.
volume
);
sound3d
.
setRefDistance
(
sea
.
distance
);
sound3d
.
setRolloffFactor
(
this
.
config
.
audioRolloffFactor
);
sound3d
.
name
=
sea
.
name
;
sound3d
.
name
=
sea
.
name
;
this
.
sounds3d
=
this
.
sounds3d
||
[];
this
.
sounds3d
=
this
.
sounds3d
||
[];
...
@@ -1590,6 +1646,7 @@ THREE.SEA3D.prototype.readSoundPoint = function(sea) {
...
@@ -1590,6 +1646,7 @@ THREE.SEA3D.prototype.readSoundPoint = function(sea) {
this
.
updateTransform
(
sound3d
,
sea
);
this
.
updateTransform
(
sound3d
,
sea
);
this
.
applyDefaultAnimation
(
sea
,
THREE
.
SEA3D
.
Object3DAnimator
);
this
.
applyDefaultAnimation
(
sea
,
THREE
.
SEA3D
.
Object3DAnimator
);
}
}
//
//
...
@@ -1876,7 +1933,7 @@ THREE.SEA3D.prototype.materialTechnique =
...
@@ -1876,7 +1933,7 @@ THREE.SEA3D.prototype.materialTechnique =
})();
})();
THREE
.
SEA3D
.
prototype
.
readMaterial
=
function
(
sea
)
{
THREE
.
SEA3D
.
prototype
.
readMaterial
=
function
(
sea
)
{
var
mat
=
new
THREE
.
MeshPhongMaterial
();
var
mat
=
this
.
config
.
standardMaterial
?
new
THREE
.
SEA3D
.
StandardMaterial
()
:
new
THREE
.
MeshPhongMaterial
();
mat
.
emissiveToAmbientColor
=
this
.
config
.
ambientColor
;
mat
.
emissiveToAmbientColor
=
this
.
config
.
ambientColor
;
mat
.
name
=
sea
.
name
;
mat
.
name
=
sea
.
name
;
...
...
examples/models/sea3d/sound.sea
浏览文件 @
709f59de
无法预览此类型文件
examples/webgl_loader_sea3d.html
浏览文件 @
709f59de
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
<script
src=
"../build/three.min.js"
></script>
<script
src=
"../build/three.min.js"
></script>
<script
src=
"js/controls/
Trackball
Controls.js"
></script>
<script
src=
"js/controls/
Orbit
Controls.js"
></script>
<script
src=
"js/postprocessing/EffectComposer.js"
></script>
<script
src=
"js/postprocessing/EffectComposer.js"
></script>
<script
src=
"js/postprocessing/RenderPass.js"
></script>
<script
src=
"js/postprocessing/RenderPass.js"
></script>
...
@@ -101,13 +101,10 @@
...
@@ -101,13 +101,10 @@
container
=
document
.
createElement
(
'
div
'
);
container
=
document
.
createElement
(
'
div
'
);
document
.
body
.
appendChild
(
container
);
document
.
body
.
appendChild
(
container
);
camera
=
new
THREE
.
PerspectiveCamera
(
45
,
window
.
innerWidth
/
window
.
innerHeight
,
1
,
2
000
);
camera
=
new
THREE
.
PerspectiveCamera
(
45
,
window
.
innerWidth
/
window
.
innerHeight
,
1
,
10
000
);
camera
.
position
.
set
(
1000
,
-
300
,
1000
);
camera
.
position
.
set
(
1000
,
-
300
,
1000
);
controls
=
new
THREE
.
TrackballControls
(
camera
,
document
);
controls
=
new
THREE
.
OrbitControls
(
camera
);
controls
.
noZoom
=
true
;
controls
.
noPan
=
true
;
controls
.
dynamicDampingFactor
=
0.05
;
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
...
@@ -164,28 +161,30 @@
...
@@ -164,28 +161,30 @@
//
//
var
clock
=
new
THREE
.
Clock
();
function
animate
()
{
function
animate
()
{
var
delta
=
clock
.
getDelta
();
requestAnimationFrame
(
animate
);
requestAnimationFrame
(
animate
);
controls
.
update
();
// Update SEA3D Animations
THREE
.
SEA3D
.
AnimationHandler
.
update
(
delta
);
// Update Three.JS Animations
THREE
.
AnimationHandler
.
update
(
delta
);
render
();
render
(
delta
);
stats
.
update
();
stats
.
update
();
}
}
var
clock
=
new
THREE
.
Clock
();
function
render
(
dlt
)
{
function
render
()
{
var
delta
=
clock
.
getDelta
();
THREE
.
AnimationHandler
.
update
(
delta
);
//renderer.render( scene, camera );
//renderer.render( scene, camera );
composer
.
render
(
d
elta
);
composer
.
render
(
d
lt
);
}
}
...
...
examples/webgl_loader_sea3d_hierarchy.html
浏览文件 @
709f59de
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
<script
src=
"../build/three.min.js"
></script>
<script
src=
"../build/three.min.js"
></script>
<script
src=
"js/controls/
Trackball
Controls.js"
></script>
<script
src=
"js/controls/
Orbit
Controls.js"
></script>
<script
src=
"js/postprocessing/EffectComposer.js"
></script>
<script
src=
"js/postprocessing/EffectComposer.js"
></script>
<script
src=
"js/postprocessing/RenderPass.js"
></script>
<script
src=
"js/postprocessing/RenderPass.js"
></script>
...
@@ -113,7 +113,7 @@
...
@@ -113,7 +113,7 @@
camera
=
new
THREE
.
PerspectiveCamera
(
45
,
window
.
innerWidth
/
window
.
innerHeight
,
1
,
2000
);
camera
=
new
THREE
.
PerspectiveCamera
(
45
,
window
.
innerWidth
/
window
.
innerHeight
,
1
,
2000
);
camera
.
position
.
set
(
1000
,
-
300
,
1000
);
camera
.
position
.
set
(
1000
,
-
300
,
1000
);
controls
=
new
THREE
.
TrackballControls
(
camera
,
document
);
controls
=
new
THREE
.
OrbitControls
(
camera
);
controls
.
noZoom
=
true
;
controls
.
noZoom
=
true
;
controls
.
noPan
=
true
;
controls
.
noPan
=
true
;
controls
.
dynamicDampingFactor
=
0.05
;
controls
.
dynamicDampingFactor
=
0.05
;
...
@@ -169,31 +169,27 @@
...
@@ -169,31 +169,27 @@
//
//
var
clock
=
new
THREE
.
Clock
();
function
animate
()
{
function
animate
()
{
var
delta
=
clock
.
getDelta
();
requestAnimationFrame
(
animate
);
requestAnimationFrame
(
animate
);
controls
.
update
();
// Update SEA3D Animations
THREE
.
SEA3D
.
AnimationHandler
.
update
(
delta
);
render
();
render
(
delta
);
stats
.
update
();
stats
.
update
();
}
}
var
clock
=
new
THREE
.
Clock
();
function
render
(
dlt
)
{
function
render
()
{
var
delta
=
clock
.
getDelta
();
THREE
.
AnimationHandler
.
update
(
delta
);
// SEA3D Keyframe Update
SEA3D
.
AnimationHandler
.
update
(
delta
);
//renderer.render( scene, camera );
//renderer.render( scene, camera );
composer
.
render
(
d
elta
);
composer
.
render
(
d
lt
);
}
}
...
...
examples/webgl_loader_sea3d_keyframe.html
浏览文件 @
709f59de
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
<script
src=
"../build/three.min.js"
></script>
<script
src=
"../build/three.min.js"
></script>
<script
src=
"js/controls/
Trackball
Controls.js"
></script>
<script
src=
"js/controls/
Orbit
Controls.js"
></script>
<script
src=
"js/postprocessing/EffectComposer.js"
></script>
<script
src=
"js/postprocessing/EffectComposer.js"
></script>
<script
src=
"js/postprocessing/RenderPass.js"
></script>
<script
src=
"js/postprocessing/RenderPass.js"
></script>
...
@@ -148,10 +148,7 @@
...
@@ -148,10 +148,7 @@
camera
=
new
THREE
.
PerspectiveCamera
(
45
,
window
.
innerWidth
/
window
.
innerHeight
,
1
,
2000
);
camera
=
new
THREE
.
PerspectiveCamera
(
45
,
window
.
innerWidth
/
window
.
innerHeight
,
1
,
2000
);
camera
.
position
.
set
(
1000
,
-
300
,
1000
);
camera
.
position
.
set
(
1000
,
-
300
,
1000
);
controls
=
new
THREE
.
TrackballControls
(
camera
,
document
);
controls
=
new
THREE
.
OrbitControls
(
camera
);
controls
.
noZoom
=
true
;
controls
.
noPan
=
true
;
controls
.
dynamicDampingFactor
=
0.05
;
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
...
@@ -279,31 +276,29 @@
...
@@ -279,31 +276,29 @@
}
}
}
}
//
var
clock
=
new
THREE
.
Clock
();
function
animate
()
{
function
animate
()
{
var
delta
=
clock
.
getDelta
();
requestAnimationFrame
(
animate
);
requestAnimationFrame
(
animate
);
controls
.
update
();
// Update SEA3D Animations
THREE
.
SEA3D
.
AnimationHandler
.
update
(
delta
);
render
();
render
(
delta
);
stats
.
update
();
stats
.
update
();
}
}
var
clock
=
new
THREE
.
Clock
();
function
render
(
dlt
)
{
function
render
()
{
var
delta
=
clock
.
getDelta
();
THREE
.
AnimationHandler
.
update
(
delta
);
// SEA3D Keyframe Update
SEA3D
.
AnimationHandler
.
update
(
delta
);
//renderer.render( scene, camera );
//renderer.render( scene, camera );
composer
.
render
(
d
elta
);
composer
.
render
(
d
lt
);
}
}
...
...
examples/webgl_loader_sea3d_morph.html
0 → 100644
浏览文件 @
709f59de
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<title>
three.js webgl - sea3d / morph
</title>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
>
<style>
body
{
font-family
:
Monospace
;
background-color
:
#000
;
margin
:
0px
;
overflow
:
hidden
;
}
#info
{
color
:
#fff
;
position
:
absolute
;
top
:
10px
;
width
:
100%
;
text-align
:
center
;
z-index
:
100
;
display
:
block
;
}
a
{
color
:
white
}
</style>
</head>
<body>
<div
id=
"info"
>
<a
href=
"http://threejs.org"
target=
"_blank"
>
three.js
</a>
- model by
<a
href=
"https://github.com/sunag/sea3d"
style=
"color:#FFFFF"
target=
"_blank"
>
sea3d
</a>
</div>
<script
src=
"../build/three.min.js"
></script>
<script
src=
"js/controls/OrbitControls.js"
></script>
<script
src=
"js/postprocessing/EffectComposer.js"
></script>
<script
src=
"js/postprocessing/RenderPass.js"
></script>
<script
src=
"js/postprocessing/ShaderPass.js"
></script>
<script
src=
"js/postprocessing/MaskPass.js"
></script>
<script
src=
"js/shaders/CopyShader.js"
></script>
<script
src=
"js/shaders/ColorCorrectionShader.js"
></script>
<script
src=
"js/shaders/VignetteShader.js"
></script>
<script
src=
"js/loaders/sea3d/SEA3D.js"
></script>
<script
src=
"js/loaders/sea3d/SEA3DLZMA.js"
></script>
<script
src=
"js/loaders/sea3d/SEA3DLoader.js"
></script>
<script
src=
"js/Detector.js"
></script>
<script
src=
"js/libs/stats.min.js"
></script>
<script>
if
(
!
Detector
.
webgl
)
Detector
.
addGetWebGLMessage
();
var
container
,
stats
;
var
camera
,
scene
,
renderer
,
composer
,
controls
,
teapot
;
var
loader
;
// Initialize Three.JS
init
();
//
// SEA3D Loader
//
loader
=
new
THREE
.
SEA3D
(
{
autoPlay
:
true
,
// Auto play animations
container
:
scene
,
// Container to add models
parser
:
THREE
.
SEA3D
.
DEFAULT
,
// Auto choose THREE.BufferGeometry and THREE.Geometry
multiplier
:
1
// Light multiplier
}
);
loader
.
onComplete
=
function
(
e
)
{
// Get the first camera from 3ds Max
// use loader.get... to get others objects
var
cam
=
loader
.
cameras
[
0
];
camera
.
position
.
copy
(
cam
.
position
);
camera
.
rotation
.
copy
(
cam
.
rotation
);
// get mesh
teapot
=
loader
.
getMesh
(
"
Teapot01
"
);
// events
window
.
addEventListener
(
'
mousemove
'
,
onMouseMove
,
false
);
animate
();
};
loader
.
load
(
'
./models/sea3d/morph.sea
'
);
//
function
init
()
{
scene
=
new
THREE
.
Scene
();
container
=
document
.
createElement
(
'
div
'
);
document
.
body
.
appendChild
(
container
);
camera
=
new
THREE
.
PerspectiveCamera
(
45
,
window
.
innerWidth
/
window
.
innerHeight
,
1
,
2000
);
camera
.
position
.
set
(
1000
,
-
300
,
1000
);
controls
=
new
THREE
.
OrbitControls
(
camera
);
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
setClearColor
(
0x333333
,
1
);
container
.
appendChild
(
renderer
.
domElement
);
stats
=
new
Stats
();
stats
.
domElement
.
style
.
position
=
'
absolute
'
;
stats
.
domElement
.
style
.
top
=
'
0px
'
;
container
.
appendChild
(
stats
.
domElement
);
// post-processing
composer
=
new
THREE
.
EffectComposer
(
renderer
);
var
renderPass
=
new
THREE
.
RenderPass
(
scene
,
camera
);
var
copyPass
=
new
THREE
.
ShaderPass
(
THREE
.
CopyShader
);
composer
.
addPass
(
renderPass
);
var
vh
=
1.4
,
vl
=
1.2
;
var
colorCorrectionPass
=
new
THREE
.
ShaderPass
(
THREE
.
ColorCorrectionShader
);
colorCorrectionPass
.
uniforms
[
"
powRGB
"
].
value
=
new
THREE
.
Vector3
(
vh
,
vh
,
vh
);
colorCorrectionPass
.
uniforms
[
"
mulRGB
"
].
value
=
new
THREE
.
Vector3
(
vl
,
vl
,
vl
);
composer
.
addPass
(
colorCorrectionPass
);
var
vignettePass
=
new
THREE
.
ShaderPass
(
THREE
.
VignetteShader
);
vignettePass
.
uniforms
[
"
darkness
"
].
value
=
1.0
;
composer
.
addPass
(
vignettePass
);
composer
.
addPass
(
copyPass
);
copyPass
.
renderToScreen
=
true
;
// extra lights
scene
.
add
(
new
THREE
.
AmbientLight
(
0x333333
)
);
// events
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onMouseMove
(
e
)
{
var
mouseX
=
e
.
clientX
,
mouseY
=
e
.
clientY
;
// 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
);
}
function
onWindowResize
()
{
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
//
var
clock
=
new
THREE
.
Clock
();
function
animate
()
{
var
delta
=
clock
.
getDelta
();
requestAnimationFrame
(
animate
);
render
(
delta
);
stats
.
update
();
}
function
render
(
dlt
)
{
//renderer.render( scene, camera );
composer
.
render
(
dlt
);
}
</script>
</body>
</html>
examples/webgl_loader_sea3d_skinning.html
浏览文件 @
709f59de
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
<script
src=
"../build/three.min.js"
></script>
<script
src=
"../build/three.min.js"
></script>
<script
src=
"js/controls/
Trackball
Controls.js"
></script>
<script
src=
"js/controls/
Orbit
Controls.js"
></script>
<script
src=
"js/postprocessing/EffectComposer.js"
></script>
<script
src=
"js/postprocessing/EffectComposer.js"
></script>
<script
src=
"js/postprocessing/RenderPass.js"
></script>
<script
src=
"js/postprocessing/RenderPass.js"
></script>
...
@@ -90,6 +90,7 @@
...
@@ -90,6 +90,7 @@
// get meshes
// get meshes
player
=
loader
.
getMesh
(
"
Player
"
);
player
=
loader
.
getMesh
(
"
Player
"
);
hat
=
loader
.
getMesh
(
"
Hat
"
);
hat
=
loader
.
getMesh
(
"
Hat
"
);
// events
// events
...
@@ -115,10 +116,7 @@
...
@@ -115,10 +116,7 @@
camera
=
new
THREE
.
PerspectiveCamera
(
45
,
window
.
innerWidth
/
window
.
innerHeight
,
1
,
2000
);
camera
=
new
THREE
.
PerspectiveCamera
(
45
,
window
.
innerWidth
/
window
.
innerHeight
,
1
,
2000
);
camera
.
position
.
set
(
1000
,
-
300
,
1000
);
camera
.
position
.
set
(
1000
,
-
300
,
1000
);
controls
=
new
THREE
.
TrackballControls
(
camera
,
document
);
controls
=
new
THREE
.
OrbitControls
(
camera
);
controls
.
noZoom
=
true
;
controls
.
noPan
=
true
;
controls
.
dynamicDampingFactor
=
0.05
;
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
...
@@ -195,28 +193,30 @@
...
@@ -195,28 +193,30 @@
//
//
var
clock
=
new
THREE
.
Clock
();
function
animate
()
{
function
animate
()
{
var
delta
=
clock
.
getDelta
();
requestAnimationFrame
(
animate
);
requestAnimationFrame
(
animate
);
controls
.
update
();
// Update SEA3D Animations
THREE
.
SEA3D
.
AnimationHandler
.
update
(
delta
);
// Update Three.JS Animations
THREE
.
AnimationHandler
.
update
(
delta
);
render
();
render
(
delta
);
stats
.
update
();
stats
.
update
();
}
}
var
clock
=
new
THREE
.
Clock
();
function
render
(
dlt
)
{
function
render
()
{
var
delta
=
clock
.
getDelta
();
THREE
.
AnimationHandler
.
update
(
delta
);
//renderer.render( scene, camera );
//renderer.render( scene, camera );
composer
.
render
(
d
elta
);
composer
.
render
(
d
lt
);
}
}
...
...
examples/webgl_loader_sea3d_sound.html
浏览文件 @
709f59de
...
@@ -103,7 +103,7 @@
...
@@ -103,7 +103,7 @@
if
(
!
Detector
.
webgl
)
Detector
.
addGetWebGLMessage
();
if
(
!
Detector
.
webgl
)
Detector
.
addGetWebGLMessage
();
var
container
,
stats
;
var
container
,
raycaster
,
stats
;
var
camera
,
scene
,
renderer
,
composer
,
controls
,
velocity
;
var
camera
,
scene
,
renderer
,
composer
,
controls
,
velocity
;
var
blocker
,
instructions
;
var
blocker
,
instructions
;
...
@@ -112,6 +112,8 @@
...
@@ -112,6 +112,8 @@
initKeyDown
initKeyDown
var
loader
;
var
loader
;
var
audioListener
,
soundFilter
;
var
soundArea
,
collisionArea
;
// Initialize Three.JS
// Initialize Three.JS
...
@@ -134,6 +136,16 @@
...
@@ -134,6 +136,16 @@
loader
.
onComplete
=
function
(
e
)
{
loader
.
onComplete
=
function
(
e
)
{
audioListener
=
loader
.
audioListener
;
soundFilter
=
audioListener
.
context
.
createBiquadFilter
();
soundFilter
.
type
=
'
lowpass
'
;
soundFilter
.
Q
.
value
=
10
;
soundFilter
.
frequency
.
value
=
440
;
soundArea
=
loader
.
getSound3D
(
"
Point002
"
);
collisionArea
=
loader
.
getMesh
(
"
Torus003
"
);
animate
();
animate
();
};
};
...
@@ -302,6 +314,8 @@
...
@@ -302,6 +314,8 @@
function
init
()
{
function
init
()
{
raycaster
=
new
THREE
.
Raycaster
();
scene
=
new
THREE
.
Scene
();
scene
=
new
THREE
.
Scene
();
velocity
=
new
THREE
.
Vector3
();
velocity
=
new
THREE
.
Vector3
();
...
@@ -387,12 +401,50 @@
...
@@ -387,12 +401,50 @@
}
}
var
clock
=
new
THREE
.
Clock
();
var
audioPos
=
new
THREE
.
Vector3
();
var
audioRot
=
new
THREE
.
Euler
();
function
updateSoundFilter
(
collision
,
sound3d
)
{
// difference position between sound and listener
var
difPos
=
new
THREE
.
Vector3
().
setFromMatrixPosition
(
sound3d
.
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
(
[
collision
]
).
length
)
{
if
(
sound3d
.
getFilter
()
!==
soundFilter
)
sound3d
.
setFilter
(
soundFilter
);
}
else
if
(
sound3d
.
getFilter
()
!==
undefined
)
{
sound3d
.
setFilter
();
}
}
//
function
animate
()
{
function
animate
()
{
var
delta
=
clock
.
getDelta
();
var
delta
=
clock
.
getDelta
();
animateCamera
(
delta
);
animateCamera
(
delta
);
// Sound3D Spatial Transform Update
loader
.
audioListener
.
position
.
copy
(
audioPos
.
setFromMatrixPosition
(
camera
.
matrixWorld
)
);
loader
.
audioListener
.
rotation
.
copy
(
audioRot
.
setFromRotationMatrix
(
camera
.
matrixWorld
)
);
// Update sound filter from raycaster intersecting
updateSoundFilter
(
collisionArea
,
soundArea
);
// Update SEA3D Animations
THREE
.
SEA3D
.
AnimationHandler
.
update
(
delta
);
render
(
delta
);
render
(
delta
);
stats
.
update
();
stats
.
update
();
...
@@ -401,18 +453,8 @@
...
@@ -401,18 +453,8 @@
}
}
var
clock
=
new
THREE
.
Clock
();
function
render
(
delta
)
{
function
render
(
delta
)
{
THREE
.
AnimationHandler
.
update
(
delta
);
// SEA3D Keyframe Update
SEA3D
.
AnimationHandler
.
update
(
delta
);
// Sound Update
THREE
.
Sound3D
.
update
(
camera
);
//renderer.render( scene, camera );
//renderer.render( scene, camera );
composer
.
render
(
delta
);
composer
.
render
(
delta
);
...
...
src/extras/audio/Audio.js
浏览文件 @
709f59de
...
@@ -21,6 +21,7 @@ THREE.Audio = function ( listener ) {
...
@@ -21,6 +21,7 @@ THREE.Audio = function ( listener ) {
this
.
autoplay
=
false
;
this
.
autoplay
=
false
;
this
.
startTime
=
0
;
this
.
startTime
=
0
;
this
.
playbackRate
=
1
;
this
.
isPlaying
=
false
;
this
.
isPlaying
=
false
;
};
};
...
@@ -66,13 +67,15 @@ THREE.Audio.prototype.play = function () {
...
@@ -66,13 +67,15 @@ THREE.Audio.prototype.play = function () {
source
.
buffer
=
this
.
source
.
buffer
;
source
.
buffer
=
this
.
source
.
buffer
;
source
.
loop
=
this
.
source
.
loop
;
source
.
loop
=
this
.
source
.
loop
;
source
.
onended
=
this
.
source
.
onended
;
source
.
onended
=
this
.
source
.
onended
;
source
.
connect
(
this
.
panner
);
source
.
start
(
0
,
this
.
startTime
);
source
.
start
(
0
,
this
.
startTime
);
source
.
playbackRate
.
value
=
this
.
playbackRate
;
this
.
isPlaying
=
true
;
this
.
isPlaying
=
true
;
this
.
source
=
source
;
this
.
source
=
source
;
this
.
connect
();
};
};
THREE
.
Audio
.
prototype
.
pause
=
function
()
{
THREE
.
Audio
.
prototype
.
pause
=
function
()
{
...
@@ -89,6 +92,72 @@ THREE.Audio.prototype.stop = function () {
...
@@ -89,6 +92,72 @@ THREE.Audio.prototype.stop = function () {
};
};
THREE
.
Audio
.
prototype
.
connect
=
function
()
{
if
(
this
.
filter
!==
undefined
)
{
this
.
source
.
connect
(
this
.
filter
);
this
.
filter
.
connect
(
this
.
panner
);
}
else
{
this
.
source
.
connect
(
this
.
panner
);
}
};
THREE
.
Audio
.
prototype
.
disconnect
=
function
()
{
if
(
this
.
filter
!==
undefined
)
{
this
.
source
.
disconnect
(
this
.
filter
);
this
.
filter
.
disconnect
(
this
.
panner
);
}
else
{
this
.
source
.
disconnect
(
this
.
panner
);
}
};
THREE
.
Audio
.
prototype
.
setFilter
=
function
(
value
)
{
if
(
this
.
isPlaying
)
{
this
.
disconnect
();
this
.
filter
=
value
;
this
.
connect
();
}
else
{
this
.
filter
=
value
;
}
};
THREE
.
Audio
.
prototype
.
getFilter
=
function
()
{
return
this
.
filter
;
};
THREE
.
Audio
.
prototype
.
setPlaybackRate
=
function
(
value
)
{
this
.
playbackRate
=
value
;
if
(
this
.
isPlaying
)
source
.
playbackRate
.
value
=
this
.
playbackRate
;
};
THREE
.
Audio
.
prototype
.
getPlaybackRate
=
function
()
{
return
this
.
playbackRate
;
};
THREE
.
Audio
.
prototype
.
onEnded
=
function
()
{
THREE
.
Audio
.
prototype
.
onEnded
=
function
()
{
this
.
isPlaying
=
false
;
this
.
isPlaying
=
false
;
...
@@ -101,24 +170,48 @@ THREE.Audio.prototype.setLoop = function ( value ) {
...
@@ -101,24 +170,48 @@ THREE.Audio.prototype.setLoop = function ( value ) {
};
};
THREE
.
Audio
.
prototype
.
getLoop
=
function
()
{
return
this
.
source
.
loop
;
};
THREE
.
Audio
.
prototype
.
setRefDistance
=
function
(
value
)
{
THREE
.
Audio
.
prototype
.
setRefDistance
=
function
(
value
)
{
this
.
panner
.
refDistance
=
value
;
this
.
panner
.
refDistance
=
value
;
};
};
THREE
.
Audio
.
prototype
.
getRefDistance
=
function
()
{
return
this
.
panner
.
refDistance
;
};
THREE
.
Audio
.
prototype
.
setRolloffFactor
=
function
(
value
)
{
THREE
.
Audio
.
prototype
.
setRolloffFactor
=
function
(
value
)
{
this
.
panner
.
rolloffFactor
=
value
;
this
.
panner
.
rolloffFactor
=
value
;
};
};
THREE
.
Audio
.
prototype
.
getRolloffFactor
=
function
()
{
return
this
.
panner
.
rolloffFactor
;
};
THREE
.
Audio
.
prototype
.
setVolume
=
function
(
value
)
{
THREE
.
Audio
.
prototype
.
setVolume
=
function
(
value
)
{
this
.
gain
.
gain
.
value
=
value
;
this
.
gain
.
gain
.
value
=
value
;
};
};
THREE
.
Audio
.
prototype
.
getVolume
=
function
()
{
return
this
.
gain
.
gain
.
value
;
};
THREE
.
Audio
.
prototype
.
updateMatrixWorld
=
(
function
()
{
THREE
.
Audio
.
prototype
.
updateMatrixWorld
=
(
function
()
{
var
position
=
new
THREE
.
Vector3
();
var
position
=
new
THREE
.
Vector3
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录