Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
246be612
T
three.js
项目概览
Ablesons
/
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,发现更多精彩内容 >>
提交
246be612
编写于
5月 07, 2016
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
*Audio: Implemented Object.assign(). See #8838.
上级
c4476ed5
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
215 addition
and
208 deletion
+215
-208
src/audio/Audio.js
src/audio/Audio.js
+122
-119
src/audio/AudioAnalyser.js
src/audio/AudioAnalyser.js
+2
-4
src/audio/AudioListener.js
src/audio/AudioListener.js
+50
-48
src/audio/PositionalAudio.js
src/audio/PositionalAudio.js
+41
-37
未找到文件。
src/audio/Audio.js
浏览文件 @
246be612
...
...
@@ -28,218 +28,221 @@ THREE.Audio = function ( listener ) {
};
THREE
.
Audio
.
prototype
=
Object
.
create
(
THREE
.
Object3D
.
prototype
);
THREE
.
Audio
.
prototype
.
constructor
=
THREE
.
Audio
;
THREE
.
Audio
.
prototype
=
Object
.
assign
(
Object
.
create
(
THREE
.
Object3D
.
prototype
),
{
THREE
.
Audio
.
prototype
.
getOutput
=
function
()
{
constructor
:
THREE
.
Audio
,
return
this
.
gain
;
getOutput
:
function
()
{
}
;
return
this
.
gain
;
THREE
.
Audio
.
prototype
.
setNodeSource
=
function
(
audioNode
)
{
},
this
.
hasPlaybackControl
=
false
;
this
.
sourceType
=
'
audioNode
'
;
this
.
source
=
audioNode
;
this
.
connect
();
setNodeSource
:
function
(
audioNode
)
{
return
this
;
this
.
hasPlaybackControl
=
false
;
this
.
sourceType
=
'
audioNode
'
;
this
.
source
=
audioNode
;
this
.
connect
();
}
;
return
this
;
THREE
.
Audio
.
prototype
.
setBuffer
=
function
(
audioBuffer
)
{
},
var
scope
=
this
;
setBuffer
:
function
(
audioBuffer
)
{
scope
.
source
.
buffer
=
audioBuffer
;
scope
.
sourceType
=
'
buffer
'
;
if
(
scope
.
autoplay
)
scope
.
play
();
var
scope
=
this
;
return
this
;
scope
.
source
.
buffer
=
audioBuffer
;
scope
.
sourceType
=
'
buffer
'
;
if
(
scope
.
autoplay
)
scope
.
play
();
}
;
return
this
;
THREE
.
Audio
.
prototype
.
play
=
function
()
{
},
if
(
this
.
isPlaying
===
true
)
{
play
:
function
(
)
{
console
.
warn
(
'
THREE.Audio: Audio is already playing.
'
);
return
;
if
(
this
.
isPlaying
===
true
)
{
}
console
.
warn
(
'
THREE.Audio: Audio is already playing.
'
);
return
;
if
(
this
.
hasPlaybackControl
===
false
)
{
}
console
.
warn
(
'
THREE.Audio: this Audio has no playback control.
'
);
return
;
if
(
this
.
hasPlaybackControl
===
false
)
{
}
console
.
warn
(
'
THREE.Audio: this Audio has no playback control.
'
);
return
;
var
source
=
this
.
context
.
createBufferSource
();
}
source
.
buffer
=
this
.
source
.
buffer
;
source
.
loop
=
this
.
source
.
loop
;
source
.
onended
=
this
.
source
.
onended
;
source
.
start
(
0
,
this
.
startTime
);
source
.
playbackRate
.
value
=
this
.
playbackRate
;
var
source
=
this
.
context
.
createBufferSource
();
this
.
isPlaying
=
true
;
source
.
buffer
=
this
.
source
.
buffer
;
source
.
loop
=
this
.
source
.
loop
;
source
.
onended
=
this
.
source
.
onended
;
source
.
start
(
0
,
this
.
startTime
);
source
.
playbackRate
.
value
=
this
.
playbackRate
;
this
.
source
=
sourc
e
;
this
.
isPlaying
=
tru
e
;
this
.
connect
()
;
this
.
source
=
source
;
}
;
this
.
connect
()
;
THREE
.
Audio
.
prototype
.
pause
=
function
()
{
},
if
(
this
.
hasPlaybackControl
===
false
)
{
pause
:
function
(
)
{
console
.
warn
(
'
THREE.Audio: this Audio has no playback control.
'
);
return
;
if
(
this
.
hasPlaybackControl
===
false
)
{
}
console
.
warn
(
'
THREE.Audio: this Audio has no playback control.
'
);
return
;
this
.
source
.
stop
();
this
.
startTime
=
this
.
context
.
currentTime
;
}
};
this
.
source
.
stop
();
this
.
startTime
=
this
.
context
.
currentTime
;
THREE
.
Audio
.
prototype
.
stop
=
function
()
{
},
if
(
this
.
hasPlaybackControl
===
false
)
{
stop
:
function
(
)
{
console
.
warn
(
'
THREE.Audio: this Audio has no playback control.
'
);
return
;
if
(
this
.
hasPlaybackControl
===
false
)
{
}
console
.
warn
(
'
THREE.Audio: this Audio has no playback control.
'
);
return
;
this
.
source
.
stop
();
this
.
startTime
=
0
;
}
};
this
.
source
.
stop
();
this
.
startTime
=
0
;
THREE
.
Audio
.
prototype
.
connect
=
function
()
{
},
if
(
this
.
filter
!==
null
)
{
connect
:
function
(
)
{
this
.
source
.
connect
(
this
.
filter
);
this
.
filter
.
connect
(
this
.
getOutput
()
);
if
(
this
.
filter
!==
null
)
{
}
else
{
this
.
source
.
connect
(
this
.
filter
);
this
.
filter
.
connect
(
this
.
getOutput
()
);
this
.
source
.
connect
(
this
.
getOutput
()
);
}
else
{
}
this
.
source
.
connect
(
this
.
getOutput
()
);
};
}
THREE
.
Audio
.
prototype
.
disconnect
=
function
()
{
},
if
(
this
.
filter
!==
null
)
{
disconnect
:
function
(
)
{
this
.
source
.
disconnect
(
this
.
filter
);
this
.
filter
.
disconnect
(
this
.
getOutput
()
);
if
(
this
.
filter
!==
null
)
{
}
else
{
this
.
source
.
disconnect
(
this
.
filter
);
this
.
filter
.
disconnect
(
this
.
getOutput
()
);
this
.
source
.
disconnect
(
this
.
getOutput
()
);
}
else
{
}
this
.
source
.
disconnect
(
this
.
getOutput
()
);
};
}
THREE
.
Audio
.
prototype
.
getFilter
=
function
()
{
},
return
this
.
filter
;
getFilter
:
function
()
{
}
;
return
this
.
filter
;
THREE
.
Audio
.
prototype
.
setFilter
=
function
(
value
)
{
},
if
(
value
===
undefined
)
value
=
null
;
setFilter
:
function
(
value
)
{
if
(
this
.
isPlaying
===
true
)
{
if
(
value
===
undefined
)
value
=
null
;
this
.
disconnect
();
this
.
filter
=
value
;
this
.
connect
();
if
(
this
.
isPlaying
===
true
)
{
}
else
{
this
.
disconnect
();
this
.
filter
=
value
;
this
.
connect
();
this
.
filter
=
value
;
}
else
{
}
this
.
filter
=
value
;
};
}
THREE
.
Audio
.
prototype
.
setPlaybackRate
=
function
(
value
)
{
},
if
(
this
.
hasPlaybackControl
===
fals
e
)
{
setPlaybackRate
:
function
(
valu
e
)
{
console
.
warn
(
'
THREE.Audio: this Audio has no playback control.
'
);
return
;
if
(
this
.
hasPlaybackControl
===
false
)
{
}
console
.
warn
(
'
THREE.Audio: this Audio has no playback control.
'
);
return
;
this
.
playbackRate
=
value
;
}
if
(
this
.
isPlaying
===
true
)
{
this
.
playbackRate
=
value
;
this
.
source
.
playbackRate
.
value
=
this
.
playbackRate
;
if
(
this
.
isPlaying
===
true
)
{
}
this
.
source
.
playbackRate
.
value
=
this
.
playbackRate
;
};
}
THREE
.
Audio
.
prototype
.
getPlaybackRate
=
function
()
{
},
return
this
.
playbackRate
;
getPlaybackRate
:
function
()
{
}
;
return
this
.
playbackRate
;
THREE
.
Audio
.
prototype
.
onEnded
=
function
()
{
},
this
.
isPlaying
=
false
;
onEnded
:
function
()
{
}
;
this
.
isPlaying
=
false
;
THREE
.
Audio
.
prototype
.
setLoop
=
function
(
value
)
{
},
if
(
this
.
hasPlaybackControl
===
false
)
{
getLoop
:
function
(
)
{
console
.
warn
(
'
THREE.Audio: this Audio has no playback control.
'
);
return
;
if
(
this
.
hasPlaybackControl
===
false
)
{
}
console
.
warn
(
'
THREE.Audio: this Audio has no playback control.
'
);
return
false
;
this
.
source
.
loop
=
value
;
}
}
;
return
this
.
source
.
loop
;
THREE
.
Audio
.
prototype
.
getLoop
=
function
()
{
},
if
(
this
.
hasPlaybackControl
===
fals
e
)
{
setLoop
:
function
(
valu
e
)
{
console
.
warn
(
'
THREE.Audio: this Audio has no playback control.
'
);
return
false
;
if
(
this
.
hasPlaybackControl
===
false
)
{
}
console
.
warn
(
'
THREE.Audio: this Audio has no playback control.
'
);
return
;
return
this
.
source
.
loop
;
}
}
;
this
.
source
.
loop
=
value
;
},
THREE
.
Audio
.
prototype
.
setVolume
=
function
(
value
)
{
getVolume
:
function
(
)
{
this
.
gain
.
gain
.
value
=
value
;
return
this
.
gain
.
gain
.
value
;
};
},
THREE
.
Audio
.
prototype
.
getVolume
=
function
()
{
return
this
.
gain
.
gain
.
value
;
setVolume
:
function
(
value
)
{
};
this
.
gain
.
gain
.
value
=
value
;
}
}
);
src/audio/AudioAnalyser.js
浏览文件 @
246be612
...
...
@@ -13,9 +13,7 @@ THREE.AudioAnalyser = function ( audio, fftSize ) {
};
THREE
.
AudioAnalyser
.
prototype
=
{
constructor
:
THREE
.
AudioAnalyser
,
Object
.
assign
(
THREE
.
AudioAnalyser
.
prototype
,
{
getData
:
function
()
{
...
...
@@ -24,4 +22,4 @@ THREE.AudioAnalyser.prototype = {
}
};
}
)
;
src/audio/AudioListener.js
浏览文件 @
246be612
...
...
@@ -17,88 +17,90 @@ THREE.AudioListener = function () {
};
THREE
.
AudioListener
.
prototype
=
Object
.
create
(
THREE
.
Object3D
.
prototype
);
THREE
.
AudioListener
.
prototype
.
constructor
=
THREE
.
AudioListener
;
THREE
.
AudioListener
.
prototype
=
Object
.
assign
(
Object
.
create
(
THREE
.
Object3D
.
prototype
),
{
THREE
.
AudioListener
.
prototype
.
getInput
=
function
()
{
constructor
:
THREE
.
AudioListener
,
return
this
.
gain
;
getInput
:
function
()
{
}
;
return
this
.
gain
;
THREE
.
AudioListener
.
prototype
.
removeFilter
=
function
(
)
{
},
if
(
this
.
filter
!==
null
)
{
removeFilter
:
function
(
)
{
this
.
gain
.
disconnect
(
this
.
filter
);
this
.
filter
.
disconnect
(
this
.
context
.
destination
);
this
.
gain
.
connect
(
this
.
context
.
destination
);
this
.
filter
=
null
;
if
(
this
.
filter
!==
null
)
{
}
this
.
gain
.
disconnect
(
this
.
filter
);
this
.
filter
.
disconnect
(
this
.
context
.
destination
);
this
.
gain
.
connect
(
this
.
context
.
destination
);
this
.
filter
=
null
;
};
}
THREE
.
AudioListener
.
prototype
.
setFilter
=
function
(
value
)
{
},
if
(
this
.
filter
!==
null
)
{
getFilter
:
function
(
)
{
this
.
gain
.
disconnect
(
this
.
filter
);
this
.
filter
.
disconnect
(
this
.
context
.
destination
);
return
this
.
filter
;
}
else
{
}
,
this
.
gain
.
disconnect
(
this
.
context
.
destination
);
setFilter
:
function
(
value
)
{
}
if
(
this
.
filter
!==
null
)
{
this
.
filter
=
value
;
this
.
gain
.
connect
(
this
.
filter
);
this
.
filter
.
connect
(
this
.
context
.
destination
);
this
.
gain
.
disconnect
(
this
.
filter
);
this
.
filter
.
disconnect
(
this
.
context
.
destination
);
};
}
else
{
THREE
.
AudioListener
.
prototype
.
getFilter
=
function
()
{
this
.
gain
.
disconnect
(
this
.
context
.
destination
);
return
this
.
filter
;
}
};
this
.
filter
=
value
;
this
.
gain
.
connect
(
this
.
filter
);
this
.
filter
.
connect
(
this
.
context
.
destination
);
THREE
.
AudioListener
.
prototype
.
setMasterVolume
=
function
(
value
)
{
},
this
.
gain
.
gain
.
value
=
value
;
getMasterVolume
:
function
()
{
}
;
return
this
.
gain
.
gain
.
value
;
THREE
.
AudioListener
.
prototype
.
getMasterVolume
=
function
()
{
},
return
this
.
gain
.
gain
.
value
;
setMasterVolume
:
function
(
value
)
{
};
this
.
gain
.
gain
.
value
=
value
;
},
updateMatrixWorld
:
(
function
()
{
THREE
.
AudioListener
.
prototype
.
updateMatrixWorld
=
(
function
()
{
var
position
=
new
THREE
.
Vector3
();
var
quaternion
=
new
THREE
.
Quaternion
();
var
scale
=
new
THREE
.
Vector3
();
var
position
=
new
THREE
.
Vector3
();
var
quaternion
=
new
THREE
.
Quaternion
();
var
scale
=
new
THREE
.
Vector3
();
var
orientation
=
new
THREE
.
Vector3
();
var
orientation
=
new
THREE
.
Vector3
();
return
function
updateMatrixWorld
(
force
)
{
return
function
updateMatrixWorld
(
force
)
{
THREE
.
Object3D
.
prototype
.
updateMatrixWorld
.
call
(
this
,
force
);
THREE
.
Object3D
.
prototype
.
updateMatrixWorld
.
call
(
this
,
force
);
var
listener
=
this
.
context
.
listener
;
var
up
=
this
.
up
;
var
listener
=
this
.
context
.
listener
;
var
up
=
this
.
up
;
this
.
matrixWorld
.
decompose
(
position
,
quaternion
,
scale
);
this
.
matrixWorld
.
decompose
(
position
,
quaternion
,
scale
);
orientation
.
set
(
0
,
0
,
-
1
).
applyQuaternion
(
quaternion
);
orientation
.
set
(
0
,
0
,
-
1
).
applyQuaternion
(
quaternion
);
listener
.
setPosition
(
position
.
x
,
position
.
y
,
position
.
z
);
listener
.
setOrientation
(
orientation
.
x
,
orientation
.
y
,
orientation
.
z
,
up
.
x
,
up
.
y
,
up
.
z
);
listener
.
setPosition
(
position
.
x
,
position
.
y
,
position
.
z
);
listener
.
setOrientation
(
orientation
.
x
,
orientation
.
y
,
orientation
.
z
,
up
.
x
,
up
.
y
,
up
.
z
);
};
}
;
}
)()
}
)
()
;
}
);
src/audio/PositionalAudio.js
浏览文件 @
246be612
...
...
@@ -11,75 +11,79 @@ THREE.PositionalAudio = function ( listener ) {
};
THREE
.
PositionalAudio
.
prototype
=
Object
.
create
(
THREE
.
Audio
.
prototype
);
THREE
.
PositionalAudio
.
prototype
.
constructor
=
THREE
.
PositionalAudio
;
THREE
.
PositionalAudio
.
prototype
=
Object
.
assign
(
Object
.
create
(
THREE
.
Audio
.
prototype
),
{
THREE
.
PositionalAudio
.
prototype
.
getOutput
=
function
()
{
constructor
:
THREE
.
PositionalAudio
,
return
this
.
panner
;
getOutput
:
function
()
{
}
;
return
this
.
panner
;
THREE
.
PositionalAudio
.
prototype
.
setRefDistance
=
function
(
value
)
{
},
this
.
panner
.
refDistance
=
value
;
getRefDistance
:
function
()
{
}
;
return
this
.
panner
.
refDistance
;
THREE
.
PositionalAudio
.
prototype
.
getRefDistance
=
function
()
{
},
return
this
.
panner
.
refDistance
;
setRefDistance
:
function
(
value
)
{
}
;
this
.
panner
.
refDistance
=
value
;
THREE
.
PositionalAudio
.
prototype
.
setRolloffFactor
=
function
(
value
)
{
},
this
.
panner
.
rolloffFactor
=
value
;
getRolloffFactor
:
function
()
{
}
;
return
this
.
panner
.
rolloffFactor
;
THREE
.
PositionalAudio
.
prototype
.
getRolloffFactor
=
function
()
{
},
return
this
.
panner
.
rolloffFactor
;
setRolloffFactor
:
function
(
value
)
{
}
;
this
.
panner
.
rolloffFactor
=
value
;
THREE
.
PositionalAudio
.
prototype
.
setDistanceModel
=
function
(
value
)
{
},
this
.
panner
.
distanceModel
=
value
;
getDistanceModel
:
function
()
{
}
;
return
this
.
panner
.
distanceModel
;
THREE
.
PositionalAudio
.
prototype
.
getDistanceModel
=
function
()
{
},
return
this
.
panner
.
distanceModel
;
setDistanceModel
:
function
(
value
)
{
}
;
this
.
panner
.
distanceModel
=
value
;
THREE
.
PositionalAudio
.
prototype
.
setMaxDistance
=
function
(
value
)
{
},
this
.
panner
.
maxDistance
=
value
;
getMaxDistance
:
function
()
{
}
;
return
this
.
panner
.
maxDistance
;
THREE
.
PositionalAudio
.
prototype
.
getMaxDistance
=
function
()
{
},
return
this
.
panner
.
maxDistance
;
setMaxDistance
:
function
(
value
)
{
};
this
.
panner
.
maxDistance
=
value
;
},
updateMatrixWorld
:
(
function
()
{
var
position
=
new
THREE
.
Vector3
();
THREE
.
PositionalAudio
.
prototype
.
updateMatrixWorld
=
(
function
(
)
{
return
function
updateMatrixWorld
(
force
)
{
var
position
=
new
THREE
.
Vector3
(
);
THREE
.
Object3D
.
prototype
.
updateMatrixWorld
.
call
(
this
,
force
);
return
function
updateMatrixWorld
(
force
)
{
position
.
setFromMatrixPosition
(
this
.
matrixWorld
);
THREE
.
Object3D
.
prototype
.
updateMatrixWorld
.
call
(
this
,
force
);
this
.
panner
.
setPosition
(
position
.
x
,
position
.
y
,
position
.
z
);
position
.
setFromMatrixPosition
(
this
.
matrixWorld
)
;
}
;
this
.
panner
.
setPosition
(
position
.
x
,
position
.
y
,
position
.
z
);
}
)()
};
}
)
()
;
}
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录