Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
ca023aa9
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,发现更多精彩内容 >>
未验证
提交
ca023aa9
编写于
4月 07, 2018
作者:
M
Mr.doob
提交者:
GitHub
4月 07, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #13794 from Mugen87/dev4
Examples: Clean up
上级
504ce22d
9cd6c4f2
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
59 addition
and
59 deletion
+59
-59
examples/js/controls/EditorControls.js
examples/js/controls/EditorControls.js
+1
-1
examples/js/controls/FirstPersonControls.js
examples/js/controls/FirstPersonControls.js
+2
-2
examples/js/controls/FlyControls.js
examples/js/controls/FlyControls.js
+22
-22
examples/js/controls/OrbitControls.js
examples/js/controls/OrbitControls.js
+1
-1
examples/js/controls/PointerLockControls.js
examples/js/controls/PointerLockControls.js
+4
-4
examples/js/controls/TrackballControls.js
examples/js/controls/TrackballControls.js
+16
-16
examples/js/controls/TransformControls.js
examples/js/controls/TransformControls.js
+13
-13
未找到文件。
examples/js/controls/EditorControls.js
浏览文件 @
ca023aa9
...
...
@@ -199,7 +199,7 @@ THREE.EditorControls = function ( object, domElement ) {
}
this
.
dispose
=
function
()
{
this
.
dispose
=
function
()
{
domElement
.
removeEventListener
(
'
contextmenu
'
,
contextmenu
,
false
);
domElement
.
removeEventListener
(
'
mousedown
'
,
onMouseDown
,
false
);
...
...
examples/js/controls/FirstPersonControls.js
浏览文件 @
ca023aa9
...
...
@@ -184,7 +184,7 @@ THREE.FirstPersonControls = function ( object, domElement ) {
};
this
.
update
=
function
(
delta
)
{
this
.
update
=
function
(
delta
)
{
if
(
this
.
enabled
===
false
)
return
;
...
...
@@ -259,7 +259,7 @@ THREE.FirstPersonControls = function ( object, domElement ) {
}
this
.
dispose
=
function
()
{
this
.
dispose
=
function
()
{
this
.
domElement
.
removeEventListener
(
'
contextmenu
'
,
contextmenu
,
false
);
this
.
domElement
.
removeEventListener
(
'
mousedown
'
,
_onMouseDown
,
false
);
...
...
examples/js/controls/FlyControls.js
浏览文件 @
ca023aa9
...
...
@@ -39,7 +39,7 @@ THREE.FlyControls = function ( object, domElement ) {
};
this
.
keydown
=
function
(
event
)
{
this
.
keydown
=
function
(
event
)
{
if
(
event
.
altKey
)
{
...
...
@@ -78,7 +78,7 @@ THREE.FlyControls = function ( object, domElement ) {
};
this
.
keyup
=
function
(
event
)
{
this
.
keyup
=
function
(
event
)
{
switch
(
event
.
keyCode
)
{
...
...
@@ -109,7 +109,7 @@ THREE.FlyControls = function ( object, domElement ) {
};
this
.
mousedown
=
function
(
event
)
{
this
.
mousedown
=
function
(
event
)
{
if
(
this
.
domElement
!==
document
)
{
...
...
@@ -139,16 +139,16 @@ THREE.FlyControls = function ( object, domElement ) {
};
this
.
mousemove
=
function
(
event
)
{
this
.
mousemove
=
function
(
event
)
{
if
(
!
this
.
dragToLook
||
this
.
mouseStatus
>
0
)
{
var
container
=
this
.
getContainerDimensions
();
var
halfWidth
=
container
.
size
[
0
]
/
2
;
var
halfWidth
=
container
.
size
[
0
]
/
2
;
var
halfHeight
=
container
.
size
[
1
]
/
2
;
this
.
moveState
.
yawLeft
=
-
(
(
event
.
pageX
-
container
.
offset
[
0
]
)
-
halfWidth
)
/
halfWidth
;
this
.
moveState
.
pitchDown
=
(
(
event
.
pageY
-
container
.
offset
[
1
]
)
-
halfHeight
)
/
halfHeight
;
this
.
moveState
.
yawLeft
=
-
(
(
event
.
pageX
-
container
.
offset
[
0
]
)
-
halfWidth
)
/
halfWidth
;
this
.
moveState
.
pitchDown
=
(
(
event
.
pageY
-
container
.
offset
[
1
]
)
-
halfHeight
)
/
halfHeight
;
this
.
updateRotationVector
();
...
...
@@ -156,7 +156,7 @@ THREE.FlyControls = function ( object, domElement ) {
};
this
.
mouseup
=
function
(
event
)
{
this
.
mouseup
=
function
(
event
)
{
event
.
preventDefault
();
event
.
stopPropagation
();
...
...
@@ -184,7 +184,7 @@ THREE.FlyControls = function ( object, domElement ) {
};
this
.
update
=
function
(
delta
)
{
this
.
update
=
function
(
delta
)
{
var
moveMult
=
delta
*
this
.
movementSpeed
;
var
rotMult
=
delta
*
this
.
rollSpeed
;
...
...
@@ -202,42 +202,42 @@ THREE.FlyControls = function ( object, domElement ) {
};
this
.
updateMovementVector
=
function
()
{
this
.
updateMovementVector
=
function
()
{
var
forward
=
(
this
.
moveState
.
forward
||
(
this
.
autoForward
&&
!
this
.
moveState
.
back
)
)
?
1
:
0
;
this
.
moveVector
.
x
=
(
-
this
.
moveState
.
left
+
this
.
moveState
.
right
);
this
.
moveVector
.
y
=
(
-
this
.
moveState
.
down
+
this
.
moveState
.
up
);
this
.
moveVector
.
x
=
(
-
this
.
moveState
.
left
+
this
.
moveState
.
right
);
this
.
moveVector
.
y
=
(
-
this
.
moveState
.
down
+
this
.
moveState
.
up
);
this
.
moveVector
.
z
=
(
-
forward
+
this
.
moveState
.
back
);
//console.log( 'move:', [ this.moveVector.x, this.moveVector.y, this.moveVector.z ] );
};
this
.
updateRotationVector
=
function
()
{
this
.
updateRotationVector
=
function
()
{
this
.
rotationVector
.
x
=
(
-
this
.
moveState
.
pitchDown
+
this
.
moveState
.
pitchUp
);
this
.
rotationVector
.
y
=
(
-
this
.
moveState
.
yawRight
+
this
.
moveState
.
yawLeft
);
this
.
rotationVector
.
y
=
(
-
this
.
moveState
.
yawRight
+
this
.
moveState
.
yawLeft
);
this
.
rotationVector
.
z
=
(
-
this
.
moveState
.
rollRight
+
this
.
moveState
.
rollLeft
);
//console.log( 'rotate:', [ this.rotationVector.x, this.rotationVector.y, this.rotationVector.z ] );
};
this
.
getContainerDimensions
=
function
()
{
this
.
getContainerDimensions
=
function
()
{
if
(
this
.
domElement
!=
document
)
{
return
{
size
:
[
this
.
domElement
.
offsetWidth
,
this
.
domElement
.
offsetHeight
],
offset
:
[
this
.
domElement
.
offsetLeft
,
this
.
domElement
.
offsetTop
]
size
:
[
this
.
domElement
.
offsetWidth
,
this
.
domElement
.
offsetHeight
],
offset
:
[
this
.
domElement
.
offsetLeft
,
this
.
domElement
.
offsetTop
]
};
}
else
{
return
{
size
:
[
window
.
innerWidth
,
window
.
innerHeight
],
offset
:
[
0
,
0
]
size
:
[
window
.
innerWidth
,
window
.
innerHeight
],
offset
:
[
0
,
0
]
};
}
...
...
@@ -260,7 +260,7 @@ THREE.FlyControls = function ( object, domElement ) {
}
this
.
dispose
=
function
()
{
this
.
dispose
=
function
()
{
this
.
domElement
.
removeEventListener
(
'
contextmenu
'
,
contextmenu
,
false
);
this
.
domElement
.
removeEventListener
(
'
mousedown
'
,
_mousedown
,
false
);
...
...
@@ -282,10 +282,10 @@ THREE.FlyControls = function ( object, domElement ) {
this
.
domElement
.
addEventListener
(
'
mousemove
'
,
_mousemove
,
false
);
this
.
domElement
.
addEventListener
(
'
mousedown
'
,
_mousedown
,
false
);
this
.
domElement
.
addEventListener
(
'
mouseup
'
,
_mouseup
,
false
);
this
.
domElement
.
addEventListener
(
'
mouseup
'
,
_mouseup
,
false
);
window
.
addEventListener
(
'
keydown
'
,
_keydown
,
false
);
window
.
addEventListener
(
'
keyup
'
,
_keyup
,
false
);
window
.
addEventListener
(
'
keyup
'
,
_keyup
,
false
);
this
.
updateMovementVector
();
this
.
updateRotationVector
();
...
...
examples/js/controls/OrbitControls.js
浏览文件 @
ca023aa9
...
...
@@ -457,7 +457,7 @@ THREE.OrbitControls = function ( object, domElement ) {
rotateEnd
.
set
(
event
.
clientX
,
event
.
clientY
);
rotateDelta
.
subVectors
(
rotateEnd
,
rotateStart
).
multiplyScalar
(
scope
.
rotateSpeed
);
;
rotateDelta
.
subVectors
(
rotateEnd
,
rotateStart
).
multiplyScalar
(
scope
.
rotateSpeed
);
var
element
=
scope
.
domElement
===
document
?
scope
.
domElement
.
body
:
scope
.
domElement
;
...
...
examples/js/controls/PointerLockControls.js
浏览文件 @
ca023aa9
...
...
@@ -31,7 +31,7 @@ THREE.PointerLockControls = function ( camera ) {
};
this
.
dispose
=
function
()
{
this
.
dispose
=
function
()
{
document
.
removeEventListener
(
'
mousemove
'
,
onMouseMove
,
false
);
...
...
@@ -47,14 +47,14 @@ THREE.PointerLockControls = function ( camera ) {
};
this
.
getDirection
=
function
()
{
this
.
getDirection
=
function
()
{
// assumes the camera itself is not rotated
var
direction
=
new
THREE
.
Vector3
(
0
,
0
,
-
1
);
var
rotation
=
new
THREE
.
Euler
(
0
,
0
,
0
,
"
YXZ
"
);
var
rotation
=
new
THREE
.
Euler
(
0
,
0
,
0
,
'
YXZ
'
);
return
function
(
v
)
{
return
function
(
v
)
{
rotation
.
set
(
pitchObject
.
rotation
.
x
,
yawObject
.
rotation
.
y
,
0
);
...
...
examples/js/controls/TrackballControls.js
浏览文件 @
ca023aa9
...
...
@@ -44,24 +44,24 @@ THREE.TrackballControls = function ( object, domElement ) {
var
lastPosition
=
new
THREE
.
Vector3
();
var
_state
=
STATE
.
NONE
,
_prevState
=
STATE
.
NONE
,
_prevState
=
STATE
.
NONE
,
_eye
=
new
THREE
.
Vector3
(),
_eye
=
new
THREE
.
Vector3
(),
_movePrev
=
new
THREE
.
Vector2
(),
_moveCurr
=
new
THREE
.
Vector2
(),
_movePrev
=
new
THREE
.
Vector2
(),
_moveCurr
=
new
THREE
.
Vector2
(),
_lastAxis
=
new
THREE
.
Vector3
(),
_lastAngle
=
0
,
_lastAxis
=
new
THREE
.
Vector3
(),
_lastAngle
=
0
,
_zoomStart
=
new
THREE
.
Vector2
(),
_zoomEnd
=
new
THREE
.
Vector2
(),
_zoomStart
=
new
THREE
.
Vector2
(),
_zoomEnd
=
new
THREE
.
Vector2
(),
_touchZoomDistanceStart
=
0
,
_touchZoomDistanceEnd
=
0
,
_touchZoomDistanceStart
=
0
,
_touchZoomDistanceEnd
=
0
,
_panStart
=
new
THREE
.
Vector2
(),
_panEnd
=
new
THREE
.
Vector2
();
_panStart
=
new
THREE
.
Vector2
(),
_panEnd
=
new
THREE
.
Vector2
();
// for reset
...
...
@@ -145,7 +145,7 @@ THREE.TrackballControls = function ( object, domElement ) {
}()
);
this
.
rotateCamera
=
(
function
()
{
this
.
rotateCamera
=
(
function
()
{
var
axis
=
new
THREE
.
Vector3
(),
quaternion
=
new
THREE
.
Quaternion
(),
...
...
@@ -235,7 +235,7 @@ THREE.TrackballControls = function ( object, domElement ) {
};
this
.
panCamera
=
(
function
()
{
this
.
panCamera
=
(
function
()
{
var
mouseChange
=
new
THREE
.
Vector2
(),
objectUp
=
new
THREE
.
Vector3
(),
...
...
@@ -469,7 +469,7 @@ THREE.TrackballControls = function ( object, domElement ) {
function
mousewheel
(
event
)
{
if
(
_this
.
enabled
===
false
)
return
;
if
(
_this
.
noZoom
===
true
)
return
;
event
.
preventDefault
();
...
...
@@ -587,7 +587,7 @@ THREE.TrackballControls = function ( object, domElement ) {
}
this
.
dispose
=
function
()
{
this
.
dispose
=
function
()
{
this
.
domElement
.
removeEventListener
(
'
contextmenu
'
,
contextmenu
,
false
);
this
.
domElement
.
removeEventListener
(
'
mousedown
'
,
mousedown
,
false
);
...
...
examples/js/controls/TransformControls.js
浏览文件 @
ca023aa9
...
...
@@ -21,7 +21,7 @@
this
.
oldColor
=
this
.
color
.
clone
();
this
.
oldOpacity
=
this
.
opacity
;
this
.
highlight
=
function
(
highlighted
)
{
this
.
highlight
=
function
(
highlighted
)
{
if
(
highlighted
)
{
...
...
@@ -58,7 +58,7 @@
this
.
oldColor
=
this
.
color
.
clone
();
this
.
oldOpacity
=
this
.
opacity
;
this
.
highlight
=
function
(
highlighted
)
{
this
.
highlight
=
function
(
highlighted
)
{
if
(
highlighted
)
{
...
...
@@ -103,9 +103,9 @@
var
planeMaterial
=
new
THREE
.
MeshBasicMaterial
(
{
visible
:
false
,
side
:
THREE
.
DoubleSide
}
);
var
planes
=
{
"
XY
"
:
new
THREE
.
Mesh
(
planeGeometry
,
planeMaterial
),
"
YZ
"
:
new
THREE
.
Mesh
(
planeGeometry
,
planeMaterial
),
"
XZ
"
:
new
THREE
.
Mesh
(
planeGeometry
,
planeMaterial
),
"
XY
"
:
new
THREE
.
Mesh
(
planeGeometry
,
planeMaterial
),
"
YZ
"
:
new
THREE
.
Mesh
(
planeGeometry
,
planeMaterial
),
"
XZ
"
:
new
THREE
.
Mesh
(
planeGeometry
,
planeMaterial
),
"
XYZE
"
:
new
THREE
.
Mesh
(
planeGeometry
,
planeMaterial
)
};
...
...
@@ -124,7 +124,7 @@
//// HANDLES AND PICKERS
var
setupGizmos
=
function
(
gizmoMap
,
parent
)
{
var
setupGizmos
=
function
(
gizmoMap
,
parent
)
{
for
(
var
name
in
gizmoMap
)
{
...
...
@@ -176,7 +176,7 @@
this
.
highlight
=
function
(
axis
)
{
this
.
traverse
(
function
(
child
)
{
this
.
traverse
(
function
(
child
)
{
if
(
child
.
material
&&
child
.
material
.
highlight
)
{
...
...
@@ -207,7 +207,7 @@
var
vec2
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
var
lookAtMatrix
=
new
THREE
.
Matrix4
();
this
.
traverse
(
function
(
child
)
{
this
.
traverse
(
function
(
child
)
{
if
(
child
.
name
.
search
(
"
E
"
)
!==
-
1
)
{
...
...
@@ -235,13 +235,13 @@
arrowGeometry
.
merge
(
mesh
.
geometry
,
mesh
.
matrix
);
var
lineXGeometry
=
new
THREE
.
BufferGeometry
();
lineXGeometry
.
addAttribute
(
'
position
'
,
new
THREE
.
Float32BufferAttribute
(
[
0
,
0
,
0
,
1
,
0
,
0
],
3
)
);
lineXGeometry
.
addAttribute
(
'
position
'
,
new
THREE
.
Float32BufferAttribute
(
[
0
,
0
,
0
,
1
,
0
,
0
],
3
)
);
var
lineYGeometry
=
new
THREE
.
BufferGeometry
();
lineYGeometry
.
addAttribute
(
'
position
'
,
new
THREE
.
Float32BufferAttribute
(
[
0
,
0
,
0
,
0
,
1
,
0
],
3
)
);
lineYGeometry
.
addAttribute
(
'
position
'
,
new
THREE
.
Float32BufferAttribute
(
[
0
,
0
,
0
,
0
,
1
,
0
],
3
)
);
var
lineZGeometry
=
new
THREE
.
BufferGeometry
();
lineZGeometry
.
addAttribute
(
'
position
'
,
new
THREE
.
Float32BufferAttribute
(
[
0
,
0
,
0
,
0
,
0
,
1
],
3
)
);
lineZGeometry
.
addAttribute
(
'
position
'
,
new
THREE
.
Float32BufferAttribute
(
[
0
,
0
,
0
,
0
,
0
,
1
],
3
)
);
this
.
handleGizmos
=
{
...
...
@@ -671,12 +671,12 @@
var
oldScale
=
new
THREE
.
Vector3
();
var
oldRotationMatrix
=
new
THREE
.
Matrix4
();
var
parentRotationMatrix
=
new
THREE
.
Matrix4
();
var
parentRotationMatrix
=
new
THREE
.
Matrix4
();
var
parentScale
=
new
THREE
.
Vector3
();
var
worldPosition
=
new
THREE
.
Vector3
();
var
worldRotation
=
new
THREE
.
Euler
();
var
worldRotationMatrix
=
new
THREE
.
Matrix4
();
var
worldRotationMatrix
=
new
THREE
.
Matrix4
();
var
camPosition
=
new
THREE
.
Vector3
();
var
camRotation
=
new
THREE
.
Euler
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录