Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
e0e05f29
T
three.js
项目概览
车家大少爷
/
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,发现更多精彩内容 >>
提交
e0e05f29
编写于
4月 11, 2011
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed Objec3D::lookAt
上级
9acde650
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
6 addition
and
21 deletion
+6
-21
build/Three.js
build/Three.js
+1
-1
build/custom/ThreeCanvas.js
build/custom/ThreeCanvas.js
+1
-1
build/custom/ThreeDOM.js
build/custom/ThreeDOM.js
+1
-1
build/custom/ThreeSVG.js
build/custom/ThreeSVG.js
+1
-1
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+1
-1
src/core/Matrix4.js
src/core/Matrix4.js
+0
-15
src/core/Object3D.js
src/core/Object3D.js
+1
-1
未找到文件。
build/Three.js
浏览文件 @
e0e05f29
...
...
@@ -41,7 +41,7 @@ THREE.Matrix4.makeFrustum=function(b,d,c,f,g,h){var j;j=new THREE.Matrix4;j.n11=
THREE
.
Matrix4
.
makeOrtho
=
function
(
b
,
d
,
c
,
f
,
g
,
h
){
var
j
,
k
,
m
,
p
;
j
=
new
THREE
.
Matrix4
;
k
=
d
-
b
;
m
=
c
-
f
;
p
=
h
-
g
;
j
.
n11
=
2
/
k
;
j
.
n12
=
0
;
j
.
n13
=
0
;
j
.
n14
=-
((
d
+
b
)
/
k
);
j
.
n21
=
0
;
j
.
n22
=
2
/
m
;
j
.
n23
=
0
;
j
.
n24
=-
((
c
+
f
)
/
m
);
j
.
n31
=
0
;
j
.
n32
=
0
;
j
.
n33
=-
2
/
p
;
j
.
n34
=-
((
h
+
g
)
/
p
);
j
.
n41
=
0
;
j
.
n42
=
0
;
j
.
n43
=
0
;
j
.
n44
=
1
;
return
j
};
THREE
.
Matrix4
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v2
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v3
=
new
THREE
.
Vector3
;
THREE
.
Object3D
=
function
(){
this
.
parent
=
undefined
;
this
.
children
=
[];
this
.
up
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
position
=
new
THREE
.
Vector3
;
this
.
rotation
=
new
THREE
.
Vector3
;
this
.
scale
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
rotationAutoUpdate
=!
0
;
this
.
matrix
=
new
THREE
.
Matrix4
;
this
.
matrixWorld
=
new
THREE
.
Matrix4
;
this
.
matrixRotationWorld
=
new
THREE
.
Matrix4
;
this
.
matrixAutoUpdate
=!
0
;
this
.
matrixWorldNeedsUpdate
=!
0
;
this
.
quaternion
=
new
THREE
.
Quaternion
;
this
.
useQuaternion
=!
1
;
this
.
boundRadius
=
0
;
this
.
boundRadiusScale
=
1
;
this
.
visible
=
!
0
;
this
.
_vector
=
new
THREE
.
Vector3
};
THREE
.
Object3D
.
prototype
=
{
translate
:
function
(
b
,
d
){
this
.
matrix
.
rotateAxis
(
d
);
this
.
position
.
addSelf
(
d
.
multiplyScalar
(
b
))},
translateX
:
function
(
b
){
this
.
translate
(
b
,
this
.
_vector
.
set
(
1
,
0
,
0
))},
translateY
:
function
(
b
){
this
.
translate
(
b
,
this
.
_vector
.
set
(
0
,
1
,
0
))},
translateZ
:
function
(
b
){
this
.
translate
(
b
,
this
.
_vector
.
set
(
0
,
0
,
1
))},
lookAt
:
function
(
b
){
this
.
matrix
.
lookAt
(
this
.
position
,
b
,
this
.
up
);
this
.
rotationAutoUpdate
&&
this
.
rotation
.
setRotationFromMatrix
(
this
.
matrix
)},
addChild
:
function
(
b
){
if
(
this
.
children
.
indexOf
(
b
)
===-
1
){
b
.
parent
!==
THREE
.
Object3D
.
prototype
=
{
translate
:
function
(
b
,
d
){
this
.
matrix
.
rotateAxis
(
d
);
this
.
position
.
addSelf
(
d
.
multiplyScalar
(
b
))},
translateX
:
function
(
b
){
this
.
translate
(
b
,
this
.
_vector
.
set
(
1
,
0
,
0
))},
translateY
:
function
(
b
){
this
.
translate
(
b
,
this
.
_vector
.
set
(
0
,
1
,
0
))},
translateZ
:
function
(
b
){
this
.
translate
(
b
,
this
.
_vector
.
set
(
0
,
0
,
1
))},
lookAt
:
function
(
b
){
this
.
matrix
.
lookAt
(
b
,
this
.
position
,
this
.
up
);
this
.
rotationAutoUpdate
&&
this
.
rotation
.
setRotationFromMatrix
(
this
.
matrix
)},
addChild
:
function
(
b
){
if
(
this
.
children
.
indexOf
(
b
)
===-
1
){
b
.
parent
!==
undefined
&&
b
.
parent
.
removeChild
(
b
);
b
.
parent
=
this
;
this
.
children
.
push
(
b
);
for
(
var
d
=
this
;
d
instanceof
THREE
.
Scene
===!
1
&&
d
!==
undefined
;)
d
=
d
.
parent
;
d
!==
undefined
&&
d
.
addChildRecurse
(
b
)}},
removeChild
:
function
(
b
){
var
d
=
this
.
children
.
indexOf
(
b
);
if
(
d
!==-
1
){
b
.
parent
=
undefined
;
this
.
children
.
splice
(
d
,
1
)}},
updateMatrix
:
function
(){
this
.
matrix
.
setPosition
(
this
.
position
);
this
.
useQuaternion
?
this
.
matrix
.
setRotationFromQuaternion
(
this
.
quaternion
):
this
.
matrix
.
setRotationFromEuler
(
this
.
rotation
);
if
(
this
.
scale
.
x
!==
1
||
this
.
scale
.
y
!==
1
||
this
.
scale
.
z
!==
1
){
this
.
matrix
.
scale
(
this
.
scale
);
this
.
boundRadiusScale
=
Math
.
max
(
this
.
scale
.
x
,
Math
.
max
(
this
.
scale
.
y
,
this
.
scale
.
z
))}
this
.
matrixWorldNeedsUpdate
=!
0
},
update
:
function
(
b
,
d
,
c
){
this
.
matrixAutoUpdate
&&
this
.
updateMatrix
();
if
(
this
.
matrixWorldNeedsUpdate
||
d
){
b
?
this
.
matrixWorld
.
multiply
(
b
,
this
.
matrix
):
this
.
matrixWorld
.
copy
(
this
.
matrix
);
this
.
matrixRotationWorld
.
extractRotation
(
this
.
matrixWorld
,
this
.
scale
);
this
.
matrixWorldNeedsUpdate
=!
1
;
d
=!
0
}
b
=
0
;
for
(
var
f
=
this
.
children
.
length
;
b
<
f
;
b
++
)
this
.
children
[
b
].
update
(
this
.
matrixWorld
,
d
,
c
)}};
THREE
.
Quaternion
=
function
(
b
,
d
,
c
,
f
){
this
.
set
(
b
||
0
,
d
||
0
,
c
||
0
,
f
!==
undefined
?
f
:
1
)};
...
...
build/custom/ThreeCanvas.js
浏览文件 @
e0e05f29
...
...
@@ -41,7 +41,7 @@ THREE.Matrix4.makeFrustum=function(a,b,c,d,e,h){var f;f=new THREE.Matrix4;f.n11=
THREE
.
Matrix4
.
makeOrtho
=
function
(
a
,
b
,
c
,
d
,
e
,
h
){
var
f
,
k
,
g
,
i
;
f
=
new
THREE
.
Matrix4
;
k
=
b
-
a
;
g
=
c
-
d
;
i
=
h
-
e
;
f
.
n11
=
2
/
k
;
f
.
n12
=
0
;
f
.
n13
=
0
;
f
.
n14
=-
((
b
+
a
)
/
k
);
f
.
n21
=
0
;
f
.
n22
=
2
/
g
;
f
.
n23
=
0
;
f
.
n24
=-
((
c
+
d
)
/
g
);
f
.
n31
=
0
;
f
.
n32
=
0
;
f
.
n33
=-
2
/
i
;
f
.
n34
=-
((
h
+
e
)
/
i
);
f
.
n41
=
0
;
f
.
n42
=
0
;
f
.
n43
=
0
;
f
.
n44
=
1
;
return
f
};
THREE
.
Matrix4
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v2
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v3
=
new
THREE
.
Vector3
;
THREE
.
Object3D
=
function
(){
this
.
parent
=
undefined
;
this
.
children
=
[];
this
.
up
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
position
=
new
THREE
.
Vector3
;
this
.
rotation
=
new
THREE
.
Vector3
;
this
.
scale
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
rotationAutoUpdate
=!
0
;
this
.
matrix
=
new
THREE
.
Matrix4
;
this
.
matrixWorld
=
new
THREE
.
Matrix4
;
this
.
matrixRotationWorld
=
new
THREE
.
Matrix4
;
this
.
matrixAutoUpdate
=!
0
;
this
.
matrixWorldNeedsUpdate
=!
0
;
this
.
quaternion
=
new
THREE
.
Quaternion
;
this
.
useQuaternion
=!
1
;
this
.
boundRadius
=
0
;
this
.
boundRadiusScale
=
1
;
this
.
visible
=
!
0
;
this
.
_vector
=
new
THREE
.
Vector3
};
THREE
.
Object3D
.
prototype
=
{
translate
:
function
(
a
,
b
){
this
.
matrix
.
rotateAxis
(
b
);
this
.
position
.
addSelf
(
b
.
multiplyScalar
(
a
))},
translateX
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
1
,
0
,
0
))},
translateY
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
1
,
0
))},
translateZ
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
0
,
1
))},
lookAt
:
function
(
a
){
this
.
matrix
.
lookAt
(
this
.
position
,
a
,
this
.
up
);
this
.
rotationAutoUpdate
&&
this
.
rotation
.
setRotationFromMatrix
(
this
.
matrix
)},
addChild
:
function
(
a
){
if
(
this
.
children
.
indexOf
(
a
)
===-
1
){
a
.
parent
!==
THREE
.
Object3D
.
prototype
=
{
translate
:
function
(
a
,
b
){
this
.
matrix
.
rotateAxis
(
b
);
this
.
position
.
addSelf
(
b
.
multiplyScalar
(
a
))},
translateX
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
1
,
0
,
0
))},
translateY
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
1
,
0
))},
translateZ
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
0
,
1
))},
lookAt
:
function
(
a
){
this
.
matrix
.
lookAt
(
a
,
this
.
position
,
this
.
up
);
this
.
rotationAutoUpdate
&&
this
.
rotation
.
setRotationFromMatrix
(
this
.
matrix
)},
addChild
:
function
(
a
){
if
(
this
.
children
.
indexOf
(
a
)
===-
1
){
a
.
parent
!==
undefined
&&
a
.
parent
.
removeChild
(
a
);
a
.
parent
=
this
;
this
.
children
.
push
(
a
);
for
(
var
b
=
this
;
b
instanceof
THREE
.
Scene
===!
1
&&
b
!==
undefined
;)
b
=
b
.
parent
;
b
!==
undefined
&&
b
.
addChildRecurse
(
a
)}},
removeChild
:
function
(
a
){
var
b
=
this
.
children
.
indexOf
(
a
);
if
(
b
!==-
1
){
a
.
parent
=
undefined
;
this
.
children
.
splice
(
b
,
1
)}},
updateMatrix
:
function
(){
this
.
matrix
.
setPosition
(
this
.
position
);
this
.
useQuaternion
?
this
.
matrix
.
setRotationFromQuaternion
(
this
.
quaternion
):
this
.
matrix
.
setRotationFromEuler
(
this
.
rotation
);
if
(
this
.
scale
.
x
!==
1
||
this
.
scale
.
y
!==
1
||
this
.
scale
.
z
!==
1
){
this
.
matrix
.
scale
(
this
.
scale
);
this
.
boundRadiusScale
=
Math
.
max
(
this
.
scale
.
x
,
Math
.
max
(
this
.
scale
.
y
,
this
.
scale
.
z
))}
this
.
matrixWorldNeedsUpdate
=!
0
},
update
:
function
(
a
,
b
,
c
){
this
.
matrixAutoUpdate
&&
this
.
updateMatrix
();
if
(
this
.
matrixWorldNeedsUpdate
||
b
){
a
?
this
.
matrixWorld
.
multiply
(
a
,
this
.
matrix
):
this
.
matrixWorld
.
copy
(
this
.
matrix
);
this
.
matrixRotationWorld
.
extractRotation
(
this
.
matrixWorld
,
this
.
scale
);
this
.
matrixWorldNeedsUpdate
=!
1
;
b
=!
0
}
a
=
0
;
for
(
var
d
=
this
.
children
.
length
;
a
<
d
;
a
++
)
this
.
children
[
a
].
update
(
this
.
matrixWorld
,
b
,
c
)}};
THREE
.
Quaternion
=
function
(
a
,
b
,
c
,
d
){
this
.
set
(
a
||
0
,
b
||
0
,
c
||
0
,
d
!==
undefined
?
d
:
1
)};
...
...
build/custom/ThreeDOM.js
浏览文件 @
e0e05f29
...
...
@@ -41,7 +41,7 @@ THREE.Matrix4.makeFrustum=function(a,b,c,d,e,h){var f;f=new THREE.Matrix4;f.n11=
THREE
.
Matrix4
.
makeOrtho
=
function
(
a
,
b
,
c
,
d
,
e
,
h
){
var
f
,
j
,
g
,
i
;
f
=
new
THREE
.
Matrix4
;
j
=
b
-
a
;
g
=
c
-
d
;
i
=
h
-
e
;
f
.
n11
=
2
/
j
;
f
.
n12
=
0
;
f
.
n13
=
0
;
f
.
n14
=-
((
b
+
a
)
/
j
);
f
.
n21
=
0
;
f
.
n22
=
2
/
g
;
f
.
n23
=
0
;
f
.
n24
=-
((
c
+
d
)
/
g
);
f
.
n31
=
0
;
f
.
n32
=
0
;
f
.
n33
=-
2
/
i
;
f
.
n34
=-
((
h
+
e
)
/
i
);
f
.
n41
=
0
;
f
.
n42
=
0
;
f
.
n43
=
0
;
f
.
n44
=
1
;
return
f
};
THREE
.
Matrix4
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v2
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v3
=
new
THREE
.
Vector3
;
THREE
.
Object3D
=
function
(){
this
.
parent
=
undefined
;
this
.
children
=
[];
this
.
up
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
position
=
new
THREE
.
Vector3
;
this
.
rotation
=
new
THREE
.
Vector3
;
this
.
scale
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
rotationAutoUpdate
=!
0
;
this
.
matrix
=
new
THREE
.
Matrix4
;
this
.
matrixWorld
=
new
THREE
.
Matrix4
;
this
.
matrixRotationWorld
=
new
THREE
.
Matrix4
;
this
.
matrixAutoUpdate
=!
0
;
this
.
matrixWorldNeedsUpdate
=!
0
;
this
.
quaternion
=
new
THREE
.
Quaternion
;
this
.
useQuaternion
=!
1
;
this
.
boundRadius
=
0
;
this
.
boundRadiusScale
=
1
;
this
.
visible
=
!
0
;
this
.
_vector
=
new
THREE
.
Vector3
};
THREE
.
Object3D
.
prototype
=
{
translate
:
function
(
a
,
b
){
this
.
matrix
.
rotateAxis
(
b
);
this
.
position
.
addSelf
(
b
.
multiplyScalar
(
a
))},
translateX
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
1
,
0
,
0
))},
translateY
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
1
,
0
))},
translateZ
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
0
,
1
))},
lookAt
:
function
(
a
){
this
.
matrix
.
lookAt
(
this
.
position
,
a
,
this
.
up
);
this
.
rotationAutoUpdate
&&
this
.
rotation
.
setRotationFromMatrix
(
this
.
matrix
)},
addChild
:
function
(
a
){
if
(
this
.
children
.
indexOf
(
a
)
===-
1
){
a
.
parent
!==
THREE
.
Object3D
.
prototype
=
{
translate
:
function
(
a
,
b
){
this
.
matrix
.
rotateAxis
(
b
);
this
.
position
.
addSelf
(
b
.
multiplyScalar
(
a
))},
translateX
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
1
,
0
,
0
))},
translateY
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
1
,
0
))},
translateZ
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
0
,
1
))},
lookAt
:
function
(
a
){
this
.
matrix
.
lookAt
(
a
,
this
.
position
,
this
.
up
);
this
.
rotationAutoUpdate
&&
this
.
rotation
.
setRotationFromMatrix
(
this
.
matrix
)},
addChild
:
function
(
a
){
if
(
this
.
children
.
indexOf
(
a
)
===-
1
){
a
.
parent
!==
undefined
&&
a
.
parent
.
removeChild
(
a
);
a
.
parent
=
this
;
this
.
children
.
push
(
a
);
for
(
var
b
=
this
;
b
instanceof
THREE
.
Scene
===!
1
&&
b
!==
undefined
;)
b
=
b
.
parent
;
b
!==
undefined
&&
b
.
addChildRecurse
(
a
)}},
removeChild
:
function
(
a
){
var
b
=
this
.
children
.
indexOf
(
a
);
if
(
b
!==-
1
){
a
.
parent
=
undefined
;
this
.
children
.
splice
(
b
,
1
)}},
updateMatrix
:
function
(){
this
.
matrix
.
setPosition
(
this
.
position
);
this
.
useQuaternion
?
this
.
matrix
.
setRotationFromQuaternion
(
this
.
quaternion
):
this
.
matrix
.
setRotationFromEuler
(
this
.
rotation
);
if
(
this
.
scale
.
x
!==
1
||
this
.
scale
.
y
!==
1
||
this
.
scale
.
z
!==
1
){
this
.
matrix
.
scale
(
this
.
scale
);
this
.
boundRadiusScale
=
Math
.
max
(
this
.
scale
.
x
,
Math
.
max
(
this
.
scale
.
y
,
this
.
scale
.
z
))}
this
.
matrixWorldNeedsUpdate
=!
0
},
update
:
function
(
a
,
b
,
c
){
this
.
matrixAutoUpdate
&&
this
.
updateMatrix
();
if
(
this
.
matrixWorldNeedsUpdate
||
b
){
a
?
this
.
matrixWorld
.
multiply
(
a
,
this
.
matrix
):
this
.
matrixWorld
.
copy
(
this
.
matrix
);
this
.
matrixRotationWorld
.
extractRotation
(
this
.
matrixWorld
,
this
.
scale
);
this
.
matrixWorldNeedsUpdate
=!
1
;
b
=!
0
}
a
=
0
;
for
(
var
d
=
this
.
children
.
length
;
a
<
d
;
a
++
)
this
.
children
[
a
].
update
(
this
.
matrixWorld
,
b
,
c
)}};
THREE
.
Quaternion
=
function
(
a
,
b
,
c
,
d
){
this
.
set
(
a
||
0
,
b
||
0
,
c
||
0
,
d
!==
undefined
?
d
:
1
)};
...
...
build/custom/ThreeSVG.js
浏览文件 @
e0e05f29
...
...
@@ -41,7 +41,7 @@ THREE.Matrix4.makeFrustum=function(a,b,c,d,e,h){var f;f=new THREE.Matrix4;f.n11=
THREE
.
Matrix4
.
makeOrtho
=
function
(
a
,
b
,
c
,
d
,
e
,
h
){
var
f
,
i
,
g
,
j
;
f
=
new
THREE
.
Matrix4
;
i
=
b
-
a
;
g
=
c
-
d
;
j
=
h
-
e
;
f
.
n11
=
2
/
i
;
f
.
n12
=
0
;
f
.
n13
=
0
;
f
.
n14
=-
((
b
+
a
)
/
i
);
f
.
n21
=
0
;
f
.
n22
=
2
/
g
;
f
.
n23
=
0
;
f
.
n24
=-
((
c
+
d
)
/
g
);
f
.
n31
=
0
;
f
.
n32
=
0
;
f
.
n33
=-
2
/
j
;
f
.
n34
=-
((
h
+
e
)
/
j
);
f
.
n41
=
0
;
f
.
n42
=
0
;
f
.
n43
=
0
;
f
.
n44
=
1
;
return
f
};
THREE
.
Matrix4
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v2
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v3
=
new
THREE
.
Vector3
;
THREE
.
Object3D
=
function
(){
this
.
parent
=
undefined
;
this
.
children
=
[];
this
.
up
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
position
=
new
THREE
.
Vector3
;
this
.
rotation
=
new
THREE
.
Vector3
;
this
.
scale
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
rotationAutoUpdate
=!
0
;
this
.
matrix
=
new
THREE
.
Matrix4
;
this
.
matrixWorld
=
new
THREE
.
Matrix4
;
this
.
matrixRotationWorld
=
new
THREE
.
Matrix4
;
this
.
matrixAutoUpdate
=!
0
;
this
.
matrixWorldNeedsUpdate
=!
0
;
this
.
quaternion
=
new
THREE
.
Quaternion
;
this
.
useQuaternion
=!
1
;
this
.
boundRadius
=
0
;
this
.
boundRadiusScale
=
1
;
this
.
visible
=
!
0
;
this
.
_vector
=
new
THREE
.
Vector3
};
THREE
.
Object3D
.
prototype
=
{
translate
:
function
(
a
,
b
){
this
.
matrix
.
rotateAxis
(
b
);
this
.
position
.
addSelf
(
b
.
multiplyScalar
(
a
))},
translateX
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
1
,
0
,
0
))},
translateY
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
1
,
0
))},
translateZ
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
0
,
1
))},
lookAt
:
function
(
a
){
this
.
matrix
.
lookAt
(
this
.
position
,
a
,
this
.
up
);
this
.
rotationAutoUpdate
&&
this
.
rotation
.
setRotationFromMatrix
(
this
.
matrix
)},
addChild
:
function
(
a
){
if
(
this
.
children
.
indexOf
(
a
)
===-
1
){
a
.
parent
!==
THREE
.
Object3D
.
prototype
=
{
translate
:
function
(
a
,
b
){
this
.
matrix
.
rotateAxis
(
b
);
this
.
position
.
addSelf
(
b
.
multiplyScalar
(
a
))},
translateX
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
1
,
0
,
0
))},
translateY
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
1
,
0
))},
translateZ
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
0
,
1
))},
lookAt
:
function
(
a
){
this
.
matrix
.
lookAt
(
a
,
this
.
position
,
this
.
up
);
this
.
rotationAutoUpdate
&&
this
.
rotation
.
setRotationFromMatrix
(
this
.
matrix
)},
addChild
:
function
(
a
){
if
(
this
.
children
.
indexOf
(
a
)
===-
1
){
a
.
parent
!==
undefined
&&
a
.
parent
.
removeChild
(
a
);
a
.
parent
=
this
;
this
.
children
.
push
(
a
);
for
(
var
b
=
this
;
b
instanceof
THREE
.
Scene
===!
1
&&
b
!==
undefined
;)
b
=
b
.
parent
;
b
!==
undefined
&&
b
.
addChildRecurse
(
a
)}},
removeChild
:
function
(
a
){
var
b
=
this
.
children
.
indexOf
(
a
);
if
(
b
!==-
1
){
a
.
parent
=
undefined
;
this
.
children
.
splice
(
b
,
1
)}},
updateMatrix
:
function
(){
this
.
matrix
.
setPosition
(
this
.
position
);
this
.
useQuaternion
?
this
.
matrix
.
setRotationFromQuaternion
(
this
.
quaternion
):
this
.
matrix
.
setRotationFromEuler
(
this
.
rotation
);
if
(
this
.
scale
.
x
!==
1
||
this
.
scale
.
y
!==
1
||
this
.
scale
.
z
!==
1
){
this
.
matrix
.
scale
(
this
.
scale
);
this
.
boundRadiusScale
=
Math
.
max
(
this
.
scale
.
x
,
Math
.
max
(
this
.
scale
.
y
,
this
.
scale
.
z
))}
this
.
matrixWorldNeedsUpdate
=!
0
},
update
:
function
(
a
,
b
,
c
){
this
.
matrixAutoUpdate
&&
this
.
updateMatrix
();
if
(
this
.
matrixWorldNeedsUpdate
||
b
){
a
?
this
.
matrixWorld
.
multiply
(
a
,
this
.
matrix
):
this
.
matrixWorld
.
copy
(
this
.
matrix
);
this
.
matrixRotationWorld
.
extractRotation
(
this
.
matrixWorld
,
this
.
scale
);
this
.
matrixWorldNeedsUpdate
=!
1
;
b
=!
0
}
a
=
0
;
for
(
var
d
=
this
.
children
.
length
;
a
<
d
;
a
++
)
this
.
children
[
a
].
update
(
this
.
matrixWorld
,
b
,
c
)}};
THREE
.
Quaternion
=
function
(
a
,
b
,
c
,
d
){
this
.
set
(
a
||
0
,
b
||
0
,
c
||
0
,
d
!==
undefined
?
d
:
1
)};
...
...
build/custom/ThreeWebGL.js
浏览文件 @
e0e05f29
...
...
@@ -41,7 +41,7 @@ THREE.Matrix4.makeFrustum=function(b,d,e,g,h,o){var n;n=new THREE.Matrix4;n.n11=
THREE
.
Matrix4
.
makeOrtho
=
function
(
b
,
d
,
e
,
g
,
h
,
o
){
var
n
,
p
,
q
,
v
;
n
=
new
THREE
.
Matrix4
;
p
=
d
-
b
;
q
=
e
-
g
;
v
=
o
-
h
;
n
.
n11
=
2
/
p
;
n
.
n12
=
0
;
n
.
n13
=
0
;
n
.
n14
=-
((
d
+
b
)
/
p
);
n
.
n21
=
0
;
n
.
n22
=
2
/
q
;
n
.
n23
=
0
;
n
.
n24
=-
((
e
+
g
)
/
q
);
n
.
n31
=
0
;
n
.
n32
=
0
;
n
.
n33
=-
2
/
v
;
n
.
n34
=-
((
o
+
h
)
/
v
);
n
.
n41
=
0
;
n
.
n42
=
0
;
n
.
n43
=
0
;
n
.
n44
=
1
;
return
n
};
THREE
.
Matrix4
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v2
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v3
=
new
THREE
.
Vector3
;
THREE
.
Object3D
=
function
(){
this
.
parent
=
undefined
;
this
.
children
=
[];
this
.
up
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
position
=
new
THREE
.
Vector3
;
this
.
rotation
=
new
THREE
.
Vector3
;
this
.
scale
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
rotationAutoUpdate
=!
0
;
this
.
matrix
=
new
THREE
.
Matrix4
;
this
.
matrixWorld
=
new
THREE
.
Matrix4
;
this
.
matrixRotationWorld
=
new
THREE
.
Matrix4
;
this
.
matrixAutoUpdate
=!
0
;
this
.
matrixWorldNeedsUpdate
=!
0
;
this
.
quaternion
=
new
THREE
.
Quaternion
;
this
.
useQuaternion
=!
1
;
this
.
boundRadius
=
0
;
this
.
boundRadiusScale
=
1
;
this
.
visible
=
!
0
;
this
.
_vector
=
new
THREE
.
Vector3
};
THREE
.
Object3D
.
prototype
=
{
translate
:
function
(
b
,
d
){
this
.
matrix
.
rotateAxis
(
d
);
this
.
position
.
addSelf
(
d
.
multiplyScalar
(
b
))},
translateX
:
function
(
b
){
this
.
translate
(
b
,
this
.
_vector
.
set
(
1
,
0
,
0
))},
translateY
:
function
(
b
){
this
.
translate
(
b
,
this
.
_vector
.
set
(
0
,
1
,
0
))},
translateZ
:
function
(
b
){
this
.
translate
(
b
,
this
.
_vector
.
set
(
0
,
0
,
1
))},
lookAt
:
function
(
b
){
this
.
matrix
.
lookAt
(
this
.
position
,
b
,
this
.
up
);
this
.
rotationAutoUpdate
&&
this
.
rotation
.
setRotationFromMatrix
(
this
.
matrix
)},
addChild
:
function
(
b
){
if
(
this
.
children
.
indexOf
(
b
)
===-
1
){
b
.
parent
!==
THREE
.
Object3D
.
prototype
=
{
translate
:
function
(
b
,
d
){
this
.
matrix
.
rotateAxis
(
d
);
this
.
position
.
addSelf
(
d
.
multiplyScalar
(
b
))},
translateX
:
function
(
b
){
this
.
translate
(
b
,
this
.
_vector
.
set
(
1
,
0
,
0
))},
translateY
:
function
(
b
){
this
.
translate
(
b
,
this
.
_vector
.
set
(
0
,
1
,
0
))},
translateZ
:
function
(
b
){
this
.
translate
(
b
,
this
.
_vector
.
set
(
0
,
0
,
1
))},
lookAt
:
function
(
b
){
this
.
matrix
.
lookAt
(
b
,
this
.
position
,
this
.
up
);
this
.
rotationAutoUpdate
&&
this
.
rotation
.
setRotationFromMatrix
(
this
.
matrix
)},
addChild
:
function
(
b
){
if
(
this
.
children
.
indexOf
(
b
)
===-
1
){
b
.
parent
!==
undefined
&&
b
.
parent
.
removeChild
(
b
);
b
.
parent
=
this
;
this
.
children
.
push
(
b
);
for
(
var
d
=
this
;
d
instanceof
THREE
.
Scene
===!
1
&&
d
!==
undefined
;)
d
=
d
.
parent
;
d
!==
undefined
&&
d
.
addChildRecurse
(
b
)}},
removeChild
:
function
(
b
){
var
d
=
this
.
children
.
indexOf
(
b
);
if
(
d
!==-
1
){
b
.
parent
=
undefined
;
this
.
children
.
splice
(
d
,
1
)}},
updateMatrix
:
function
(){
this
.
matrix
.
setPosition
(
this
.
position
);
this
.
useQuaternion
?
this
.
matrix
.
setRotationFromQuaternion
(
this
.
quaternion
):
this
.
matrix
.
setRotationFromEuler
(
this
.
rotation
);
if
(
this
.
scale
.
x
!==
1
||
this
.
scale
.
y
!==
1
||
this
.
scale
.
z
!==
1
){
this
.
matrix
.
scale
(
this
.
scale
);
this
.
boundRadiusScale
=
Math
.
max
(
this
.
scale
.
x
,
Math
.
max
(
this
.
scale
.
y
,
this
.
scale
.
z
))}
this
.
matrixWorldNeedsUpdate
=!
0
},
update
:
function
(
b
,
d
,
e
){
this
.
matrixAutoUpdate
&&
this
.
updateMatrix
();
if
(
this
.
matrixWorldNeedsUpdate
||
d
){
b
?
this
.
matrixWorld
.
multiply
(
b
,
this
.
matrix
):
this
.
matrixWorld
.
copy
(
this
.
matrix
);
this
.
matrixRotationWorld
.
extractRotation
(
this
.
matrixWorld
,
this
.
scale
);
this
.
matrixWorldNeedsUpdate
=!
1
;
d
=!
0
}
b
=
0
;
for
(
var
g
=
this
.
children
.
length
;
b
<
g
;
b
++
)
this
.
children
[
b
].
update
(
this
.
matrixWorld
,
d
,
e
)}};
THREE
.
Quaternion
=
function
(
b
,
d
,
e
,
g
){
this
.
set
(
b
||
0
,
d
||
0
,
e
||
0
,
g
!==
undefined
?
g
:
1
)};
...
...
src/core/Matrix4.js
浏览文件 @
e0e05f29
...
...
@@ -69,21 +69,6 @@ THREE.Matrix4.prototype = {
lookAt
:
function
(
eye
,
center
,
up
)
{
/*
var x = THREE.Matrix4.__v1, y = THREE.Matrix4.__v2, z = THREE.Matrix4.__v3;
z.sub( center, eye ).normalize();
x.cross( up, z ).normalize();
y.cross( z, x ).normalize();
this.n11 = x.x; this.n12 = x.y; this.n13 = x.z; this.n14 = - x.dot( eye );
this.n21 = y.x; this.n22 = y.y; this.n23 = y.z; this.n24 = - y.dot( eye );
this.n31 = z.x; this.n32 = z.y; this.n33 = z.z; this.n34 = - z.dot( eye );
this.n41 = 0; this.n42 = 0; this.n43 = 0; this.n44 = 1;
return this;
*/
var
x
=
THREE
.
Matrix4
.
__v1
,
y
=
THREE
.
Matrix4
.
__v2
,
z
=
THREE
.
Matrix4
.
__v3
;
z
.
sub
(
eye
,
center
).
normalize
();
...
...
src/core/Object3D.js
浏览文件 @
e0e05f29
...
...
@@ -68,7 +68,7 @@ THREE.Object3D.prototype = {
// TODO: Add hierarchy support.
this
.
matrix
.
lookAt
(
this
.
position
,
vector
,
this
.
up
);
this
.
matrix
.
lookAt
(
vector
,
this
.
position
,
this
.
up
);
if
(
this
.
rotationAutoUpdate
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录