Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
d006967b
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,体验更适合开发者的 AI 搜索 >>
提交
d006967b
编写于
3月 01, 2011
作者:
A
alteredq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added autospeed based on height to QuakeCamera.
上级
fab828e8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
36 addition
and
12 deletion
+36
-12
build/Three.js
build/Three.js
+10
-10
src/cameras/QuakeCamera.js
src/cameras/QuakeCamera.js
+26
-2
未找到文件。
build/Three.js
浏览文件 @
d006967b
...
...
@@ -80,16 +80,16 @@ THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=T
THREE
.
Camera
.
prototype
.
update
=
function
(
a
,
b
,
c
){
if
(
this
.
useTarget
){
this
.
matrix
.
lookAt
(
this
.
position
,
this
.
target
.
position
,
this
.
up
);
a
?
this
.
matrixWorld
.
multiply
(
a
,
this
.
matrix
):
this
.
matrixWorld
.
copy
(
this
.
matrix
);
THREE
.
Matrix4
.
makeInvert
(
this
.
matrixWorld
,
this
.
matrixWorldInverse
);
b
=!
0
}
else
{
this
.
matrixAutoUpdate
&&
(
b
|=
this
.
updateMatrix
());
if
(
b
||
this
.
matrixNeedsUpdate
){
a
?
this
.
matrixWorld
.
multiply
(
a
,
this
.
matrix
):
this
.
matrixWorld
.
copy
(
this
.
matrix
);
this
.
matrixNeedsUpdate
=!
1
;
b
=!
0
;
THREE
.
Matrix4
.
makeInvert
(
this
.
matrixWorld
,
this
.
matrixWorldInverse
)}}
for
(
a
=
0
;
a
<
this
.
children
.
length
;
a
++
)
this
.
children
[
a
].
update
(
this
.
matrixWorld
,
b
,
c
)};
THREE
.
Camera
.
prototype
.
frustumContains
=
function
(
a
){
var
b
=
a
.
matrixWorld
.
n14
,
c
=
a
.
matrixWorld
.
n24
,
d
=
a
.
matrixWorld
.
n34
,
f
=
this
.
matrixWorldInverse
,
g
=
a
.
boundRadius
*
a
.
boundRadiusScale
,
h
=
f
.
n31
*
b
+
f
.
n32
*
c
+
f
.
n33
*
d
+
f
.
n34
;
if
(
h
-
g
>-
this
.
near
)
return
!
1
;
if
(
h
+
g
<-
this
.
far
)
return
!
1
;
h
-=
g
;
var
k
=
this
.
projectionMatrix
,
j
=
1
/
(
k
.
n43
*
h
),
l
=
j
*
this
.
screenCenterX
,
n
=
(
f
.
n11
*
b
+
f
.
n12
*
c
+
f
.
n13
*
d
+
f
.
n14
)
*
k
.
n11
*
l
;
g
=
k
.
n11
*
g
*
l
;
if
(
n
+
g
<-
this
.
screenCenterX
)
return
!
1
;
if
(
n
-
g
>
this
.
screenCenterX
)
return
!
1
;
b
=
(
f
.
n21
*
b
+
f
.
n22
*
c
+
f
.
n23
*
d
+
f
.
n24
)
*
k
.
n22
*
j
*
this
.
screenCenterY
;
if
(
b
+
g
<-
this
.
screenCenterY
)
return
!
1
;
if
(
b
-
g
>
this
.
screenCenterY
)
return
!
1
;
a
.
positionScreen
.
set
(
n
,
b
,
h
,
g
);
return
!
0
};
function
bind
(
a
,
b
){
return
function
(){
b
.
apply
(
a
,
arguments
)}}
THREE
.
QuakeCamera
=
function
(
a
){
THREE
.
Camera
.
call
(
this
,
a
.
fov
,
a
.
aspect
,
a
.
near
,
a
.
far
,
a
.
target
);
this
.
movementSpeed
=
1
;
this
.
lookSpeed
=
0.0050
;
this
.
noFly
=!
1
;
this
.
lookVertical
=!
0
;
this
.
autoForward
=!
1
;
this
.
domElement
=
document
;
if
(
a
){
if
(
a
.
movementSpeed
!==
undefined
)
this
.
movementSpeed
=
a
.
movementSpeed
;
if
(
a
.
lookSpeed
!==
undefined
)
this
.
lookSpeed
=
a
.
lookSpeed
;
if
(
a
.
noFly
!==
undefined
)
this
.
noFly
=
a
.
noFly
;
if
(
a
.
lookVertical
!==
undefined
)
this
.
lookVertical
=
a
.
lookVertical
;
if
(
a
.
autoForward
!==
undefined
)
this
.
autoForward
=
a
.
autoForward
;
if
(
a
.
domElement
!==
undefined
)
this
.
domElement
=
a
.
domElement
}
this
.
theta
=
this
.
phy
=
this
.
lon
=
this
.
lat
=
this
.
mouseY
=
this
.
mouseX
=
0
;
this
.
moveForward
=!
1
;
this
.
moveBackward
=!
1
;
this
.
moveLeft
=!
1
;
this
.
moveRight
=!
1
;
this
.
windowHalfX
=
window
.
innerWidth
/
2
;
this
.
windowHalfY
=
window
.
innerHeight
/
2
;
this
.
onMouseDown
=
function
(
b
){
b
.
preventDefault
();
b
.
stopPropagation
();
switch
(
b
.
button
){
case
0
:
this
.
moveForward
=!
0
;
break
;
case
2
:
this
.
moveBackward
=!
0
}};
this
.
onMouseUp
=
function
(
b
){
b
.
preventDefault
();
b
.
stopPropagation
();
switch
(
b
.
button
){
case
0
:
this
.
moveForward
=
!
1
;
break
;
case
2
:
this
.
moveBackward
=!
1
}};
this
.
onMouseMove
=
function
(
b
){
this
.
mouseX
=
b
.
clientX
-
this
.
windowHalfX
;
this
.
mouseY
=
b
.
clientY
-
this
.
windowHalfY
};
this
.
onKeyDown
=
function
(
b
){
switch
(
b
.
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
}};
this
.
onKeyUp
=
function
(
b
){
switch
(
b
.
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
}};
this
.
update
=
function
(){(
this
.
moveForward
||
this
.
autoForward
)
&&
this
.
translateZ
(
-
this
.
movementSpeed
,
this
.
noFly
);
this
.
moveBackward
&&
this
.
translateZ
(
this
.
movementSpeed
,
this
.
noFly
);
this
.
moveLeft
&&
this
.
translateX
(
-
this
.
movementSpeed
,
this
.
noFly
);
this
.
moveRight
&&
this
.
translateX
(
this
.
movementSpeed
,
this
.
noFly
);
this
.
lon
+=
this
.
mouseX
*
this
.
lookSpeed
;
this
.
lookVertical
&&
(
this
.
lat
-=
this
.
mouseY
*
this
.
lookSpeed
);
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
.
position
,
c
=
this
.
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
.
supr
.
update
.
call
(
this
)};
this
.
domElement
.
addEventListener
(
"
contextmenu
"
,
function
(
b
){
b
.
preventDefault
()},
!
1
);
this
.
domElement
.
addEventListener
(
"
mousemove
"
,
bind
(
this
,
this
.
onMouseMove
),
!
1
);
this
.
domElement
.
addEventListener
(
"
mousedown
"
,
bind
(
this
,
this
.
onMouseDown
),
!
1
);
this
.
domElement
.
addEventListener
(
"
mouseup
"
,
b
ind
(
this
,
this
.
onMouseUp
),
!
1
);
this
.
domElement
.
addEventListener
(
"
keydown
"
,
bind
(
this
,
this
.
onKeyDown
),
!
1
);
this
.
domElement
.
addEventListener
(
"
keyup
"
,
bind
(
this
,
this
.
onKeyUp
),
!
1
)};
THREE
.
QuakeCamera
.
prototype
=
new
THREE
.
Camera
;
THREE
.
QuakeCamera
.
prototype
.
constructor
=
THREE
.
QuakeCamera
;
THREE
.
QuakeCamera
.
prototype
.
supr
=
THREE
.
Camera
.
prototype
;
THREE
.
Light
=
function
(
a
){
THREE
.
Object3D
.
call
(
this
);
this
.
color
=
new
THREE
.
Color
(
a
)};
THREE
.
Light
.
prototype
=
new
THREE
.
Object3D
;
THREE
.
Light
.
prototype
.
constructor
=
THREE
.
Light
;
THREE
.
Light
.
prototype
.
supr
=
THREE
.
Object3D
.
prototype
;
THREE
.
AmbientLight
=
function
(
a
){
THREE
.
Light
.
call
(
this
,
a
)};
THREE
.
AmbientLight
.
prototype
=
new
THREE
.
Light
;
THREE
.
AmbientLight
.
prototype
.
constructor
=
THREE
.
AmbientLight
;
THREE
.
DirectionalLight
=
function
(
a
,
b
){
THREE
.
Light
.
call
(
this
,
a
);
this
.
position
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
intensity
=
b
||
1
};
THREE
.
DirectionalLight
.
prototype
=
new
THREE
.
Light
;
THREE
.
DirectionalLight
.
prototype
.
constructor
=
THREE
.
Directional
Light
;
THREE
.
PointLight
=
function
(
a
,
b
){
THREE
.
Light
.
call
(
this
,
a
);
this
.
position
=
new
THREE
.
Vector3
;
this
.
intensity
=
b
||
1
};
THREE
.
PointLight
.
prototype
=
new
THREE
.
Light
;
THREE
.
PointLight
.
prototype
.
constructor
=
THREE
.
PointLight
;
THREE
.
FlatShading
=
0
;
THREE
.
SmoothShading
=
1
;
THREE
.
NormalBlending
=
0
;
THREE
.
AdditiveBlending
=
1
;
THREE
.
SubtractiveBlending
=
2
;
THREE
.
BillboardBlending
=
3
;
THREE
.
ReverseSubtractiveBlending
=
4
;
THREE
.
MaterialCounter
=
{
value
:
0
};
THREE
.
CubeReflectionMapping
=
function
(){};
THREE
.
CubeRefractionMapping
=
function
(){}
;
THREE
.
LatitudeReflectionMapping
=
function
(){};
THREE
.
LatitudeRefractionMapping
=
function
(){};
THREE
.
SphericalReflectionMapping
=
function
(){};
THREE
.
SphericalRefractionMapping
=
function
(){};
THREE
.
UVMapping
=
function
(){};
if
(
b
+
g
<-
this
.
screenCenterY
)
return
!
1
;
if
(
b
-
g
>
this
.
screenCenterY
)
return
!
1
;
a
.
positionScreen
.
set
(
n
,
b
,
h
,
g
);
return
!
0
};
function
bind
(
a
,
b
){
return
function
(){
b
.
apply
(
a
,
arguments
)}}
function
clamp_bottom
(
a
,
b
){
return
a
<
b
?
b
:
a
}
THREE
.
QuakeCamera
=
function
(
a
){
THREE
.
Camera
.
call
(
this
,
a
.
fov
,
a
.
aspect
,
a
.
near
,
a
.
far
,
a
.
target
);
this
.
movementSpeed
=
1
;
this
.
lookSpeed
=
0.0050
;
this
.
noFly
=!
1
;
this
.
lookVertical
=!
0
;
this
.
autoForward
=!
1
;
this
.
heightCoef
=
1
;
this
.
heightMin
=
0
;
this
.
domElement
=
document
;
if
(
a
){
if
(
a
.
movementSpeed
!==
undefined
)
this
.
movementSpeed
=
a
.
movementSpeed
;
if
(
a
.
lookSpeed
!==
undefined
)
this
.
lookSpeed
=
a
.
lookSpeed
;
if
(
a
.
noFly
!==
undefined
)
this
.
noFly
=
a
.
noFly
;
if
(
a
.
lookVertical
!==
undefined
)
this
.
lookVertical
=
a
.
lookVertical
;
if
(
a
.
autoForward
!==
undefined
)
this
.
autoForward
=
a
.
autoForward
;
if
(
a
.
autoSpeed
!==
undefined
)
this
.
autoSpeed
=
a
.
autoSpeed
;
if
(
a
.
heightCoef
!==
undefined
)
this
.
heightCoef
=
a
.
heightCoef
;
if
(
a
.
heightMin
!==
undefined
)
this
.
heightMin
=
a
.
heightMin
;
if
(
a
.
domElement
!==
undefined
)
this
.
domElement
=
a
.
domElement
}
this
.
autoSpeedFactor
=
1
;
this
.
theta
=
this
.
phy
=
this
.
lon
=
this
.
lat
=
this
.
mouseY
=
this
.
mouseX
=
0
;
this
.
moveForward
=!
1
;
this
.
moveBackward
=!
1
;
this
.
moveLeft
=!
1
;
this
.
moveRight
=!
1
;
this
.
windowHalfX
=
window
.
innerWidth
/
2
;
this
.
windowHalfY
=
window
.
innerHeight
/
2
;
this
.
onMouseDown
=
function
(
b
){
b
.
preventDefault
();
b
.
stopPropagation
();
switch
(
b
.
button
){
case
0
:
this
.
moveForward
=!
0
;
break
;
case
2
:
this
.
moveBackward
=!
0
}};
this
.
onMouseUp
=
function
(
b
){
b
.
preventDefault
();
b
.
stopPropagation
();
switch
(
b
.
button
){
case
0
:
this
.
moveForward
=!
1
;
break
;
case
2
:
this
.
moveBackward
=!
1
}};
this
.
onMouseMove
=
function
(
b
){
this
.
mouseX
=
b
.
clientX
-
this
.
windowHalfX
;
this
.
mouseY
=
b
.
clientY
-
this
.
windowHalfY
};
this
.
onKeyDown
=
function
(
b
){
switch
(
b
.
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
}};
this
.
onKeyUp
=
function
(
b
){
switch
(
b
.
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
}};
this
.
update
=
function
(){
if
(
this
.
autoSpeed
)
this
.
autoSpeedFactor
=
this
.
position
.
y
>
this
.
heightMin
?
clamp_bottom
((
this
.
position
.
y
-
this
.
heightMin
)
*
this
.
heightCoef
,
1
):
1
;(
this
.
moveForward
||
this
.
autoForward
)
&&
this
.
translateZ
(
-
this
.
movementSpeed
*
this
.
autoSpeedFactor
,
this
.
noFly
);
this
.
moveBackward
&&
this
.
translateZ
(
this
.
movementSpeed
,
this
.
noFly
);
this
.
moveLeft
&&
this
.
translateX
(
-
this
.
movementSpeed
,
this
.
noFly
);
this
.
moveRight
&&
this
.
translateX
(
this
.
movementSpeed
,
this
.
noFly
);
this
.
lon
+=
this
.
mouseX
*
this
.
lookSpeed
;
this
.
lookVertical
&&
(
this
.
lat
-=
this
.
mouseY
*
this
.
lookSpeed
);
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
.
position
,
c
=
this
.
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
.
supr
.
update
.
call
(
this
)};
this
.
domElement
.
addEventListener
(
"
contextmenu
"
,
function
(
b
){
b
.
preventDefault
()},
!
1
);
this
.
domElement
.
addEventListener
(
"
mousemove
"
,
bind
(
this
,
this
.
onMouseMove
),
!
1
);
this
.
domElement
.
addEventListener
(
"
mousedown
"
,
bind
(
this
,
this
.
onMouseDown
),
!
1
);
this
.
domElement
.
addEventListener
(
"
mouseup
"
,
bind
(
this
,
this
.
onMouseUp
),
!
1
);
this
.
domElement
.
addEventListener
(
"
keydown
"
,
bind
(
this
,
this
.
onKeyDown
),
!
1
);
this
.
domElement
.
addEventListener
(
"
keyup
"
,
bind
(
this
,
this
.
onKeyUp
),
!
1
)};
THREE
.
QuakeCamera
.
prototype
=
new
THREE
.
Camera
;
THREE
.
QuakeCamera
.
prototype
.
constructor
=
THREE
.
QuakeCamera
;
THREE
.
QuakeCamera
.
prototype
.
supr
=
THREE
.
Camera
.
prototype
;
THREE
.
Light
=
function
(
a
){
THREE
.
Object3D
.
call
(
this
);
this
.
color
=
new
THREE
.
Color
(
a
)};
THREE
.
Light
.
prototype
=
new
THREE
.
Object3D
;
THREE
.
Light
.
prototype
.
constructor
=
THREE
.
Light
;
THREE
.
Light
.
prototype
.
supr
=
THREE
.
Object3D
.
prototype
;
THREE
.
AmbientLight
=
function
(
a
){
THREE
.
Light
.
call
(
this
,
a
)};
THREE
.
AmbientLight
.
prototype
=
new
THREE
.
Light
;
THREE
.
AmbientLight
.
prototype
.
constructor
=
THREE
.
AmbientLight
;
THREE
.
DirectionalLight
=
function
(
a
,
b
){
THREE
.
Light
.
call
(
this
,
a
);
this
.
position
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
intensity
=
b
||
1
};
THREE
.
DirectionalLight
.
prototype
=
new
THREE
.
Light
;
THREE
.
DirectionalLight
.
prototype
.
constructor
=
THREE
.
DirectionalLight
;
THREE
.
PointLight
=
function
(
a
,
b
){
THREE
.
Light
.
call
(
this
,
a
);
this
.
position
=
new
THREE
.
Vector3
;
this
.
intensity
=
b
||
1
};
THREE
.
PointLight
.
prototype
=
new
THREE
.
Light
;
THREE
.
PointLight
.
prototype
.
constructor
=
THREE
.
PointLight
;
THREE
.
FlatShading
=
0
;
THREE
.
SmoothShading
=
1
;
THREE
.
NormalBlending
=
0
;
THREE
.
AdditiveBlending
=
1
;
THREE
.
SubtractiveBlending
=
2
;
THREE
.
BillboardBlending
=
3
;
THREE
.
ReverseSubtractiveBlending
=
4
;
THREE
.
MaterialCounter
=
{
value
:
0
};
THREE
.
CubeReflectionMapping
=
function
(){};
THREE
.
CubeRefractionMapping
=
function
(){};
THREE
.
LatitudeReflectionMapping
=
function
(){};
THREE
.
LatitudeRefractionMapping
=
function
(){};
THREE
.
SphericalReflectionMapping
=
function
(){};
THREE
.
SphericalRefractionMapping
=
function
(){};
THREE
.
UVMapping
=
function
(){};
THREE
.
LineBasicMaterial
=
function
(
a
){
this
.
id
=
THREE
.
MaterialCounter
.
value
++
;
this
.
color
=
new
THREE
.
Color
(
16777215
);
this
.
opacity
=
1
;
this
.
blending
=
THREE
.
NormalBlending
;
this
.
depthTest
=!
0
;
this
.
linewidth
=
1
;
this
.
linejoin
=
this
.
linecap
=
"
round
"
;
this
.
vertexColors
=!
1
;
if
(
a
){
a
.
color
!==
undefined
&&
this
.
color
.
setHex
(
a
.
color
);
if
(
a
.
opacity
!==
undefined
)
this
.
opacity
=
a
.
opacity
;
if
(
a
.
blending
!==
undefined
)
this
.
blending
=
a
.
blending
;
if
(
a
.
depthTest
!==
undefined
)
this
.
depthTest
=
a
.
depthTest
;
if
(
a
.
linewidth
!==
undefined
)
this
.
linewidth
=
a
.
linewidth
;
if
(
a
.
linecap
!==
undefined
)
this
.
linecap
=
a
.
linecap
;
if
(
a
.
linejoin
!==
undefined
)
this
.
linejoin
=
a
.
linejoin
;
if
(
a
.
vertexColors
!==
undefined
)
this
.
vertexColors
=
a
.
vertexColors
}};
THREE
.
MeshBasicMaterial
=
function
(
a
){
this
.
id
=
THREE
.
MaterialCounter
.
value
++
;
this
.
color
=
new
THREE
.
Color
(
16777215
);
this
.
opacity
=
1
;
this
.
envMap
=
this
.
lightMap
=
this
.
map
=
null
;
this
.
combine
=
THREE
.
MultiplyOperation
;
this
.
reflectivity
=
1
;
this
.
refractionRatio
=
0.98
;
this
.
fog
=!
0
;
this
.
shading
=
THREE
.
SmoothShading
;
this
.
blending
=
THREE
.
NormalBlending
;
this
.
depthTest
=!
0
;
this
.
wireframe
=!
1
;
this
.
wireframeLinewidth
=
1
;
this
.
wireframeLinejoin
=
this
.
wireframeLinecap
=
"
round
"
;
this
.
vertexColors
=!
1
;
this
.
skinning
=!
1
;
if
(
a
){
a
.
color
!==
undefined
&&
...
...
src/cameras/QuakeCamera.js
浏览文件 @
d006967b
...
...
@@ -30,6 +30,11 @@ function bind( scope, fn ) {
}
function
clamp_bottom
(
x
,
a
)
{
return
x
<
a
?
a
:
x
;
};
THREE
.
QuakeCamera
=
function
(
parameters
)
{
...
...
@@ -41,7 +46,10 @@ THREE.QuakeCamera = function ( parameters ) {
this
.
noFly
=
false
;
this
.
lookVertical
=
true
;
this
.
autoForward
=
false
;
this
.
heightCoef
=
1.0
;
this
.
heightMin
=
0.0
;
this
.
domElement
=
document
;
if
(
parameters
)
{
...
...
@@ -50,12 +58,19 @@ THREE.QuakeCamera = function ( parameters ) {
if
(
parameters
.
lookSpeed
!==
undefined
)
this
.
lookSpeed
=
parameters
.
lookSpeed
;
if
(
parameters
.
noFly
!==
undefined
)
this
.
noFly
=
parameters
.
noFly
;
if
(
parameters
.
lookVertical
!==
undefined
)
this
.
lookVertical
=
parameters
.
lookVertical
;
if
(
parameters
.
autoForward
!==
undefined
)
this
.
autoForward
=
parameters
.
autoForward
;
if
(
parameters
.
autoSpeed
!==
undefined
)
this
.
autoSpeed
=
parameters
.
autoSpeed
;
if
(
parameters
.
heightCoef
!==
undefined
)
this
.
heightCoef
=
parameters
.
heightCoef
;
if
(
parameters
.
heightMin
!==
undefined
)
this
.
heightMin
=
parameters
.
heightMin
;
if
(
parameters
.
domElement
!==
undefined
)
this
.
domElement
=
parameters
.
domElement
;
}
this
.
autoSpeedFactor
=
1.0
;
this
.
mouseX
=
0
;
this
.
mouseY
=
0
;
...
...
@@ -149,7 +164,16 @@ THREE.QuakeCamera = function ( parameters ) {
this
.
update
=
function
()
{
if
(
this
.
moveForward
||
this
.
autoForward
)
this
.
translateZ
(
-
this
.
movementSpeed
,
this
.
noFly
);
if
(
this
.
autoSpeed
)
{
if
(
this
.
position
.
y
>
this
.
heightMin
)
this
.
autoSpeedFactor
=
clamp_bottom
(
(
this
.
position
.
y
-
this
.
heightMin
)
*
this
.
heightCoef
,
1.0
);
else
this
.
autoSpeedFactor
=
1.0
;
}
if
(
this
.
moveForward
||
this
.
autoForward
)
this
.
translateZ
(
-
this
.
movementSpeed
*
this
.
autoSpeedFactor
,
this
.
noFly
);
if
(
this
.
moveBackward
)
this
.
translateZ
(
this
.
movementSpeed
,
this
.
noFly
);
if
(
this
.
moveLeft
)
this
.
translateX
(
-
this
.
movementSpeed
,
this
.
noFly
);
if
(
this
.
moveRight
)
this
.
translateX
(
this
.
movementSpeed
,
this
.
noFly
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录