Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
8e2d3a8c
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,发现更多精彩内容 >>
提交
8e2d3a8c
编写于
10月 27, 2014
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
*Controls: Renamed freeze to enabled.
上级
1be7adcc
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
11 addition
and
22 deletion
+11
-22
examples/js/controls/DeviceOrientationControls.js
examples/js/controls/DeviceOrientationControls.js
+5
-7
examples/js/controls/FirstPersonControls.js
examples/js/controls/FirstPersonControls.js
+4
-10
examples/js/controls/OculusControls.js
examples/js/controls/OculusControls.js
+2
-5
未找到文件。
examples/js/controls/DeviceOrientationControls.js
浏览文件 @
8e2d3a8c
...
...
@@ -10,13 +10,11 @@ THREE.DeviceOrientationControls = function ( object ) {
var
scope
=
this
;
this
.
object
=
object
;
this
.
object
.
rotation
.
reorder
(
"
YXZ
"
);
this
.
freeze
=
true
;
this
.
enabled
=
true
;
this
.
deviceOrientation
=
{};
this
.
screenOrientation
=
0
;
var
onDeviceOrientationChangeEvent
=
function
(
event
)
{
...
...
@@ -64,22 +62,22 @@ THREE.DeviceOrientationControls = function ( object ) {
window
.
addEventListener
(
'
orientationchange
'
,
onScreenOrientationChangeEvent
,
false
);
window
.
addEventListener
(
'
deviceorientation
'
,
onDeviceOrientationChangeEvent
,
false
);
scope
.
freeze
=
fals
e
;
scope
.
enabled
=
tru
e
;
};
this
.
disconnect
=
function
()
{
scope
.
freeze
=
true
;
window
.
removeEventListener
(
'
orientationchange
'
,
onScreenOrientationChangeEvent
,
false
);
window
.
removeEventListener
(
'
deviceorientation
'
,
onDeviceOrientationChangeEvent
,
false
);
scope
.
enabled
=
false
;
};
this
.
update
=
function
()
{
if
(
scope
.
freez
e
)
return
;
if
(
scope
.
enabled
===
fals
e
)
return
;
var
alpha
=
scope
.
deviceOrientation
.
alpha
?
THREE
.
Math
.
degToRad
(
scope
.
deviceOrientation
.
alpha
)
:
0
;
// Z
var
beta
=
scope
.
deviceOrientation
.
beta
?
THREE
.
Math
.
degToRad
(
scope
.
deviceOrientation
.
beta
)
:
0
;
// X'
...
...
examples/js/controls/FirstPersonControls.js
浏览文件 @
8e2d3a8c
...
...
@@ -11,12 +11,13 @@ THREE.FirstPersonControls = function ( object, domElement ) {
this
.
domElement
=
(
domElement
!==
undefined
)
?
domElement
:
document
;
this
.
enabled
=
true
;
this
.
movementSpeed
=
1.0
;
this
.
lookSpeed
=
0.005
;
this
.
lookVertical
=
true
;
this
.
autoForward
=
false
;
// this.invertVertical = false;
this
.
activeLook
=
true
;
...
...
@@ -43,7 +44,6 @@ THREE.FirstPersonControls = function ( object, domElement ) {
this
.
moveBackward
=
false
;
this
.
moveLeft
=
false
;
this
.
moveRight
=
false
;
this
.
freeze
=
false
;
this
.
mouseDragOn
=
false
;
...
...
@@ -157,8 +157,6 @@ THREE.FirstPersonControls = function ( object, domElement ) {
case
82
:
/*R*/
this
.
moveUp
=
true
;
break
;
case
70
:
/*F*/
this
.
moveDown
=
true
;
break
;
case
81
:
/*Q*/
this
.
freeze
=
!
this
.
freeze
;
break
;
}
};
...
...
@@ -188,11 +186,7 @@ THREE.FirstPersonControls = function ( object, domElement ) {
this
.
update
=
function
(
delta
)
{
if
(
this
.
freeze
)
{
return
;
}
if
(
this
.
enabled
===
false
)
return
;
if
(
this
.
heightSpeed
)
{
...
...
@@ -265,7 +259,7 @@ THREE.FirstPersonControls = function ( object, domElement ) {
this
.
domElement
.
addEventListener
(
'
mousemove
'
,
bind
(
this
,
this
.
onMouseMove
),
false
);
this
.
domElement
.
addEventListener
(
'
mousedown
'
,
bind
(
this
,
this
.
onMouseDown
),
false
);
this
.
domElement
.
addEventListener
(
'
mouseup
'
,
bind
(
this
,
this
.
onMouseUp
),
false
);
window
.
addEventListener
(
'
keydown
'
,
bind
(
this
,
this
.
onKeyDown
),
false
);
window
.
addEventListener
(
'
keyup
'
,
bind
(
this
,
this
.
onKeyUp
),
false
);
...
...
examples/js/controls/OculusControls.js
浏览文件 @
8e2d3a8c
...
...
@@ -11,8 +11,8 @@ THREE.OculusControls = function ( object ) {
this
.
object
=
object
;
this
.
target
=
new
THREE
.
Vector3
(
0
,
0
,
0
);
this
.
enabled
=
true
;
this
.
headquat
=
new
THREE
.
Quaternion
();
this
.
freeze
=
false
;
this
.
loadAjaxJSON
=
function
(
url
,
callback
)
{
var
xhr
=
new
XMLHttpRequest
();
...
...
@@ -45,10 +45,7 @@ THREE.OculusControls = function ( object ) {
}
this
.
update
=
function
(
delta
)
{
if
(
this
.
freeze
)
{
return
;
}
if
(
this
.
enabled
===
false
)
return
;
this
.
object
.
quaternion
.
multiply
(
this
.
headquat
);
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录