Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
ee7d002a
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,发现更多精彩内容 >>
提交
ee7d002a
编写于
8月 04, 2012
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds.
上级
03604599
变更
4
展开全部
显示空白变更内容
内联
并排
Showing
4 changed file
with
262 addition
and
263 deletion
+262
-263
build/Three.js
build/Three.js
+96
-97
build/custom/ThreeCanvas.js
build/custom/ThreeCanvas.js
+54
-54
build/custom/ThreeExtras.js
build/custom/ThreeExtras.js
+5
-5
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+107
-107
未找到文件。
build/Three.js
浏览文件 @
ee7d002a
此差异已折叠。
点击以展开。
build/custom/ThreeCanvas.js
浏览文件 @
ee7d002a
此差异已折叠。
点击以展开。
build/custom/ThreeExtras.js
浏览文件 @
ee7d002a
...
@@ -117,7 +117,7 @@ this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);t
...
@@ -117,7 +117,7 @@ this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);t
THREE
.
Animation
.
prototype
.
interpolateCatmullRom
=
function
(
b
,
a
){
var
c
=
[],
d
=
[],
e
,
f
,
g
,
h
,
i
,
j
;
e
=
(
b
.
length
-
1
)
*
a
;
f
=
Math
.
floor
(
e
);
e
=
e
-
f
;
c
[
0
]
=
f
===
0
?
f
:
f
-
1
;
c
[
1
]
=
f
;
c
[
2
]
=
f
>
b
.
length
-
2
?
f
:
f
+
1
;
c
[
3
]
=
f
>
b
.
length
-
3
?
f
:
f
+
2
;
f
=
b
[
c
[
0
]];
h
=
b
[
c
[
1
]];
i
=
b
[
c
[
2
]];
j
=
b
[
c
[
3
]];
c
=
e
*
e
;
g
=
e
*
c
;
d
[
0
]
=
this
.
interpolate
(
f
[
0
],
h
[
0
],
i
[
0
],
j
[
0
],
e
,
c
,
g
);
d
[
1
]
=
this
.
interpolate
(
f
[
1
],
h
[
1
],
i
[
1
],
j
[
1
],
e
,
c
,
g
);
d
[
2
]
=
this
.
interpolate
(
f
[
2
],
h
[
2
],
i
[
2
],
j
[
2
],
e
,
c
,
g
);
return
d
};
THREE
.
Animation
.
prototype
.
interpolateCatmullRom
=
function
(
b
,
a
){
var
c
=
[],
d
=
[],
e
,
f
,
g
,
h
,
i
,
j
;
e
=
(
b
.
length
-
1
)
*
a
;
f
=
Math
.
floor
(
e
);
e
=
e
-
f
;
c
[
0
]
=
f
===
0
?
f
:
f
-
1
;
c
[
1
]
=
f
;
c
[
2
]
=
f
>
b
.
length
-
2
?
f
:
f
+
1
;
c
[
3
]
=
f
>
b
.
length
-
3
?
f
:
f
+
2
;
f
=
b
[
c
[
0
]];
h
=
b
[
c
[
1
]];
i
=
b
[
c
[
2
]];
j
=
b
[
c
[
3
]];
c
=
e
*
e
;
g
=
e
*
c
;
d
[
0
]
=
this
.
interpolate
(
f
[
0
],
h
[
0
],
i
[
0
],
j
[
0
],
e
,
c
,
g
);
d
[
1
]
=
this
.
interpolate
(
f
[
1
],
h
[
1
],
i
[
1
],
j
[
1
],
e
,
c
,
g
);
d
[
2
]
=
this
.
interpolate
(
f
[
2
],
h
[
2
],
i
[
2
],
j
[
2
],
e
,
c
,
g
);
return
d
};
THREE
.
Animation
.
prototype
.
interpolate
=
function
(
b
,
a
,
c
,
d
,
e
,
f
,
g
){
b
=
(
c
-
b
)
*
0.5
;
d
=
(
d
-
a
)
*
0.5
;
return
(
2
*
(
a
-
c
)
+
b
+
d
)
*
g
+
(
-
3
*
(
a
-
c
)
-
2
*
b
-
d
)
*
f
+
b
*
e
+
a
};
THREE
.
Animation
.
prototype
.
getNextKeyWith
=
function
(
b
,
a
,
c
){
for
(
var
d
=
this
.
data
.
hierarchy
[
a
].
keys
,
c
=
this
.
interpolationType
===
THREE
.
AnimationHandler
.
CATMULLROM
||
this
.
interpolationType
===
THREE
.
AnimationHandler
.
CATMULLROM_FORWARD
?
c
<
d
.
length
-
1
?
c
:
d
.
length
-
1
:
c
%
d
.
length
;
c
<
d
.
length
;
c
++
)
if
(
d
[
c
][
b
]
!==
void
0
)
return
d
[
c
];
return
this
.
data
.
hierarchy
[
a
].
keys
[
0
]};
THREE
.
Animation
.
prototype
.
interpolate
=
function
(
b
,
a
,
c
,
d
,
e
,
f
,
g
){
b
=
(
c
-
b
)
*
0.5
;
d
=
(
d
-
a
)
*
0.5
;
return
(
2
*
(
a
-
c
)
+
b
+
d
)
*
g
+
(
-
3
*
(
a
-
c
)
-
2
*
b
-
d
)
*
f
+
b
*
e
+
a
};
THREE
.
Animation
.
prototype
.
getNextKeyWith
=
function
(
b
,
a
,
c
){
for
(
var
d
=
this
.
data
.
hierarchy
[
a
].
keys
,
c
=
this
.
interpolationType
===
THREE
.
AnimationHandler
.
CATMULLROM
||
this
.
interpolationType
===
THREE
.
AnimationHandler
.
CATMULLROM_FORWARD
?
c
<
d
.
length
-
1
?
c
:
d
.
length
-
1
:
c
%
d
.
length
;
c
<
d
.
length
;
c
++
)
if
(
d
[
c
][
b
]
!==
void
0
)
return
d
[
c
];
return
this
.
data
.
hierarchy
[
a
].
keys
[
0
]};
THREE
.
Animation
.
prototype
.
getPrevKeyWith
=
function
(
b
,
a
,
c
){
for
(
var
d
=
this
.
data
.
hierarchy
[
a
].
keys
,
c
=
this
.
interpolationType
===
THREE
.
AnimationHandler
.
CATMULLROM
||
this
.
interpolationType
===
THREE
.
AnimationHandler
.
CATMULLROM_FORWARD
?
c
>
0
?
c
:
0
:
c
>=
0
?
c
:
c
+
d
.
length
;
c
>=
0
;
c
--
)
if
(
d
[
c
][
b
]
!==
void
0
)
return
d
[
c
];
return
this
.
data
.
hierarchy
[
a
].
keys
[
d
.
length
-
1
]};
THREE
.
Animation
.
prototype
.
getPrevKeyWith
=
function
(
b
,
a
,
c
){
for
(
var
d
=
this
.
data
.
hierarchy
[
a
].
keys
,
c
=
this
.
interpolationType
===
THREE
.
AnimationHandler
.
CATMULLROM
||
this
.
interpolationType
===
THREE
.
AnimationHandler
.
CATMULLROM_FORWARD
?
c
>
0
?
c
:
0
:
c
>=
0
?
c
:
c
+
d
.
length
;
c
>=
0
;
c
--
)
if
(
d
[
c
][
b
]
!==
void
0
)
return
d
[
c
];
return
this
.
data
.
hierarchy
[
a
].
keys
[
d
.
length
-
1
]};
THREE
.
KeyFrameAnimation
=
function
(
b
,
a
,
c
){
this
.
root
=
b
;
this
.
data
=
THREE
.
AnimationHandler
.
get
(
a
);
this
.
hierarchy
=
THREE
.
AnimationHandler
.
parse
(
b
);
this
.
currentTime
=
0
;
this
.
timeScale
=
0.001
0
;
this
.
isPlaying
=
false
;
this
.
loop
=
this
.
isPaused
=
true
;
this
.
JITCompile
=
c
!==
void
0
?
c
:
true
;
b
=
0
;
for
(
a
=
this
.
hierarchy
.
length
;
b
<
a
;
b
++
){
var
c
=
this
.
data
.
hierarchy
[
b
].
sids
,
d
=
this
.
hierarchy
[
b
];
if
(
this
.
data
.
hierarchy
[
b
].
keys
.
length
&&
c
){
for
(
var
e
=
0
;
e
<
c
.
length
;
e
++
){
var
f
=
c
[
e
],
g
=
this
.
getNextKeyWith
(
f
,
b
,
0
);
g
&&
g
.
apply
(
f
)}
d
.
matrixAutoUpdate
=
THREE
.
KeyFrameAnimation
=
function
(
b
,
a
,
c
){
this
.
root
=
b
;
this
.
data
=
THREE
.
AnimationHandler
.
get
(
a
);
this
.
hierarchy
=
THREE
.
AnimationHandler
.
parse
(
b
);
this
.
currentTime
=
0
;
this
.
timeScale
=
0.001
;
this
.
isPlaying
=
false
;
this
.
loop
=
this
.
isPaused
=
true
;
this
.
JITCompile
=
c
!==
void
0
?
c
:
true
;
b
=
0
;
for
(
a
=
this
.
hierarchy
.
length
;
b
<
a
;
b
++
){
var
c
=
this
.
data
.
hierarchy
[
b
].
sids
,
d
=
this
.
hierarchy
[
b
];
if
(
this
.
data
.
hierarchy
[
b
].
keys
.
length
&&
c
){
for
(
var
e
=
0
;
e
<
c
.
length
;
e
++
){
var
f
=
c
[
e
],
g
=
this
.
getNextKeyWith
(
f
,
b
,
0
);
g
&&
g
.
apply
(
f
)}
d
.
matrixAutoUpdate
=
false
;
this
.
data
.
hierarchy
[
b
].
node
.
updateMatrix
();
d
.
matrixWorldNeedsUpdate
=
true
}}};
false
;
this
.
data
.
hierarchy
[
b
].
node
.
updateMatrix
();
d
.
matrixWorldNeedsUpdate
=
true
}}};
THREE
.
KeyFrameAnimation
.
prototype
.
play
=
function
(
b
,
a
){
if
(
!
this
.
isPlaying
){
this
.
isPlaying
=
true
;
this
.
loop
=
b
!==
void
0
?
b
:
true
;
this
.
currentTime
=
a
!==
void
0
?
a
:
0
;
this
.
startTimeMs
=
a
;
this
.
startTime
=
1
E7
;
this
.
endTime
=-
this
.
startTime
;
var
c
,
d
=
this
.
hierarchy
.
length
,
e
,
f
;
for
(
c
=
0
;
c
<
d
;
c
++
){
e
=
this
.
hierarchy
[
c
];
f
=
this
.
data
.
hierarchy
[
c
];
e
.
useQuaternion
=
true
;
if
(
f
.
animationCache
===
void
0
){
f
.
animationCache
=
{};
f
.
animationCache
.
prevKey
=
null
;
f
.
animationCache
.
nextKey
=
null
;
f
.
animationCache
.
originalMatrix
=
e
instanceof
THREE
.
Bone
?
THREE
.
KeyFrameAnimation
.
prototype
.
play
=
function
(
b
,
a
){
if
(
!
this
.
isPlaying
){
this
.
isPlaying
=
true
;
this
.
loop
=
b
!==
void
0
?
b
:
true
;
this
.
currentTime
=
a
!==
void
0
?
a
:
0
;
this
.
startTimeMs
=
a
;
this
.
startTime
=
1
E7
;
this
.
endTime
=-
this
.
startTime
;
var
c
,
d
=
this
.
hierarchy
.
length
,
e
,
f
;
for
(
c
=
0
;
c
<
d
;
c
++
){
e
=
this
.
hierarchy
[
c
];
f
=
this
.
data
.
hierarchy
[
c
];
e
.
useQuaternion
=
true
;
if
(
f
.
animationCache
===
void
0
){
f
.
animationCache
=
{};
f
.
animationCache
.
prevKey
=
null
;
f
.
animationCache
.
nextKey
=
null
;
f
.
animationCache
.
originalMatrix
=
e
instanceof
THREE
.
Bone
?
e
.
skinMatrix
:
e
.
matrix
}
e
=
this
.
data
.
hierarchy
[
c
].
keys
;
if
(
e
.
length
){
f
.
animationCache
.
prevKey
=
e
[
0
];
f
.
animationCache
.
nextKey
=
e
[
1
];
this
.
startTime
=
Math
.
min
(
e
[
0
].
time
,
this
.
startTime
);
this
.
endTime
=
Math
.
max
(
e
[
e
.
length
-
1
].
time
,
this
.
endTime
)}}
this
.
update
(
0
)}
this
.
isPaused
=
false
;
THREE
.
AnimationHandler
.
addToUpdate
(
this
)};
THREE
.
KeyFrameAnimation
.
prototype
.
pause
=
function
(){
this
.
isPaused
?
THREE
.
AnimationHandler
.
addToUpdate
(
this
):
THREE
.
AnimationHandler
.
removeFromUpdate
(
this
);
this
.
isPaused
=!
this
.
isPaused
};
e
.
skinMatrix
:
e
.
matrix
}
e
=
this
.
data
.
hierarchy
[
c
].
keys
;
if
(
e
.
length
){
f
.
animationCache
.
prevKey
=
e
[
0
];
f
.
animationCache
.
nextKey
=
e
[
1
];
this
.
startTime
=
Math
.
min
(
e
[
0
].
time
,
this
.
startTime
);
this
.
endTime
=
Math
.
max
(
e
[
e
.
length
-
1
].
time
,
this
.
endTime
)}}
this
.
update
(
0
)}
this
.
isPaused
=
false
;
THREE
.
AnimationHandler
.
addToUpdate
(
this
)};
THREE
.
KeyFrameAnimation
.
prototype
.
pause
=
function
(){
this
.
isPaused
?
THREE
.
AnimationHandler
.
addToUpdate
(
this
):
THREE
.
AnimationHandler
.
removeFromUpdate
(
this
);
this
.
isPaused
=!
this
.
isPaused
};
...
@@ -136,7 +136,7 @@ THREE.CombinedCamera.prototype.setSize=function(b,a){this.cameraP.aspect=b/a;thi
...
@@ -136,7 +136,7 @@ THREE.CombinedCamera.prototype.setSize=function(b,a){this.cameraP.aspect=b/a;thi
THREE
.
CombinedCamera
.
prototype
.
setLens
=
function
(
b
,
a
){
var
c
=
2
*
Math
.
atan
((
a
!==
void
0
?
a
:
24
)
/
(
b
*
2
))
*
(
180
/
Math
.
PI
);
this
.
setFov
(
c
);
return
c
};
THREE
.
CombinedCamera
.
prototype
.
setZoom
=
function
(
b
){
this
.
zoom
=
b
;
this
.
inPerspectiveMode
?
this
.
toPerspective
():
this
.
toOrthographic
()};
THREE
.
CombinedCamera
.
prototype
.
toFrontView
=
function
(){
this
.
rotation
.
x
=
0
;
this
.
rotation
.
y
=
0
;
this
.
rotation
.
z
=
0
;
this
.
rotationAutoUpdate
=
false
};
THREE
.
CombinedCamera
.
prototype
.
setLens
=
function
(
b
,
a
){
var
c
=
2
*
Math
.
atan
((
a
!==
void
0
?
a
:
24
)
/
(
b
*
2
))
*
(
180
/
Math
.
PI
);
this
.
setFov
(
c
);
return
c
};
THREE
.
CombinedCamera
.
prototype
.
setZoom
=
function
(
b
){
this
.
zoom
=
b
;
this
.
inPerspectiveMode
?
this
.
toPerspective
():
this
.
toOrthographic
()};
THREE
.
CombinedCamera
.
prototype
.
toFrontView
=
function
(){
this
.
rotation
.
x
=
0
;
this
.
rotation
.
y
=
0
;
this
.
rotation
.
z
=
0
;
this
.
rotationAutoUpdate
=
false
};
THREE
.
CombinedCamera
.
prototype
.
toBackView
=
function
(){
this
.
rotation
.
x
=
0
;
this
.
rotation
.
y
=
Math
.
PI
;
this
.
rotation
.
z
=
0
;
this
.
rotationAutoUpdate
=
false
};
THREE
.
CombinedCamera
.
prototype
.
toLeftView
=
function
(){
this
.
rotation
.
x
=
0
;
this
.
rotation
.
y
=-
Math
.
PI
/
2
;
this
.
rotation
.
z
=
0
;
this
.
rotationAutoUpdate
=
false
};
THREE
.
CombinedCamera
.
prototype
.
toRightView
=
function
(){
this
.
rotation
.
x
=
0
;
this
.
rotation
.
y
=
Math
.
PI
/
2
;
this
.
rotation
.
z
=
0
;
this
.
rotationAutoUpdate
=
false
};
THREE
.
CombinedCamera
.
prototype
.
toBackView
=
function
(){
this
.
rotation
.
x
=
0
;
this
.
rotation
.
y
=
Math
.
PI
;
this
.
rotation
.
z
=
0
;
this
.
rotationAutoUpdate
=
false
};
THREE
.
CombinedCamera
.
prototype
.
toLeftView
=
function
(){
this
.
rotation
.
x
=
0
;
this
.
rotation
.
y
=-
Math
.
PI
/
2
;
this
.
rotation
.
z
=
0
;
this
.
rotationAutoUpdate
=
false
};
THREE
.
CombinedCamera
.
prototype
.
toRightView
=
function
(){
this
.
rotation
.
x
=
0
;
this
.
rotation
.
y
=
Math
.
PI
/
2
;
this
.
rotation
.
z
=
0
;
this
.
rotationAutoUpdate
=
false
};
THREE
.
CombinedCamera
.
prototype
.
toTopView
=
function
(){
this
.
rotation
.
x
=-
Math
.
PI
/
2
;
this
.
rotation
.
y
=
0
;
this
.
rotation
.
z
=
0
;
this
.
rotationAutoUpdate
=
false
};
THREE
.
CombinedCamera
.
prototype
.
toBottomView
=
function
(){
this
.
rotation
.
x
=
Math
.
PI
/
2
;
this
.
rotation
.
y
=
0
;
this
.
rotation
.
z
=
0
;
this
.
rotationAutoUpdate
=
false
};
THREE
.
CombinedCamera
.
prototype
.
toTopView
=
function
(){
this
.
rotation
.
x
=-
Math
.
PI
/
2
;
this
.
rotation
.
y
=
0
;
this
.
rotation
.
z
=
0
;
this
.
rotationAutoUpdate
=
false
};
THREE
.
CombinedCamera
.
prototype
.
toBottomView
=
function
(){
this
.
rotation
.
x
=
Math
.
PI
/
2
;
this
.
rotation
.
y
=
0
;
this
.
rotation
.
z
=
0
;
this
.
rotationAutoUpdate
=
false
};
THREE
.
FirstPersonControls
=
function
(
b
,
a
){
function
c
(
a
,
b
){
return
function
(){
b
.
apply
(
a
,
arguments
)}}
this
.
object
=
b
;
this
.
target
=
new
THREE
.
Vector3
(
0
,
0
,
0
);
this
.
domElement
=
a
!==
void
0
?
a
:
document
;
this
.
movementSpeed
=
1
;
this
.
lookSpeed
=
0.005
0
;
this
.
lookVertical
=
true
;
this
.
autoForward
=
false
;
this
.
activeLook
=
true
;
this
.
heightSpeed
=
false
;
this
.
heightCoef
=
1
;
this
.
heightMin
=
0
;
this
.
heightMax
=
1
;
this
.
constrainVertical
=
false
;
this
.
verticalMin
=
0
;
this
.
verticalMax
=
Math
.
PI
;
this
.
theta
=
this
.
phi
=
this
.
lon
=
this
.
lat
=
this
.
mouseY
=
this
.
mouseX
=
THREE
.
FirstPersonControls
=
function
(
b
,
a
){
function
c
(
a
,
b
){
return
function
(){
b
.
apply
(
a
,
arguments
)}}
this
.
object
=
b
;
this
.
target
=
new
THREE
.
Vector3
(
0
,
0
,
0
);
this
.
domElement
=
a
!==
void
0
?
a
:
document
;
this
.
movementSpeed
=
1
;
this
.
lookSpeed
=
0.005
;
this
.
lookVertical
=
true
;
this
.
autoForward
=
false
;
this
.
activeLook
=
true
;
this
.
heightSpeed
=
false
;
this
.
heightCoef
=
1
;
this
.
heightMin
=
0
;
this
.
heightMax
=
1
;
this
.
constrainVertical
=
false
;
this
.
verticalMin
=
0
;
this
.
verticalMax
=
Math
.
PI
;
this
.
theta
=
this
.
phi
=
this
.
lon
=
this
.
lat
=
this
.
mouseY
=
this
.
mouseX
=
this
.
autoSpeedFactor
=
0
;
this
.
mouseDragOn
=
this
.
freeze
=
this
.
moveRight
=
this
.
moveLeft
=
this
.
moveBackward
=
this
.
moveForward
=
false
;
this
.
viewHalfY
=
this
.
viewHalfX
=
0
;
this
.
domElement
!==
document
&&
this
.
domElement
.
setAttribute
(
"
tabindex
"
,
-
1
);
this
.
handleResize
=
function
(){
if
(
this
.
domElement
===
document
){
this
.
viewHalfX
=
window
.
innerWidth
/
2
;
this
.
viewHalfY
=
window
.
innerHeight
/
2
}
else
{
this
.
viewHalfX
=
this
.
domElement
.
offsetWidth
/
2
;
this
.
viewHalfY
=
this
.
domElement
.
offsetHeight
/
2
}};
this
.
onMouseDown
=
function
(
a
){
this
.
domElement
!==
this
.
autoSpeedFactor
=
0
;
this
.
mouseDragOn
=
this
.
freeze
=
this
.
moveRight
=
this
.
moveLeft
=
this
.
moveBackward
=
this
.
moveForward
=
false
;
this
.
viewHalfY
=
this
.
viewHalfX
=
0
;
this
.
domElement
!==
document
&&
this
.
domElement
.
setAttribute
(
"
tabindex
"
,
-
1
);
this
.
handleResize
=
function
(){
if
(
this
.
domElement
===
document
){
this
.
viewHalfX
=
window
.
innerWidth
/
2
;
this
.
viewHalfY
=
window
.
innerHeight
/
2
}
else
{
this
.
viewHalfX
=
this
.
domElement
.
offsetWidth
/
2
;
this
.
viewHalfY
=
this
.
domElement
.
offsetHeight
/
2
}};
this
.
onMouseDown
=
function
(
a
){
this
.
domElement
!==
document
&&
this
.
domElement
.
focus
();
a
.
preventDefault
();
a
.
stopPropagation
();
if
(
this
.
activeLook
)
switch
(
a
.
button
){
case
0
:
this
.
moveForward
=
true
;
break
;
case
2
:
this
.
moveBackward
=
true
}
this
.
mouseDragOn
=
true
};
this
.
onMouseUp
=
function
(
a
){
a
.
preventDefault
();
a
.
stopPropagation
();
if
(
this
.
activeLook
)
switch
(
a
.
button
){
case
0
:
this
.
moveForward
=
false
;
break
;
case
2
:
this
.
moveBackward
=
false
}
this
.
mouseDragOn
=
false
};
this
.
onMouseMove
=
function
(
a
){
if
(
this
.
domElement
===
document
){
this
.
mouseX
=
a
.
pageX
-
this
.
viewHalfX
;
this
.
mouseY
=
a
.
pageY
-
document
&&
this
.
domElement
.
focus
();
a
.
preventDefault
();
a
.
stopPropagation
();
if
(
this
.
activeLook
)
switch
(
a
.
button
){
case
0
:
this
.
moveForward
=
true
;
break
;
case
2
:
this
.
moveBackward
=
true
}
this
.
mouseDragOn
=
true
};
this
.
onMouseUp
=
function
(
a
){
a
.
preventDefault
();
a
.
stopPropagation
();
if
(
this
.
activeLook
)
switch
(
a
.
button
){
case
0
:
this
.
moveForward
=
false
;
break
;
case
2
:
this
.
moveBackward
=
false
}
this
.
mouseDragOn
=
false
};
this
.
onMouseMove
=
function
(
a
){
if
(
this
.
domElement
===
document
){
this
.
mouseX
=
a
.
pageX
-
this
.
viewHalfX
;
this
.
mouseY
=
a
.
pageY
-
this
.
viewHalfY
}
else
{
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
=
true
;
break
;
case
37
:
case
65
:
this
.
moveLeft
=
true
;
break
;
case
40
:
case
83
:
this
.
moveBackward
=
true
;
break
;
case
39
:
case
68
:
this
.
moveRight
=
true
;
break
;
case
82
:
this
.
moveUp
=
true
;
break
;
case
70
:
this
.
moveDown
=
true
;
break
;
case
81
:
this
.
freeze
=!
this
.
freeze
}};
this
.
onKeyUp
=
function
(
a
){
switch
(
a
.
keyCode
){
case
38
:
case
87
:
this
.
moveForward
=
this
.
viewHalfY
}
else
{
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
=
true
;
break
;
case
37
:
case
65
:
this
.
moveLeft
=
true
;
break
;
case
40
:
case
83
:
this
.
moveBackward
=
true
;
break
;
case
39
:
case
68
:
this
.
moveRight
=
true
;
break
;
case
82
:
this
.
moveUp
=
true
;
break
;
case
70
:
this
.
moveDown
=
true
;
break
;
case
81
:
this
.
freeze
=!
this
.
freeze
}};
this
.
onKeyUp
=
function
(
a
){
switch
(
a
.
keyCode
){
case
38
:
case
87
:
this
.
moveForward
=
...
@@ -147,14 +147,14 @@ this.target,c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.
...
@@ -147,14 +147,14 @@ this.target,c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.
c
(
this
,
this
.
onMouseUp
),
false
);
this
.
domElement
.
addEventListener
(
"
keydown
"
,
c
(
this
,
this
.
onKeyDown
),
false
);
this
.
domElement
.
addEventListener
(
"
keyup
"
,
c
(
this
,
this
.
onKeyUp
),
false
);
this
.
handleResize
()};
c
(
this
,
this
.
onMouseUp
),
false
);
this
.
domElement
.
addEventListener
(
"
keydown
"
,
c
(
this
,
this
.
onKeyDown
),
false
);
this
.
domElement
.
addEventListener
(
"
keyup
"
,
c
(
this
,
this
.
onKeyUp
),
false
);
this
.
handleResize
()};
THREE
.
PathControls
=
function
(
b
,
a
){
function
c
(
a
){
return
(
a
=
a
*
2
)
<
1
?
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
(),
p
=
g
.
length
,
s
=
0
;
f
=
p
-
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
<
p
-
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
);
THREE
.
PathControls
=
function
(
b
,
a
){
function
c
(
a
){
return
(
a
=
a
*
2
)
<
1
?
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
(),
p
=
g
.
length
,
s
=
0
;
f
=
p
-
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
<
p
-
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
,
false
)}
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
.
Vector3
(
d
.
x
,
d
.
y
,
d
.
z
)}
return
e
}
this
.
object
=
b
;
this
.
domElement
=
a
!==
void
0
?
a
:
document
;
this
.
id
=
"
PathControls
"
+
THREE
.
PathControlsIdCounter
++
;
this
.
duration
=
1
E4
;
this
.
waypoints
=
[];
this
.
useConstantSpeed
=
true
;
this
.
resamplingCoef
=
50
;
this
.
debugPath
=
new
THREE
.
Object3D
;
this
.
debugDummy
=
new
THREE
.
Object3D
;
return
new
THREE
.
Animation
(
a
,
c
,
THREE
.
AnimationHandler
.
CATMULLROM_FORWARD
,
false
)}
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
.
Vector3
(
d
.
x
,
d
.
y
,
d
.
z
)}
return
e
}
this
.
object
=
b
;
this
.
domElement
=
a
!==
void
0
?
a
:
document
;
this
.
id
=
"
PathControls
"
+
THREE
.
PathControlsIdCounter
++
;
this
.
duration
=
1
E4
;
this
.
waypoints
=
[];
this
.
useConstantSpeed
=
true
;
this
.
resamplingCoef
=
50
;
this
.
debugPath
=
new
THREE
.
Object3D
;
this
.
debugDummy
=
new
THREE
.
Object3D
;
this
.
animationParent
=
new
THREE
.
Object3D
;
this
.
lookSpeed
=
0.005
0
;
this
.
lookHorizontal
=
this
.
lookVertical
=
true
;
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
;
var
g
=
Math
.
PI
*
2
,
h
=
Math
.
PI
/
180
;
this
.
viewHalfY
=
this
.
viewHalfX
=
0
;
this
.
domElement
!==
document
&&
this
.
domElement
.
setAttribute
(
"
tabindex
"
,
-
1
);
this
.
handleResize
=
function
(){
if
(
this
.
domElement
===
this
.
animationParent
=
new
THREE
.
Object3D
;
this
.
lookSpeed
=
0.005
;
this
.
lookHorizontal
=
this
.
lookVertical
=
true
;
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
;
var
g
=
Math
.
PI
*
2
,
h
=
Math
.
PI
/
180
;
this
.
viewHalfY
=
this
.
viewHalfX
=
0
;
this
.
domElement
!==
document
&&
this
.
domElement
.
setAttribute
(
"
tabindex
"
,
-
1
);
this
.
handleResize
=
function
(){
if
(
this
.
domElement
===
document
){
this
.
viewHalfX
=
window
.
innerWidth
/
2
;
this
.
viewHalfY
=
window
.
innerHeight
/
2
}
else
{
this
.
viewHalfX
=
this
.
domElement
.
offsetWidth
/
2
;
this
.
viewHalfY
=
this
.
domElement
.
offsetHeight
/
2
}};
this
.
update
=
function
(
a
){
var
b
;
if
(
this
.
lookHorizontal
)
this
.
lon
=
this
.
lon
+
this
.
mouseX
*
this
.
lookSpeed
*
a
;
if
(
this
.
lookVertical
)
this
.
lat
=
this
.
lat
-
this
.
mouseY
*
this
.
lookSpeed
*
a
;
this
.
lon
=
Math
.
max
(
0
,
Math
.
min
(
360
,
this
.
lon
));
this
.
lat
=
Math
.
max
(
-
85
,
Math
.
min
(
85
,
this
.
lat
));
this
.
phi
=
(
90
-
this
.
lat
)
*
h
;
this
.
theta
=
this
.
lon
*
h
;
a
=
this
.
phi
%
g
;
this
.
phi
=
document
){
this
.
viewHalfX
=
window
.
innerWidth
/
2
;
this
.
viewHalfY
=
window
.
innerHeight
/
2
}
else
{
this
.
viewHalfX
=
this
.
domElement
.
offsetWidth
/
2
;
this
.
viewHalfY
=
this
.
domElement
.
offsetHeight
/
2
}};
this
.
update
=
function
(
a
){
var
b
;
if
(
this
.
lookHorizontal
)
this
.
lon
=
this
.
lon
+
this
.
mouseX
*
this
.
lookSpeed
*
a
;
if
(
this
.
lookVertical
)
this
.
lat
=
this
.
lat
-
this
.
mouseY
*
this
.
lookSpeed
*
a
;
this
.
lon
=
Math
.
max
(
0
,
Math
.
min
(
360
,
this
.
lon
));
this
.
lat
=
Math
.
max
(
-
85
,
Math
.
min
(
85
,
this
.
lat
));
this
.
phi
=
(
90
-
this
.
lat
)
*
h
;
this
.
theta
=
this
.
lon
*
h
;
a
=
this
.
phi
%
g
;
this
.
phi
=
a
>=
0
?
a
:
a
+
g
;
b
=
this
.
verticalAngleMap
.
srcRange
;
a
=
this
.
verticalAngleMap
.
dstRange
;
b
=
THREE
.
Math
.
mapLinear
(
this
.
phi
,
b
[
0
],
b
[
1
],
a
[
0
],
a
[
1
]);
var
d
=
a
[
1
]
-
a
[
0
];
this
.
phi
=
c
((
b
-
a
[
0
])
/
d
)
*
d
+
a
[
0
];
b
=
this
.
horizontalAngleMap
.
srcRange
;
a
=
this
.
horizontalAngleMap
.
dstRange
;
b
=
THREE
.
Math
.
mapLinear
(
this
.
theta
,
b
[
0
],
b
[
1
],
a
[
0
],
a
[
1
]);
d
=
a
[
1
]
-
a
[
0
];
this
.
theta
=
c
((
b
-
a
[
0
])
/
d
)
*
d
+
a
[
0
];
a
=
this
.
target
.
position
;
a
.
x
=
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
cos
(
this
.
theta
);
a
.
y
=
100
*
Math
.
cos
(
this
.
phi
);
a
.
z
=
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
sin
(
this
.
theta
);
this
.
object
.
lookAt
(
this
.
target
.
position
)};
a
>=
0
?
a
:
a
+
g
;
b
=
this
.
verticalAngleMap
.
srcRange
;
a
=
this
.
verticalAngleMap
.
dstRange
;
b
=
THREE
.
Math
.
mapLinear
(
this
.
phi
,
b
[
0
],
b
[
1
],
a
[
0
],
a
[
1
]);
var
d
=
a
[
1
]
-
a
[
0
];
this
.
phi
=
c
((
b
-
a
[
0
])
/
d
)
*
d
+
a
[
0
];
b
=
this
.
horizontalAngleMap
.
srcRange
;
a
=
this
.
horizontalAngleMap
.
dstRange
;
b
=
THREE
.
Math
.
mapLinear
(
this
.
theta
,
b
[
0
],
b
[
1
],
a
[
0
],
a
[
1
]);
d
=
a
[
1
]
-
a
[
0
];
this
.
theta
=
c
((
b
-
a
[
0
])
/
d
)
*
d
+
a
[
0
];
a
=
this
.
target
.
position
;
a
.
x
=
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
cos
(
this
.
theta
);
a
.
y
=
100
*
Math
.
cos
(
this
.
phi
);
a
.
z
=
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
sin
(
this
.
theta
);
this
.
object
.
lookAt
(
this
.
target
.
position
)};
this
.
onMouseMove
=
function
(
a
){
if
(
this
.
domElement
===
document
){
this
.
mouseX
=
a
.
pageX
-
this
.
viewHalfX
;
this
.
mouseY
=
a
.
pageY
-
this
.
viewHalfY
}
else
{
this
.
mouseX
=
a
.
pageX
-
this
.
domElement
.
offsetLeft
-
this
.
viewHalfX
;
this
.
mouseY
=
a
.
pageY
-
this
.
domElement
.
offsetTop
-
this
.
viewHalfY
}};
this
.
init
=
function
(){
this
.
spline
=
new
THREE
.
Spline
;
this
.
spline
.
initFromArray
(
this
.
waypoints
);
this
.
useConstantSpeed
&&
this
.
spline
.
reparametrizeByArcLength
(
this
.
resamplingCoef
);
if
(
this
.
createDebugDummy
){
var
a
=
new
THREE
.
MeshLambertMaterial
({
color
:
30719
}),
this
.
onMouseMove
=
function
(
a
){
if
(
this
.
domElement
===
document
){
this
.
mouseX
=
a
.
pageX
-
this
.
viewHalfX
;
this
.
mouseY
=
a
.
pageY
-
this
.
viewHalfY
}
else
{
this
.
mouseX
=
a
.
pageX
-
this
.
domElement
.
offsetLeft
-
this
.
viewHalfX
;
this
.
mouseY
=
a
.
pageY
-
this
.
domElement
.
offsetTop
-
this
.
viewHalfY
}};
this
.
init
=
function
(){
this
.
spline
=
new
THREE
.
Spline
;
this
.
spline
.
initFromArray
(
this
.
waypoints
);
this
.
useConstantSpeed
&&
this
.
spline
.
reparametrizeByArcLength
(
this
.
resamplingCoef
);
if
(
this
.
createDebugDummy
){
var
a
=
new
THREE
.
MeshLambertMaterial
({
color
:
30719
}),
b
=
new
THREE
.
MeshLambertMaterial
({
color
:
65280
}),
c
=
new
THREE
.
CubeGeometry
(
10
,
10
,
20
),
g
=
new
THREE
.
CubeGeometry
(
2
,
2
,
10
);
this
.
animationParent
=
new
THREE
.
Mesh
(
c
,
a
);
a
=
new
THREE
.
Mesh
(
g
,
b
);
a
.
position
.
set
(
0
,
10
,
0
);
this
.
animation
=
e
(
this
.
animationParent
,
this
.
spline
,
this
.
id
,
this
.
duration
);
this
.
animationParent
.
add
(
this
.
object
);
this
.
animationParent
.
add
(
this
.
target
);
this
.
animationParent
.
add
(
a
)}
else
{
this
.
animation
=
e
(
this
.
animationParent
,
this
.
spline
,
this
.
id
,
this
.
duration
);
this
.
animationParent
.
add
(
this
.
target
);
this
.
animationParent
.
add
(
this
.
object
)}
if
(
this
.
createDebugPath
){
var
a
=
b
=
new
THREE
.
MeshLambertMaterial
({
color
:
65280
}),
c
=
new
THREE
.
CubeGeometry
(
10
,
10
,
20
),
g
=
new
THREE
.
CubeGeometry
(
2
,
2
,
10
);
this
.
animationParent
=
new
THREE
.
Mesh
(
c
,
a
);
a
=
new
THREE
.
Mesh
(
g
,
b
);
a
.
position
.
set
(
0
,
10
,
0
);
this
.
animation
=
e
(
this
.
animationParent
,
this
.
spline
,
this
.
id
,
this
.
duration
);
this
.
animationParent
.
add
(
this
.
object
);
this
.
animationParent
.
add
(
this
.
target
);
this
.
animationParent
.
add
(
a
)}
else
{
this
.
animation
=
e
(
this
.
animationParent
,
this
.
spline
,
this
.
id
,
this
.
duration
);
this
.
animationParent
.
add
(
this
.
target
);
this
.
animationParent
.
add
(
this
.
object
)}
if
(
this
.
createDebugPath
){
var
a
=
this
.
debugPath
,
b
=
this
.
spline
,
g
=
f
(
b
,
10
),
c
=
f
(
b
,
10
),
h
=
new
THREE
.
LineBasicMaterial
({
color
:
16711680
,
linewidth
:
3
}),
g
=
new
THREE
.
Line
(
g
,
h
),
c
=
new
THREE
.
ParticleSystem
(
c
,
new
THREE
.
ParticleBasicMaterial
({
color
:
16755200
,
size
:
3
}));
g
.
scale
.
set
(
1
,
1
,
1
);
a
.
add
(
g
);
c
.
scale
.
set
(
1
,
1
,
1
);
a
.
add
(
c
);
for
(
var
g
=
new
THREE
.
SphereGeometry
(
1
,
16
,
8
),
h
=
new
THREE
.
MeshBasicMaterial
({
color
:
65280
}),
k
=
0
;
k
<
b
.
points
.
length
;
k
++
){
c
=
new
THREE
.
Mesh
(
g
,
h
);
c
.
position
.
copy
(
b
.
points
[
k
]);
a
.
add
(
c
)}}
this
.
domElement
.
addEventListener
(
"
mousemove
"
,
d
(
this
,
this
.
debugPath
,
b
=
this
.
spline
,
g
=
f
(
b
,
10
),
c
=
f
(
b
,
10
),
h
=
new
THREE
.
LineBasicMaterial
({
color
:
16711680
,
linewidth
:
3
}),
g
=
new
THREE
.
Line
(
g
,
h
),
c
=
new
THREE
.
ParticleSystem
(
c
,
new
THREE
.
ParticleBasicMaterial
({
color
:
16755200
,
size
:
3
}));
g
.
scale
.
set
(
1
,
1
,
1
);
a
.
add
(
g
);
c
.
scale
.
set
(
1
,
1
,
1
);
a
.
add
(
c
);
for
(
var
g
=
new
THREE
.
SphereGeometry
(
1
,
16
,
8
),
h
=
new
THREE
.
MeshBasicMaterial
({
color
:
65280
}),
k
=
0
;
k
<
b
.
points
.
length
;
k
++
){
c
=
new
THREE
.
Mesh
(
g
,
h
);
c
.
position
.
copy
(
b
.
points
[
k
]);
a
.
add
(
c
)}}
this
.
domElement
.
addEventListener
(
"
mousemove
"
,
d
(
this
,
this
.
onMouseMove
),
false
)};
this
.
handleResize
()};
THREE
.
PathControlsIdCounter
=
0
;
this
.
onMouseMove
),
false
)};
this
.
handleResize
()};
THREE
.
PathControlsIdCounter
=
0
;
THREE
.
FlyControls
=
function
(
b
,
a
){
function
c
(
a
,
b
){
return
function
(){
b
.
apply
(
a
,
arguments
)}}
this
.
object
=
b
;
this
.
domElement
=
a
!==
void
0
?
a
:
document
;
a
&&
this
.
domElement
.
setAttribute
(
"
tabindex
"
,
-
1
);
this
.
movementSpeed
=
1
;
this
.
rollSpeed
=
0.005
0
;
this
.
autoForward
=
this
.
dragToLook
=
false
;
this
.
object
.
useQuaternion
=
true
;
this
.
tmpQuaternion
=
new
THREE
.
Quaternion
;
this
.
mouseStatus
=
0
;
this
.
moveState
=
{
up
:
0
,
down
:
0
,
left
:
0
,
right
:
0
,
forward
:
0
,
back
:
0
,
pitchUp
:
0
,
pitchDown
:
0
,
yawLeft
:
0
,
yawRight
:
0
,
rollLeft
:
0
,
rollRight
:
0
};
this
.
moveVector
=
THREE
.
FlyControls
=
function
(
b
,
a
){
function
c
(
a
,
b
){
return
function
(){
b
.
apply
(
a
,
arguments
)}}
this
.
object
=
b
;
this
.
domElement
=
a
!==
void
0
?
a
:
document
;
a
&&
this
.
domElement
.
setAttribute
(
"
tabindex
"
,
-
1
);
this
.
movementSpeed
=
1
;
this
.
rollSpeed
=
0.005
;
this
.
autoForward
=
this
.
dragToLook
=
false
;
this
.
object
.
useQuaternion
=
true
;
this
.
tmpQuaternion
=
new
THREE
.
Quaternion
;
this
.
mouseStatus
=
0
;
this
.
moveState
=
{
up
:
0
,
down
:
0
,
left
:
0
,
right
:
0
,
forward
:
0
,
back
:
0
,
pitchUp
:
0
,
pitchDown
:
0
,
yawLeft
:
0
,
yawRight
:
0
,
rollLeft
:
0
,
rollRight
:
0
};
this
.
moveVector
=
new
THREE
.
Vector3
(
0
,
0
,
0
);
this
.
rotationVector
=
new
THREE
.
Vector3
(
0
,
0
,
0
);
this
.
handleEvent
=
function
(
a
){
if
(
typeof
this
[
a
.
type
]
==
"
function
"
)
this
[
a
.
type
](
a
)};
this
.
keydown
=
function
(
a
){
if
(
!
a
.
altKey
){
switch
(
a
.
keyCode
){
case
16
:
this
.
movementSpeedMultiplier
=
0.1
;
break
;
case
87
:
this
.
moveState
.
forward
=
1
;
break
;
case
83
:
this
.
moveState
.
back
=
1
;
break
;
case
65
:
this
.
moveState
.
left
=
1
;
break
;
case
68
:
this
.
moveState
.
right
=
1
;
break
;
case
82
:
this
.
moveState
.
up
=
1
;
break
;
case
70
:
this
.
moveState
.
down
=
1
;
break
;
case
38
:
this
.
moveState
.
pitchUp
=
new
THREE
.
Vector3
(
0
,
0
,
0
);
this
.
rotationVector
=
new
THREE
.
Vector3
(
0
,
0
,
0
);
this
.
handleEvent
=
function
(
a
){
if
(
typeof
this
[
a
.
type
]
==
"
function
"
)
this
[
a
.
type
](
a
)};
this
.
keydown
=
function
(
a
){
if
(
!
a
.
altKey
){
switch
(
a
.
keyCode
){
case
16
:
this
.
movementSpeedMultiplier
=
0.1
;
break
;
case
87
:
this
.
moveState
.
forward
=
1
;
break
;
case
83
:
this
.
moveState
.
back
=
1
;
break
;
case
65
:
this
.
moveState
.
left
=
1
;
break
;
case
68
:
this
.
moveState
.
right
=
1
;
break
;
case
82
:
this
.
moveState
.
up
=
1
;
break
;
case
70
:
this
.
moveState
.
down
=
1
;
break
;
case
38
:
this
.
moveState
.
pitchUp
=
1
;
break
;
case
40
:
this
.
moveState
.
pitchDown
=
1
;
break
;
case
37
:
this
.
moveState
.
yawLeft
=
1
;
break
;
case
39
:
this
.
moveState
.
yawRight
=
1
;
break
;
case
81
:
this
.
moveState
.
rollLeft
=
1
;
break
;
case
69
:
this
.
moveState
.
rollRight
=
1
}
this
.
updateMovementVector
();
this
.
updateRotationVector
()}};
this
.
keyup
=
function
(
a
){
switch
(
a
.
keyCode
){
case
16
:
this
.
movementSpeedMultiplier
=
1
;
break
;
case
87
:
this
.
moveState
.
forward
=
0
;
break
;
case
83
:
this
.
moveState
.
back
=
0
;
break
;
case
65
:
this
.
moveState
.
left
=
0
;
break
;
case
68
:
this
.
moveState
.
right
=
0
;
break
;
case
82
:
this
.
moveState
.
up
=
1
;
break
;
case
40
:
this
.
moveState
.
pitchDown
=
1
;
break
;
case
37
:
this
.
moveState
.
yawLeft
=
1
;
break
;
case
39
:
this
.
moveState
.
yawRight
=
1
;
break
;
case
81
:
this
.
moveState
.
rollLeft
=
1
;
break
;
case
69
:
this
.
moveState
.
rollRight
=
1
}
this
.
updateMovementVector
();
this
.
updateRotationVector
()}};
this
.
keyup
=
function
(
a
){
switch
(
a
.
keyCode
){
case
16
:
this
.
movementSpeedMultiplier
=
1
;
break
;
case
87
:
this
.
moveState
.
forward
=
0
;
break
;
case
83
:
this
.
moveState
.
back
=
0
;
break
;
case
65
:
this
.
moveState
.
left
=
0
;
break
;
case
68
:
this
.
moveState
.
right
=
0
;
break
;
case
82
:
this
.
moveState
.
up
=
0
;
break
;
case
70
:
this
.
moveState
.
down
=
0
;
break
;
case
38
:
this
.
moveState
.
pitchUp
=
0
;
break
;
case
40
:
this
.
moveState
.
pitchDown
=
0
;
break
;
case
37
:
this
.
moveState
.
yawLeft
=
0
;
break
;
case
39
:
this
.
moveState
.
yawRight
=
0
;
break
;
case
81
:
this
.
moveState
.
rollLeft
=
0
;
break
;
case
69
:
this
.
moveState
.
rollRight
=
0
}
this
.
updateMovementVector
();
this
.
updateRotationVector
()};
this
.
mousedown
=
function
(
a
){
this
.
domElement
!==
document
&&
this
.
domElement
.
focus
();
a
.
preventDefault
();
a
.
stopPropagation
();
if
(
this
.
dragToLook
)
this
.
mouseStatus
++
;
else
switch
(
a
.
button
){
case
0
:
this
.
object
.
moveForward
=
0
;
break
;
case
70
:
this
.
moveState
.
down
=
0
;
break
;
case
38
:
this
.
moveState
.
pitchUp
=
0
;
break
;
case
40
:
this
.
moveState
.
pitchDown
=
0
;
break
;
case
37
:
this
.
moveState
.
yawLeft
=
0
;
break
;
case
39
:
this
.
moveState
.
yawRight
=
0
;
break
;
case
81
:
this
.
moveState
.
rollLeft
=
0
;
break
;
case
69
:
this
.
moveState
.
rollRight
=
0
}
this
.
updateMovementVector
();
this
.
updateRotationVector
()};
this
.
mousedown
=
function
(
a
){
this
.
domElement
!==
document
&&
this
.
domElement
.
focus
();
a
.
preventDefault
();
a
.
stopPropagation
();
if
(
this
.
dragToLook
)
this
.
mouseStatus
++
;
else
switch
(
a
.
button
){
case
0
:
this
.
object
.
moveForward
=
...
@@ -273,7 +273,7 @@ a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST);if(a.getParameter(a
...
@@ -273,7 +273,7 @@ a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST);if(a.getParameter(a
"
color
"
);
n
.
scale
=
a
.
getUniformLocation
(
l
,
"
scale
"
);
n
.
rotation
=
a
.
getUniformLocation
(
l
,
"
rotation
"
);
n
.
screenPosition
=
a
.
getUniformLocation
(
l
,
"
screenPosition
"
);
k
=
false
};
this
.
render
=
function
(
b
,
d
,
e
,
s
){
var
b
=
b
.
__webglFlares
,
u
=
b
.
length
;
if
(
u
){
var
t
=
new
THREE
.
Vector3
,
r
=
s
/
e
,
v
=
e
*
0.5
,
z
=
s
*
0.5
,
A
=
16
/
s
,
x
=
new
THREE
.
Vector2
(
A
*
r
,
A
),
w
=
new
THREE
.
Vector3
(
1
,
1
,
0
),
C
=
new
THREE
.
Vector2
(
1
,
1
),
B
=
n
,
A
=
m
;
a
.
useProgram
(
l
);
if
(
!
k
){
a
.
enableVertexAttribArray
(
m
.
vertex
);
a
.
enableVertexAttribArray
(
m
.
uv
);
k
=
true
}
a
.
uniform1i
(
B
.
occlusionMap
,
0
);
a
.
uniform1i
(
B
.
map
,
"
color
"
);
n
.
scale
=
a
.
getUniformLocation
(
l
,
"
scale
"
);
n
.
rotation
=
a
.
getUniformLocation
(
l
,
"
rotation
"
);
n
.
screenPosition
=
a
.
getUniformLocation
(
l
,
"
screenPosition
"
);
k
=
false
};
this
.
render
=
function
(
b
,
d
,
e
,
s
){
var
b
=
b
.
__webglFlares
,
u
=
b
.
length
;
if
(
u
){
var
t
=
new
THREE
.
Vector3
,
r
=
s
/
e
,
v
=
e
*
0.5
,
z
=
s
*
0.5
,
A
=
16
/
s
,
x
=
new
THREE
.
Vector2
(
A
*
r
,
A
),
w
=
new
THREE
.
Vector3
(
1
,
1
,
0
),
C
=
new
THREE
.
Vector2
(
1
,
1
),
B
=
n
,
A
=
m
;
a
.
useProgram
(
l
);
if
(
!
k
){
a
.
enableVertexAttribArray
(
m
.
vertex
);
a
.
enableVertexAttribArray
(
m
.
uv
);
k
=
true
}
a
.
uniform1i
(
B
.
occlusionMap
,
0
);
a
.
uniform1i
(
B
.
map
,
1
);
a
.
bindBuffer
(
a
.
ARRAY_BUFFER
,
f
);
a
.
vertexAttribPointer
(
A
.
vertex
,
2
,
a
.
FLOAT
,
false
,
16
,
0
);
a
.
vertexAttribPointer
(
A
.
uv
,
2
,
a
.
FLOAT
,
false
,
16
,
8
);
a
.
bindBuffer
(
a
.
ELEMENT_ARRAY_BUFFER
,
g
);
a
.
disable
(
a
.
CULL_FACE
);
a
.
depthMask
(
false
);
var
E
,
G
,
L
,
H
,
D
;
for
(
E
=
0
;
E
<
u
;
E
++
){
A
=
16
/
s
;
x
.
set
(
A
*
r
,
A
);
H
=
b
[
E
];
t
.
set
(
H
.
matrixWorld
.
elements
[
12
],
H
.
matrixWorld
.
elements
[
13
],
H
.
matrixWorld
.
elements
[
14
]);
d
.
matrixWorldInverse
.
multiplyVector3
(
t
);
d
.
projectionMatrix
.
multiplyVector3
(
t
);
w
.
copy
(
t
);
C
.
x
=
w
.
x
*
v
+
v
;
C
.
y
=
w
.
y
*
z
+
z
;
if
(
j
||
C
.
x
>
0
&&
C
.
x
<
e
&&
C
.
y
>
0
&&
1
);
a
.
bindBuffer
(
a
.
ARRAY_BUFFER
,
f
);
a
.
vertexAttribPointer
(
A
.
vertex
,
2
,
a
.
FLOAT
,
false
,
16
,
0
);
a
.
vertexAttribPointer
(
A
.
uv
,
2
,
a
.
FLOAT
,
false
,
16
,
8
);
a
.
bindBuffer
(
a
.
ELEMENT_ARRAY_BUFFER
,
g
);
a
.
disable
(
a
.
CULL_FACE
);
a
.
depthMask
(
false
);
var
E
,
G
,
L
,
H
,
D
;
for
(
E
=
0
;
E
<
u
;
E
++
){
A
=
16
/
s
;
x
.
set
(
A
*
r
,
A
);
H
=
b
[
E
];
t
.
set
(
H
.
matrixWorld
.
elements
[
12
],
H
.
matrixWorld
.
elements
[
13
],
H
.
matrixWorld
.
elements
[
14
]);
d
.
matrixWorldInverse
.
multiplyVector3
(
t
);
d
.
projectionMatrix
.
multiplyVector3
(
t
);
w
.
copy
(
t
);
C
.
x
=
w
.
x
*
v
+
v
;
C
.
y
=
w
.
y
*
z
+
z
;
if
(
j
||
C
.
x
>
0
&&
C
.
x
<
e
&&
C
.
y
>
0
&&
C
.
y
<
s
){
a
.
activeTexture
(
a
.
TEXTURE1
);
a
.
bindTexture
(
a
.
TEXTURE_2D
,
h
);
a
.
copyTexImage2D
(
a
.
TEXTURE_2D
,
0
,
a
.
RGB
,
C
.
x
-
8
,
C
.
y
-
8
,
16
,
16
,
0
);
a
.
uniform1i
(
B
.
renderType
,
0
);
a
.
uniform2f
(
B
.
scale
,
x
.
x
,
x
.
y
);
a
.
uniform3f
(
B
.
screenPosition
,
w
.
x
,
w
.
y
,
w
.
z
);
a
.
disable
(
a
.
BLEND
);
a
.
enable
(
a
.
DEPTH_TEST
);
a
.
drawElements
(
a
.
TRIANGLES
,
6
,
a
.
UNSIGNED_SHORT
,
0
);
a
.
activeTexture
(
a
.
TEXTURE0
);
a
.
bindTexture
(
a
.
TEXTURE_2D
,
i
);
a
.
copyTexImage2D
(
a
.
TEXTURE_2D
,
0
,
a
.
RGBA
,
C
.
x
-
8
,
C
.
y
-
8
,
16
,
16
,
0
);
a
.
uniform1i
(
B
.
renderType
,
1
);
a
.
disable
(
a
.
DEPTH_TEST
);
a
.
activeTexture
(
a
.
TEXTURE1
);
C
.
y
<
s
){
a
.
activeTexture
(
a
.
TEXTURE1
);
a
.
bindTexture
(
a
.
TEXTURE_2D
,
h
);
a
.
copyTexImage2D
(
a
.
TEXTURE_2D
,
0
,
a
.
RGB
,
C
.
x
-
8
,
C
.
y
-
8
,
16
,
16
,
0
);
a
.
uniform1i
(
B
.
renderType
,
0
);
a
.
uniform2f
(
B
.
scale
,
x
.
x
,
x
.
y
);
a
.
uniform3f
(
B
.
screenPosition
,
w
.
x
,
w
.
y
,
w
.
z
);
a
.
disable
(
a
.
BLEND
);
a
.
enable
(
a
.
DEPTH_TEST
);
a
.
drawElements
(
a
.
TRIANGLES
,
6
,
a
.
UNSIGNED_SHORT
,
0
);
a
.
activeTexture
(
a
.
TEXTURE0
);
a
.
bindTexture
(
a
.
TEXTURE_2D
,
i
);
a
.
copyTexImage2D
(
a
.
TEXTURE_2D
,
0
,
a
.
RGBA
,
C
.
x
-
8
,
C
.
y
-
8
,
16
,
16
,
0
);
a
.
uniform1i
(
B
.
renderType
,
1
);
a
.
disable
(
a
.
DEPTH_TEST
);
a
.
activeTexture
(
a
.
TEXTURE1
);
a
.
bindTexture
(
a
.
TEXTURE_2D
,
h
);
a
.
drawElements
(
a
.
TRIANGLES
,
6
,
a
.
UNSIGNED_SHORT
,
0
);
H
.
positionScreen
.
copy
(
w
);
H
.
customUpdateCallback
?
H
.
customUpdateCallback
(
H
):
H
.
updateLensFlares
();
a
.
uniform1i
(
B
.
renderType
,
2
);
a
.
enable
(
a
.
BLEND
);
G
=
0
;
for
(
L
=
H
.
lensFlares
.
length
;
G
<
L
;
G
++
){
D
=
H
.
lensFlares
[
G
];
if
(
D
.
opacity
>
0.001
0
&&
D
.
scale
>
0.0010
){
w
.
x
=
D
.
x
;
w
.
y
=
D
.
y
;
w
.
z
=
D
.
z
;
A
=
D
.
size
*
D
.
scale
/
s
;
x
.
x
=
A
*
r
;
x
.
y
=
A
;
a
.
uniform3f
(
B
.
screenPosition
,
w
.
x
,
w
.
y
,
w
.
z
);
a
.
uniform2f
(
B
.
scale
,
x
.
x
,
x
.
y
);
a
.
uniform1f
(
B
.
rotation
,
D
.
rotation
);
a
.
uniform1f
(
B
.
opacity
,
D
.
opacity
);
a
.
bindTexture
(
a
.
TEXTURE_2D
,
h
);
a
.
drawElements
(
a
.
TRIANGLES
,
6
,
a
.
UNSIGNED_SHORT
,
0
);
H
.
positionScreen
.
copy
(
w
);
H
.
customUpdateCallback
?
H
.
customUpdateCallback
(
H
):
H
.
updateLensFlares
();
a
.
uniform1i
(
B
.
renderType
,
2
);
a
.
enable
(
a
.
BLEND
);
G
=
0
;
for
(
L
=
H
.
lensFlares
.
length
;
G
<
L
;
G
++
){
D
=
H
.
lensFlares
[
G
];
if
(
D
.
opacity
>
0.001
&&
D
.
scale
>
0.001
){
w
.
x
=
D
.
x
;
w
.
y
=
D
.
y
;
w
.
z
=
D
.
z
;
A
=
D
.
size
*
D
.
scale
/
s
;
x
.
x
=
A
*
r
;
x
.
y
=
A
;
a
.
uniform3f
(
B
.
screenPosition
,
w
.
x
,
w
.
y
,
w
.
z
);
a
.
uniform2f
(
B
.
scale
,
x
.
x
,
x
.
y
);
a
.
uniform1f
(
B
.
rotation
,
D
.
rotation
);
a
.
uniform1f
(
B
.
opacity
,
D
.
opacity
);
a
.
uniform3f
(
B
.
color
,
D
.
color
.
r
,
D
.
color
.
g
,
D
.
color
.
b
);
c
.
setBlending
(
D
.
blending
,
D
.
blendEquation
,
D
.
blendSrc
,
D
.
blendDst
);
c
.
setTexture
(
D
.
texture
,
1
);
a
.
drawElements
(
a
.
TRIANGLES
,
6
,
a
.
UNSIGNED_SHORT
,
0
)}}}}
a
.
enable
(
a
.
CULL_FACE
);
a
.
enable
(
a
.
DEPTH_TEST
);
a
.
depthMask
(
true
)}}};
a
.
uniform3f
(
B
.
color
,
D
.
color
.
r
,
D
.
color
.
g
,
D
.
color
.
b
);
c
.
setBlending
(
D
.
blending
,
D
.
blendEquation
,
D
.
blendSrc
,
D
.
blendDst
);
c
.
setTexture
(
D
.
texture
,
1
);
a
.
drawElements
(
a
.
TRIANGLES
,
6
,
a
.
UNSIGNED_SHORT
,
0
)}}}}
a
.
enable
(
a
.
CULL_FACE
);
a
.
enable
(
a
.
DEPTH_TEST
);
a
.
depthMask
(
true
)}}};
THREE
.
ShadowMapPlugin
=
function
(){
var
b
,
a
,
c
,
d
,
e
,
f
=
new
THREE
.
Frustum
,
g
=
new
THREE
.
Matrix4
,
h
=
new
THREE
.
Vector3
,
i
=
new
THREE
.
Vector3
;
this
.
init
=
function
(
f
){
b
=
f
.
context
;
a
=
f
;
var
f
=
THREE
.
ShaderLib
.
depthRGBA
,
g
=
THREE
.
UniformsUtils
.
clone
(
f
.
uniforms
);
c
=
new
THREE
.
ShaderMaterial
({
fragmentShader
:
f
.
fragmentShader
,
vertexShader
:
f
.
vertexShader
,
uniforms
:
g
});
d
=
new
THREE
.
ShaderMaterial
({
fragmentShader
:
f
.
fragmentShader
,
vertexShader
:
f
.
vertexShader
,
uniforms
:
g
,
morphTargets
:
true
});
e
=
new
THREE
.
ShaderMaterial
({
fragmentShader
:
f
.
fragmentShader
,
THREE
.
ShadowMapPlugin
=
function
(){
var
b
,
a
,
c
,
d
,
e
,
f
=
new
THREE
.
Frustum
,
g
=
new
THREE
.
Matrix4
,
h
=
new
THREE
.
Vector3
,
i
=
new
THREE
.
Vector3
;
this
.
init
=
function
(
f
){
b
=
f
.
context
;
a
=
f
;
var
f
=
THREE
.
ShaderLib
.
depthRGBA
,
g
=
THREE
.
UniformsUtils
.
clone
(
f
.
uniforms
);
c
=
new
THREE
.
ShaderMaterial
({
fragmentShader
:
f
.
fragmentShader
,
vertexShader
:
f
.
vertexShader
,
uniforms
:
g
});
d
=
new
THREE
.
ShaderMaterial
({
fragmentShader
:
f
.
fragmentShader
,
vertexShader
:
f
.
vertexShader
,
uniforms
:
g
,
morphTargets
:
true
});
e
=
new
THREE
.
ShaderMaterial
({
fragmentShader
:
f
.
fragmentShader
,
vertexShader
:
f
.
vertexShader
,
uniforms
:
g
,
skinning
:
true
});
c
.
_shadowPass
=
true
;
d
.
_shadowPass
=
true
;
e
.
_shadowPass
=
true
};
this
.
render
=
function
(
b
,
c
){
a
.
shadowMapEnabled
&&
a
.
shadowMapAutoUpdate
&&
this
.
update
(
b
,
c
)};
this
.
update
=
function
(
j
,
l
){
var
m
,
n
,
k
,
o
,
q
,
p
,
s
,
u
,
t
,
r
=
[];
o
=
0
;
b
.
clearColor
(
1
,
1
,
1
,
1
);
b
.
disable
(
b
.
BLEND
);
b
.
enable
(
b
.
CULL_FACE
);
a
.
shadowMapCullFrontFaces
?
b
.
cullFace
(
b
.
FRONT
):
b
.
cullFace
(
b
.
BACK
);
a
.
setDepthTest
(
true
);
m
=
0
;
for
(
n
=
j
.
__lights
.
length
;
m
<
n
;
m
++
){
k
=
j
.
__lights
[
m
];
if
(
k
.
castShadow
)
if
(
k
instanceof
THREE
.
DirectionalLight
&&
vertexShader
:
f
.
vertexShader
,
uniforms
:
g
,
skinning
:
true
});
c
.
_shadowPass
=
true
;
d
.
_shadowPass
=
true
;
e
.
_shadowPass
=
true
};
this
.
render
=
function
(
b
,
c
){
a
.
shadowMapEnabled
&&
a
.
shadowMapAutoUpdate
&&
this
.
update
(
b
,
c
)};
this
.
update
=
function
(
j
,
l
){
var
m
,
n
,
k
,
o
,
q
,
p
,
s
,
u
,
t
,
r
=
[];
o
=
0
;
b
.
clearColor
(
1
,
1
,
1
,
1
);
b
.
disable
(
b
.
BLEND
);
b
.
enable
(
b
.
CULL_FACE
);
a
.
shadowMapCullFrontFaces
?
b
.
cullFace
(
b
.
FRONT
):
b
.
cullFace
(
b
.
BACK
);
a
.
setDepthTest
(
true
);
m
=
0
;
for
(
n
=
j
.
__lights
.
length
;
m
<
n
;
m
++
){
k
=
j
.
__lights
[
m
];
if
(
k
.
castShadow
)
if
(
k
instanceof
THREE
.
DirectionalLight
&&
...
...
build/custom/ThreeWebGL.js
浏览文件 @
ee7d002a
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录