Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
b54b8ead
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,发现更多精彩内容 >>
提交
b54b8ead
编写于
12月 27, 2011
作者:
A
alteredq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds.
上级
0055c902
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
8 addition
and
8 deletion
+8
-8
build/Three.js
build/Three.js
+4
-4
build/custom/ThreeExtras.js
build/custom/ThreeExtras.js
+4
-4
未找到文件。
build/Three.js
浏览文件 @
b54b8ead
...
...
@@ -468,10 +468,10 @@ THREE.FirstPersonControls=function(a,b){function c(a,b){return function(){b.appl
0
;
this
.
mouseDragOn
=
this
.
freeze
=
this
.
moveRight
=
this
.
moveLeft
=
this
.
moveBackward
=
this
.
moveForward
=!
1
;
this
.
domElement
===
document
?(
this
.
viewHalfX
=
window
.
innerWidth
/
2
,
this
.
viewHalfY
=
window
.
innerHeight
/
2
):(
this
.
viewHalfX
=
this
.
domElement
.
offsetWidth
/
2
,
this
.
viewHalfY
=
this
.
domElement
.
offsetHeight
/
2
,
this
.
domElement
.
setAttribute
(
"
tabindex
"
,
-
1
));
this
.
onMouseDown
=
function
(
a
){
this
.
domElement
!==
document
&&
this
.
domElement
.
focus
();
a
.
preventDefault
();
a
.
stopPropagation
();
if
(
this
.
activeLook
)
switch
(
a
.
button
){
case
0
:
this
.
moveForward
=
!
0
;
break
;
case
2
:
this
.
moveBackward
=!
0
}
this
.
mouseDragOn
=!
0
};
this
.
onMouseUp
=
function
(
a
){
a
.
preventDefault
();
a
.
stopPropagation
();
if
(
this
.
activeLook
)
switch
(
a
.
button
){
case
0
:
this
.
moveForward
=!
1
;
break
;
case
2
:
this
.
moveBackward
=!
1
}
this
.
mouseDragOn
=!
1
};
this
.
onMouseMove
=
function
(
a
){
this
.
domElement
===
document
?(
this
.
mouseX
=
a
.
pageX
-
this
.
viewHalfX
,
this
.
mouseY
=
a
.
pageY
-
this
.
viewHalfY
):(
this
.
mouseX
=
a
.
pageX
-
this
.
domElement
.
offsetLeft
-
this
.
viewHalfX
,
this
.
mouseY
=
a
.
pageY
-
this
.
domElement
.
offsetTop
-
this
.
viewHalfY
)};
this
.
onKeyDown
=
function
(
a
){
switch
(
a
.
keyCode
){
case
38
:
case
87
:
this
.
moveForward
=!
0
;
break
;
case
37
:
case
65
:
this
.
moveLeft
=!
0
;
break
;
case
40
:
case
83
:
this
.
moveBackward
=!
0
;
break
;
case
39
:
case
68
:
this
.
moveRight
=!
0
;
break
;
case
82
:
this
.
moveUp
=!
0
;
break
;
case
70
:
this
.
moveDown
=!
0
;
break
;
case
81
:
this
.
freeze
=!
this
.
freeze
}};
this
.
onKeyUp
=
function
(
a
){
switch
(
a
.
keyCode
){
case
38
:
case
87
:
this
.
moveForward
=!
1
;
break
;
case
37
:
case
65
:
this
.
moveLeft
=!
1
;
break
;
case
40
:
case
83
:
this
.
moveBackward
=!
1
;
break
;
case
39
:
case
68
:
this
.
moveRight
=!
1
;
break
;
case
82
:
this
.
moveUp
=
!
1
;
break
;
case
70
:
this
.
moveDown
=!
1
}};
this
.
update
=
function
(
a
){
var
b
=
0
;
if
(
!
this
.
freeze
){
if
(
this
.
heightSpeed
){
var
c
=
THREE
.
Math
.
clamp
(
this
.
object
.
position
.
y
,
this
.
heightMin
,
this
.
heightMax
)
-
this
.
heightMin
;
this
.
autoSpeedFactor
=
a
*
c
*
this
.
heightCoef
}
else
this
.
autoSpeedFactor
=
0
;
b
=
a
*
this
.
movementSpeed
;(
this
.
moveForward
||
this
.
autoForward
&&!
this
.
moveBackward
)
&&
this
.
object
.
translateZ
(
-
(
b
+
this
.
autoSpeedFactor
));
this
.
moveBackward
&&
this
.
object
.
translateZ
(
b
);
this
.
moveLeft
&&
this
.
object
.
translateX
(
-
b
);
this
.
moveRight
&&
this
.
object
.
translateX
(
b
);
this
.
moveUp
&&
this
.
object
.
translateY
(
b
);
this
.
moveDown
&&
this
.
object
.
translateY
(
-
b
);
c
=
a
*
this
.
lookSpeed
;
this
.
activeLook
||
(
c
=
0
);
this
.
lon
+=
this
.
mouseX
*
c
;
this
.
lookVertical
&&
(
this
.
lat
-=
this
.
mouseY
*
c
);
this
.
lat
=
Math
.
max
(
-
85
,
Math
.
min
(
85
,
this
.
lat
));
this
.
phi
=
(
90
-
this
.
lat
)
*
Math
.
PI
/
180
;
this
.
theta
=
this
.
lon
*
Math
.
PI
/
180
;
a
=
this
.
target
;
b
=
this
.
object
.
position
;
a
.
x
=
b
.
x
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
cos
(
this
.
theta
);
a
.
y
=
b
.
y
+
100
*
Math
.
cos
(
this
.
phi
);
a
.
z
=
b
.
z
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
sin
(
this
.
theta
)}
a
=
1
;
this
.
constrainVertical
&&
(
a
=
Math
.
PI
/
(
this
.
verticalMax
-
this
.
verticalMin
));
this
.
lon
+=
this
.
mouseX
*
c
;
this
.
lookVertical
&&
(
this
.
lat
-=
this
.
mouseY
*
c
*
a
);
this
.
lat
=
Math
.
max
(
-
85
,
Math
.
min
(
85
,
this
.
lat
));
this
.
phi
=
(
90
-
this
.
lat
)
*
Math
.
PI
/
180
;
this
.
theta
=
this
.
lon
*
Math
.
PI
/
180
;
if
(
this
.
constrainVertical
)
this
.
phi
=
THREE
.
Math
.
mapLinear
(
this
.
phi
,
0
,
Math
.
PI
,
this
.
verticalMin
,
this
.
verticalMax
);
a
=
this
.
target
;
b
=
this
.
object
.
position
;
a
.
x
=
b
.
x
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
cos
(
this
.
theta
);
a
.
y
=
b
.
y
+
100
*
Math
.
cos
(
this
.
phi
);
a
.
z
=
b
.
z
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
sin
(
this
.
theta
);
this
.
object
.
lookAt
(
a
)
};
this
.
domElement
.
addEventListener
(
"
contextmenu
"
,
function
(
a
){
a
.
preventDefault
()},
!
1
);
this
.
domElement
.
addEventListener
(
"
mousemove
"
,
c
(
this
,
this
.
onMouseMove
),
!
1
);
this
.
domElement
.
addEventListener
(
"
mousedown
"
,
c
(
this
,
this
.
onMouseDown
),
!
1
);
this
.
domElement
.
addEventListener
(
"
mouseup
"
,
c
(
this
,
this
.
onMouseUp
),
!
1
);
this
.
domElement
.
addEventListener
(
"
keydown
"
,
c
(
this
,
this
.
onKeyDown
),
!
1
);
this
.
domElement
.
addEventListener
(
"
keyup
"
,
c
(
this
,
this
.
onKeyUp
),
!
1
)};
!
1
;
break
;
case
70
:
this
.
moveDown
=!
1
}};
this
.
update
=
function
(
a
){
var
b
=
0
;
if
(
!
this
.
freeze
){
this
.
heightSpeed
?(
b
=
THREE
.
Math
.
clamp
(
this
.
object
.
position
.
y
,
this
.
heightMin
,
this
.
heightMax
)
-
this
.
heightMin
,
this
.
autoSpeedFactor
=
a
*
b
*
this
.
heightCoef
):
this
.
autoSpeedFactor
=
0
;
b
=
a
*
this
.
movementSpeed
;(
this
.
moveForward
||
this
.
autoForward
&&!
this
.
moveBackward
)
&&
this
.
object
.
translateZ
(
-
(
b
+
this
.
autoSpeedFactor
));
this
.
moveBackward
&&
this
.
object
.
translateZ
(
b
);
this
.
moveLeft
&&
this
.
object
.
translateX
(
-
b
);
this
.
moveRight
&&
this
.
object
.
translateX
(
b
);
this
.
moveUp
&&
this
.
object
.
translateY
(
b
);
this
.
moveDown
&&
this
.
object
.
translateY
(
-
b
);
a
*=
this
.
lookSpeed
;
this
.
activeLook
||
(
a
=
0
);
this
.
lon
+=
this
.
mouseX
*
a
;
this
.
lookVertical
&&
(
this
.
lat
-=
this
.
mouseY
*
a
);
this
.
lat
=
Math
.
max
(
-
85
,
Math
.
min
(
85
,
this
.
lat
));
this
.
phi
=
(
90
-
this
.
lat
)
*
Math
.
PI
/
180
;
this
.
theta
=
this
.
lon
*
Math
.
PI
/
180
;
var
b
=
this
.
target
,
c
=
this
.
object
.
position
;
b
.
x
=
c
.
x
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
cos
(
this
.
theta
);
b
.
y
=
c
.
y
+
100
*
Math
.
cos
(
this
.
phi
);
b
.
z
=
c
.
z
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
sin
(
this
.
theta
);
b
=
1
;
this
.
constrainVertical
&&
(
b
=
Math
.
PI
/
(
this
.
verticalMax
-
this
.
verticalMin
));
this
.
lon
+=
this
.
mouseX
*
a
;
this
.
lookVertical
&&
(
this
.
lat
-=
this
.
mouseY
*
a
*
b
);
this
.
lat
=
Math
.
max
(
-
85
,
Math
.
min
(
85
,
this
.
lat
));
this
.
phi
=
(
90
-
this
.
lat
)
*
Math
.
PI
/
180
;
this
.
theta
=
this
.
lon
*
Math
.
PI
/
180
;
if
(
this
.
constrainVertical
)
this
.
phi
=
THREE
.
Math
.
mapLinear
(
this
.
phi
,
0
,
Math
.
PI
,
this
.
verticalMin
,
this
.
verticalMax
);
b
=
this
.
target
;
c
=
this
.
object
.
position
;
b
.
x
=
c
.
x
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
cos
(
this
.
theta
);
b
.
y
=
c
.
y
+
100
*
Math
.
cos
(
this
.
phi
);
b
.
z
=
c
.
z
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
sin
(
this
.
theta
);
this
.
object
.
lookAt
(
b
)}
};
this
.
domElement
.
addEventListener
(
"
contextmenu
"
,
function
(
a
){
a
.
preventDefault
()},
!
1
);
this
.
domElement
.
addEventListener
(
"
mousemove
"
,
c
(
this
,
this
.
onMouseMove
),
!
1
);
this
.
domElement
.
addEventListener
(
"
mousedown
"
,
c
(
this
,
this
.
onMouseDown
),
!
1
);
this
.
domElement
.
addEventListener
(
"
mouseup
"
,
c
(
this
,
this
.
onMouseUp
),
!
1
);
this
.
domElement
.
addEventListener
(
"
keydown
"
,
c
(
this
,
this
.
onKeyDown
),
!
1
);
this
.
domElement
.
addEventListener
(
"
keyup
"
,
c
(
this
,
this
.
onKeyUp
),
!
1
)};
THREE
.
PathControls
=
function
(
a
,
b
){
function
c
(
a
){
return
1
>
(
a
*=
2
)?
0.5
*
a
*
a
:
-
0.5
*
(
--
a
*
(
a
-
2
)
-
1
)}
function
d
(
a
,
b
){
return
function
(){
b
.
apply
(
a
,
arguments
)}}
function
e
(
a
,
b
,
c
,
d
){
var
e
=
{
name
:
c
,
fps
:
0.6
,
length
:
d
,
hierarchy
:[]},
f
,
g
=
b
.
getControlPointsArray
(),
h
=
b
.
getLength
(),
r
=
g
.
length
,
s
=
0
;
f
=
r
-
1
;
b
=
{
parent
:
-
1
,
keys
:[]};
b
.
keys
[
0
]
=
{
time
:
0
,
pos
:
g
[
0
],
rot
:[
0
,
0
,
0
,
1
],
scl
:[
1
,
1
,
1
]};
b
.
keys
[
f
]
=
{
time
:
d
,
pos
:
g
[
f
],
rot
:[
0
,
0
,
0
,
1
],
scl
:[
1
,
1
,
1
]};
for
(
f
=
1
;
f
<
r
-
1
;
f
++
)
s
=
d
*
h
.
chunks
[
f
]
/
h
.
total
,
b
.
keys
[
f
]
=
{
time
:
s
,
pos
:
g
[
f
]};
e
.
hierarchy
[
0
]
=
b
;
THREE
.
AnimationHandler
.
add
(
e
);
return
new
THREE
.
Animation
(
a
,
c
,
THREE
.
AnimationHandler
.
CATMULLROM_FORWARD
,
!
1
)}
function
f
(
a
,
b
){
var
c
,
d
,
e
=
new
THREE
.
Geometry
;
for
(
c
=
0
;
c
<
a
.
points
.
length
*
b
;
c
++
)
d
=
c
/
(
a
.
points
.
length
*
b
),
d
=
a
.
getPoint
(
d
),
e
.
vertices
[
c
]
=
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
d
.
x
,
d
.
y
,
d
.
z
));
return
e
}
this
.
object
=
a
;
this
.
domElement
=
void
0
!==
b
?
b
:
document
;
this
.
id
=
"
PathControls
"
+
THREE
.
PathControlsIdCounter
++
;
this
.
duration
=
1
E4
;
this
.
waypoints
=
[];
this
.
useConstantSpeed
=!
0
;
this
.
resamplingCoef
=
50
;
this
.
debugPath
=
new
THREE
.
Object3D
;
this
.
debugDummy
=
new
THREE
.
Object3D
;
this
.
animationParent
=
new
THREE
.
Object3D
;
this
.
lookSpeed
=
0.0050
;
this
.
lookHorizontal
=
this
.
lookVertical
=!
0
;
this
.
verticalAngleMap
=
{
srcRange
:[
0
,
2
*
Math
.
PI
],
dstRange
:[
0
,
2
*
Math
.
PI
]};
this
.
horizontalAngleMap
=
{
srcRange
:[
0
,
2
*
Math
.
PI
],
dstRange
:[
0
,
2
*
Math
.
PI
]};
this
.
target
=
new
THREE
.
Object3D
;
this
.
theta
=
this
.
phi
=
this
.
lon
=
this
.
lat
=
this
.
mouseY
=
this
.
mouseX
=
0
;
this
.
domElement
===
document
?(
this
.
viewHalfX
=
window
.
innerWidth
/
2
,
this
.
viewHalfY
=
window
.
innerHeight
/
2
):(
this
.
viewHalfX
=
this
.
domElement
.
offsetWidth
/
...
...
build/custom/ThreeExtras.js
浏览文件 @
b54b8ead
...
...
@@ -117,10 +117,10 @@ THREE.FirstPersonControls=function(a,b){function c(a,b){return function(){b.appl
0
;
this
.
mouseDragOn
=
this
.
freeze
=
this
.
moveRight
=
this
.
moveLeft
=
this
.
moveBackward
=
this
.
moveForward
=!
1
;
this
.
domElement
===
document
?(
this
.
viewHalfX
=
window
.
innerWidth
/
2
,
this
.
viewHalfY
=
window
.
innerHeight
/
2
):(
this
.
viewHalfX
=
this
.
domElement
.
offsetWidth
/
2
,
this
.
viewHalfY
=
this
.
domElement
.
offsetHeight
/
2
,
this
.
domElement
.
setAttribute
(
"
tabindex
"
,
-
1
));
this
.
onMouseDown
=
function
(
a
){
this
.
domElement
!==
document
&&
this
.
domElement
.
focus
();
a
.
preventDefault
();
a
.
stopPropagation
();
if
(
this
.
activeLook
)
switch
(
a
.
button
){
case
0
:
this
.
moveForward
=
!
0
;
break
;
case
2
:
this
.
moveBackward
=!
0
}
this
.
mouseDragOn
=!
0
};
this
.
onMouseUp
=
function
(
a
){
a
.
preventDefault
();
a
.
stopPropagation
();
if
(
this
.
activeLook
)
switch
(
a
.
button
){
case
0
:
this
.
moveForward
=!
1
;
break
;
case
2
:
this
.
moveBackward
=!
1
}
this
.
mouseDragOn
=!
1
};
this
.
onMouseMove
=
function
(
a
){
this
.
domElement
===
document
?(
this
.
mouseX
=
a
.
pageX
-
this
.
viewHalfX
,
this
.
mouseY
=
a
.
pageY
-
this
.
viewHalfY
):(
this
.
mouseX
=
a
.
pageX
-
this
.
domElement
.
offsetLeft
-
this
.
viewHalfX
,
this
.
mouseY
=
a
.
pageY
-
this
.
domElement
.
offsetTop
-
this
.
viewHalfY
)};
this
.
onKeyDown
=
function
(
a
){
switch
(
a
.
keyCode
){
case
38
:
case
87
:
this
.
moveForward
=!
0
;
break
;
case
37
:
case
65
:
this
.
moveLeft
=!
0
;
break
;
case
40
:
case
83
:
this
.
moveBackward
=!
0
;
break
;
case
39
:
case
68
:
this
.
moveRight
=!
0
;
break
;
case
82
:
this
.
moveUp
=!
0
;
break
;
case
70
:
this
.
moveDown
=!
0
;
break
;
case
81
:
this
.
freeze
=!
this
.
freeze
}};
this
.
onKeyUp
=
function
(
a
){
switch
(
a
.
keyCode
){
case
38
:
case
87
:
this
.
moveForward
=!
1
;
break
;
case
37
:
case
65
:
this
.
moveLeft
=!
1
;
break
;
case
40
:
case
83
:
this
.
moveBackward
=!
1
;
break
;
case
39
:
case
68
:
this
.
moveRight
=!
1
;
break
;
case
82
:
this
.
moveUp
=
!
1
;
break
;
case
70
:
this
.
moveDown
=!
1
}};
this
.
update
=
function
(
a
){
var
b
=
0
;
if
(
!
this
.
freeze
){
if
(
this
.
heightSpeed
){
var
c
=
THREE
.
Math
.
clamp
(
this
.
object
.
position
.
y
,
this
.
heightMin
,
this
.
heightMax
)
-
this
.
heightMin
;
this
.
autoSpeedFactor
=
a
*
c
*
this
.
heightCoef
}
else
this
.
autoSpeedFactor
=
0
;
b
=
a
*
this
.
movementSpeed
;(
this
.
moveForward
||
this
.
autoForward
&&!
this
.
moveBackward
)
&&
this
.
object
.
translateZ
(
-
(
b
+
this
.
autoSpeedFactor
));
this
.
moveBackward
&&
this
.
object
.
translateZ
(
b
);
this
.
moveLeft
&&
this
.
object
.
translateX
(
-
b
);
this
.
moveRight
&&
this
.
object
.
translateX
(
b
);
this
.
moveUp
&&
this
.
object
.
translateY
(
b
);
this
.
moveDown
&&
this
.
object
.
translateY
(
-
b
);
c
=
a
*
this
.
lookSpeed
;
this
.
activeLook
||
(
c
=
0
);
this
.
lon
+=
this
.
mouseX
*
c
;
this
.
lookVertical
&&
(
this
.
lat
-=
this
.
mouseY
*
c
);
this
.
lat
=
Math
.
max
(
-
85
,
Math
.
min
(
85
,
this
.
lat
));
this
.
phi
=
(
90
-
this
.
lat
)
*
Math
.
PI
/
180
;
this
.
theta
=
this
.
lon
*
Math
.
PI
/
180
;
a
=
this
.
target
;
b
=
this
.
object
.
position
;
a
.
x
=
b
.
x
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
cos
(
this
.
theta
);
a
.
y
=
b
.
y
+
100
*
Math
.
cos
(
this
.
phi
);
a
.
z
=
b
.
z
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
sin
(
this
.
theta
)}
a
=
1
;
this
.
constrainVertical
&&
(
a
=
Math
.
PI
/
(
this
.
verticalMax
-
this
.
verticalMin
));
this
.
lon
+=
this
.
mouseX
*
c
;
this
.
lookVertical
&&
(
this
.
lat
-=
this
.
mouseY
*
c
*
a
);
this
.
lat
=
Math
.
max
(
-
85
,
Math
.
min
(
85
,
this
.
lat
));
this
.
phi
=
(
90
-
this
.
lat
)
*
Math
.
PI
/
180
;
this
.
theta
=
this
.
lon
*
Math
.
PI
/
180
;
if
(
this
.
constrainVertical
)
this
.
phi
=
THREE
.
Math
.
mapLinear
(
this
.
phi
,
0
,
Math
.
PI
,
this
.
verticalMin
,
this
.
verticalMax
);
a
=
this
.
target
;
b
=
this
.
object
.
position
;
a
.
x
=
b
.
x
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
cos
(
this
.
theta
);
a
.
y
=
b
.
y
+
100
*
Math
.
cos
(
this
.
phi
);
a
.
z
=
b
.
z
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
sin
(
this
.
theta
);
this
.
object
.
lookAt
(
a
)
};
this
.
domElement
.
addEventListener
(
"
contextmenu
"
,
function
(
a
){
a
.
preventDefault
()},
!
1
);
this
.
domElement
.
addEventListener
(
"
mousemove
"
,
c
(
this
,
this
.
onMouseMove
),
!
1
);
this
.
domElement
.
addEventListener
(
"
mousedown
"
,
c
(
this
,
this
.
onMouseDown
),
!
1
);
this
.
domElement
.
addEventListener
(
"
mouseup
"
,
c
(
this
,
this
.
onMouseUp
),
!
1
);
this
.
domElement
.
addEventListener
(
"
keydown
"
,
c
(
this
,
this
.
onKeyDown
),
!
1
);
this
.
domElement
.
addEventListener
(
"
keyup
"
,
c
(
this
,
this
.
onKeyUp
),
!
1
)};
!
1
;
break
;
case
70
:
this
.
moveDown
=!
1
}};
this
.
update
=
function
(
a
){
var
b
=
0
;
if
(
!
this
.
freeze
){
this
.
heightSpeed
?(
b
=
THREE
.
Math
.
clamp
(
this
.
object
.
position
.
y
,
this
.
heightMin
,
this
.
heightMax
)
-
this
.
heightMin
,
this
.
autoSpeedFactor
=
a
*
b
*
this
.
heightCoef
):
this
.
autoSpeedFactor
=
0
;
b
=
a
*
this
.
movementSpeed
;(
this
.
moveForward
||
this
.
autoForward
&&!
this
.
moveBackward
)
&&
this
.
object
.
translateZ
(
-
(
b
+
this
.
autoSpeedFactor
));
this
.
moveBackward
&&
this
.
object
.
translateZ
(
b
);
this
.
moveLeft
&&
this
.
object
.
translateX
(
-
b
);
this
.
moveRight
&&
this
.
object
.
translateX
(
b
);
this
.
moveUp
&&
this
.
object
.
translateY
(
b
);
this
.
moveDown
&&
this
.
object
.
translateY
(
-
b
);
a
*=
this
.
lookSpeed
;
this
.
activeLook
||
(
a
=
0
);
this
.
lon
+=
this
.
mouseX
*
a
;
this
.
lookVertical
&&
(
this
.
lat
-=
this
.
mouseY
*
a
);
this
.
lat
=
Math
.
max
(
-
85
,
Math
.
min
(
85
,
this
.
lat
));
this
.
phi
=
(
90
-
this
.
lat
)
*
Math
.
PI
/
180
;
this
.
theta
=
this
.
lon
*
Math
.
PI
/
180
;
var
b
=
this
.
target
,
c
=
this
.
object
.
position
;
b
.
x
=
c
.
x
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
cos
(
this
.
theta
);
b
.
y
=
c
.
y
+
100
*
Math
.
cos
(
this
.
phi
);
b
.
z
=
c
.
z
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
sin
(
this
.
theta
);
b
=
1
;
this
.
constrainVertical
&&
(
b
=
Math
.
PI
/
(
this
.
verticalMax
-
this
.
verticalMin
));
this
.
lon
+=
this
.
mouseX
*
a
;
this
.
lookVertical
&&
(
this
.
lat
-=
this
.
mouseY
*
a
*
b
);
this
.
lat
=
Math
.
max
(
-
85
,
Math
.
min
(
85
,
this
.
lat
));
this
.
phi
=
(
90
-
this
.
lat
)
*
Math
.
PI
/
180
;
this
.
theta
=
this
.
lon
*
Math
.
PI
/
180
;
if
(
this
.
constrainVertical
)
this
.
phi
=
THREE
.
Math
.
mapLinear
(
this
.
phi
,
0
,
Math
.
PI
,
this
.
verticalMin
,
this
.
verticalMax
);
b
=
this
.
target
;
c
=
this
.
object
.
position
;
b
.
x
=
c
.
x
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
cos
(
this
.
theta
);
b
.
y
=
c
.
y
+
100
*
Math
.
cos
(
this
.
phi
);
b
.
z
=
c
.
z
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
sin
(
this
.
theta
);
this
.
object
.
lookAt
(
b
)}
};
this
.
domElement
.
addEventListener
(
"
contextmenu
"
,
function
(
a
){
a
.
preventDefault
()},
!
1
);
this
.
domElement
.
addEventListener
(
"
mousemove
"
,
c
(
this
,
this
.
onMouseMove
),
!
1
);
this
.
domElement
.
addEventListener
(
"
mousedown
"
,
c
(
this
,
this
.
onMouseDown
),
!
1
);
this
.
domElement
.
addEventListener
(
"
mouseup
"
,
c
(
this
,
this
.
onMouseUp
),
!
1
);
this
.
domElement
.
addEventListener
(
"
keydown
"
,
c
(
this
,
this
.
onKeyDown
),
!
1
);
this
.
domElement
.
addEventListener
(
"
keyup
"
,
c
(
this
,
this
.
onKeyUp
),
!
1
)};
THREE
.
PathControls
=
function
(
a
,
b
){
function
c
(
a
){
return
1
>
(
a
*=
2
)?
0.5
*
a
*
a
:
-
0.5
*
(
--
a
*
(
a
-
2
)
-
1
)}
function
d
(
a
,
b
){
return
function
(){
b
.
apply
(
a
,
arguments
)}}
function
e
(
a
,
b
,
c
,
d
){
var
e
=
{
name
:
c
,
fps
:
0.6
,
length
:
d
,
hierarchy
:[]},
f
,
g
=
b
.
getControlPointsArray
(),
h
=
b
.
getLength
(),
q
=
g
.
length
,
r
=
0
;
f
=
q
-
1
;
b
=
{
parent
:
-
1
,
keys
:[]};
b
.
keys
[
0
]
=
{
time
:
0
,
pos
:
g
[
0
],
rot
:[
0
,
0
,
0
,
1
],
scl
:[
1
,
1
,
1
]};
b
.
keys
[
f
]
=
{
time
:
d
,
pos
:
g
[
f
],
rot
:[
0
,
0
,
0
,
1
],
scl
:[
1
,
1
,
1
]};
for
(
f
=
1
;
f
<
q
-
1
;
f
++
)
r
=
d
*
h
.
chunks
[
f
]
/
h
.
total
,
b
.
keys
[
f
]
=
{
time
:
r
,
pos
:
g
[
f
]};
e
.
hierarchy
[
0
]
=
b
;
THREE
.
AnimationHandler
.
add
(
e
);
return
new
THREE
.
Animation
(
a
,
c
,
THREE
.
AnimationHandler
.
CATMULLROM_FORWARD
,
!
1
)}
function
f
(
a
,
b
){
var
c
,
d
,
e
=
new
THREE
.
Geometry
;
for
(
c
=
0
;
c
<
a
.
points
.
length
*
b
;
c
++
)
d
=
c
/
(
a
.
points
.
length
*
b
),
d
=
a
.
getPoint
(
d
),
e
.
vertices
[
c
]
=
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
d
.
x
,
d
.
y
,
d
.
z
));
return
e
}
this
.
object
=
a
;
this
.
domElement
=
void
0
!==
b
?
b
:
document
;
this
.
id
=
"
PathControls
"
+
THREE
.
PathControlsIdCounter
++
;
this
.
duration
=
1
E4
;
this
.
waypoints
=
[];
this
.
useConstantSpeed
=!
0
;
this
.
resamplingCoef
=
50
;
this
.
debugPath
=
new
THREE
.
Object3D
;
this
.
debugDummy
=
new
THREE
.
Object3D
;
this
.
animationParent
=
new
THREE
.
Object3D
;
this
.
lookSpeed
=
0.0050
;
this
.
lookHorizontal
=
this
.
lookVertical
=!
0
;
this
.
verticalAngleMap
=
{
srcRange
:[
0
,
2
*
Math
.
PI
],
dstRange
:[
0
,
2
*
Math
.
PI
]};
this
.
horizontalAngleMap
=
{
srcRange
:[
0
,
2
*
Math
.
PI
],
dstRange
:[
0
,
2
*
Math
.
PI
]};
this
.
target
=
new
THREE
.
Object3D
;
this
.
theta
=
this
.
phi
=
this
.
lon
=
this
.
lat
=
this
.
mouseY
=
this
.
mouseX
=
0
;
this
.
domElement
===
document
?(
this
.
viewHalfX
=
window
.
innerWidth
/
2
,
this
.
viewHalfY
=
window
.
innerHeight
/
2
):(
this
.
viewHalfX
=
this
.
domElement
.
offsetWidth
/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录