Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
d3aa9678
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,发现更多精彩内容 >>
提交
d3aa9678
编写于
4月 14, 2012
作者:
A
alteredq
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'remotes/mrdoob/dev' into matrix
上级
43bcf919
e5c23ae0
变更
22
展开全部
隐藏空白更改
内联
并排
Showing
22 changed file
with
1513 addition
and
1477 deletion
+1513
-1477
build/Three.js
build/Three.js
+438
-441
build/custom/ThreeCanvas.js
build/custom/ThreeCanvas.js
+95
-96
build/custom/ThreeDOM.js
build/custom/ThreeDOM.js
+57
-59
build/custom/ThreeExtras.js
build/custom/ThreeExtras.js
+154
-156
build/custom/ThreeSVG.js
build/custom/ThreeSVG.js
+73
-75
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+203
-206
src/core/Frustum.js
src/core/Frustum.js
+15
-9
src/core/Matrix3.js
src/core/Matrix3.js
+17
-15
src/core/Matrix4.js
src/core/Matrix4.js
+375
-340
src/core/Projector.js
src/core/Projector.js
+3
-3
src/core/Quaternion.js
src/core/Quaternion.js
+7
-7
src/core/Vector3.js
src/core/Vector3.js
+9
-9
src/extras/controls/RollControls.js
src/extras/controls/RollControls.js
+19
-19
src/extras/renderers/AnaglyphWebGLRenderer.js
src/extras/renderers/AnaglyphWebGLRenderer.js
+6
-6
src/extras/renderers/ParallaxBarrierWebGLRenderer.js
src/extras/renderers/ParallaxBarrierWebGLRenderer.js
+6
-6
src/extras/renderers/plugins/DepthPassPlugin.js
src/extras/renderers/plugins/DepthPassPlugin.js
+6
-4
src/extras/renderers/plugins/LensFlarePlugin.js
src/extras/renderers/plugins/LensFlarePlugin.js
+1
-1
src/extras/renderers/plugins/ShadowMapPlugin.js
src/extras/renderers/plugins/ShadowMapPlugin.js
+6
-4
src/extras/renderers/plugins/SpritePlugin.js
src/extras/renderers/plugins/SpritePlugin.js
+3
-3
src/objects/LOD.js
src/objects/LOD.js
+1
-1
src/renderers/CanvasRenderer.js
src/renderers/CanvasRenderer.js
+6
-6
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+13
-11
未找到文件。
build/Three.js
浏览文件 @
d3aa9678
此差异已折叠。
点击以展开。
build/custom/ThreeCanvas.js
浏览文件 @
d3aa9678
此差异已折叠。
点击以展开。
build/custom/ThreeDOM.js
浏览文件 @
d3aa9678
此差异已折叠。
点击以展开。
build/custom/ThreeExtras.js
浏览文件 @
d3aa9678
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
build/custom/ThreeSVG.js
浏览文件 @
d3aa9678
此差异已折叠。
点击以展开。
build/custom/ThreeWebGL.js
浏览文件 @
d3aa9678
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
src/core/Frustum.js
浏览文件 @
d3aa9678
...
...
@@ -20,15 +20,20 @@ THREE.Frustum = function ( ) {
THREE
.
Frustum
.
prototype
.
setFromMatrix
=
function
(
m
)
{
var
i
,
plane
,
planes
=
this
.
planes
;
var
i
,
plane
,
planes
=
this
.
planes
;
planes
[
0
].
set
(
m
.
n41
-
m
.
n11
,
m
.
n42
-
m
.
n12
,
m
.
n43
-
m
.
n13
,
m
.
n44
-
m
.
n14
);
planes
[
1
].
set
(
m
.
n41
+
m
.
n11
,
m
.
n42
+
m
.
n12
,
m
.
n43
+
m
.
n13
,
m
.
n44
+
m
.
n14
);
planes
[
2
].
set
(
m
.
n41
+
m
.
n21
,
m
.
n42
+
m
.
n22
,
m
.
n43
+
m
.
n23
,
m
.
n44
+
m
.
n24
);
planes
[
3
].
set
(
m
.
n41
-
m
.
n21
,
m
.
n42
-
m
.
n22
,
m
.
n43
-
m
.
n23
,
m
.
n44
-
m
.
n24
);
planes
[
4
].
set
(
m
.
n41
-
m
.
n31
,
m
.
n42
-
m
.
n32
,
m
.
n43
-
m
.
n33
,
m
.
n44
-
m
.
n34
);
planes
[
5
].
set
(
m
.
n41
+
m
.
n31
,
m
.
n42
+
m
.
n32
,
m
.
n43
+
m
.
n33
,
m
.
n44
+
m
.
n34
);
var
me
=
m
.
elements
;
var
me0
=
me
[
0
],
me1
=
me
[
1
],
me2
=
me
[
2
],
me3
=
me
[
3
];
var
me4
=
me
[
4
],
me5
=
me
[
5
],
me6
=
me
[
6
],
me7
=
me
[
7
];
var
me8
=
me
[
8
],
me9
=
me
[
9
],
me10
=
me
[
10
],
me11
=
me
[
11
];
var
me12
=
me
[
12
],
me13
=
me
[
13
],
me14
=
me
[
14
],
me15
=
me
[
15
];
planes
[
0
].
set
(
me3
-
me0
,
me7
-
me4
,
me11
-
me8
,
me15
-
me12
);
planes
[
1
].
set
(
me3
+
me0
,
me7
+
me4
,
me11
+
me8
,
me15
+
me12
);
planes
[
2
].
set
(
me3
+
me1
,
me7
+
me5
,
me11
+
me9
,
me15
+
me13
);
planes
[
3
].
set
(
me3
-
me1
,
me7
-
me5
,
me11
-
me9
,
me15
-
me13
);
planes
[
4
].
set
(
me3
-
me2
,
me7
-
me6
,
me11
-
me10
,
me15
-
me14
);
planes
[
5
].
set
(
me3
+
me2
,
me7
+
me6
,
me11
+
me10
,
me15
+
me14
);
for
(
i
=
0
;
i
<
6
;
i
++
)
{
...
...
@@ -44,11 +49,12 @@ THREE.Frustum.prototype.contains = function ( object ) {
var
distance
,
planes
=
this
.
planes
,
matrix
=
object
.
matrixWorld
,
me
=
matrix
.
elements
,
radius
=
-
object
.
geometry
.
boundingSphere
.
radius
*
matrix
.
getMaxScaleOnAxis
();
for
(
var
i
=
0
;
i
<
6
;
i
++
)
{
distance
=
planes
[
i
].
x
*
m
atrix
.
n14
+
planes
[
i
].
y
*
matrix
.
n24
+
planes
[
i
].
z
*
matrix
.
n34
+
planes
[
i
].
w
;
distance
=
planes
[
i
].
x
*
m
e
[
12
]
+
planes
[
i
].
y
*
me
[
13
]
+
planes
[
i
].
z
*
me
[
14
]
+
planes
[
i
].
w
;
if
(
distance
<=
radius
)
return
false
;
}
...
...
src/core/Matrix3.js
浏览文件 @
d3aa9678
...
...
@@ -4,7 +4,7 @@
THREE
.
Matrix3
=
function
()
{
this
.
m
=
[]
;
this
.
elements
=
new
Float32Array
(
9
)
;
};
...
...
@@ -17,17 +17,19 @@ THREE.Matrix3.prototype = {
// input: THREE.Matrix4
// ( based on http://code.google.com/p/webgl-mjs/ )
var
a11
=
matrix
.
n33
*
matrix
.
n22
-
matrix
.
n32
*
matrix
.
n23
;
var
a21
=
-
matrix
.
n33
*
matrix
.
n21
+
matrix
.
n31
*
matrix
.
n23
;
var
a31
=
matrix
.
n32
*
matrix
.
n21
-
matrix
.
n31
*
matrix
.
n22
;
var
a12
=
-
matrix
.
n33
*
matrix
.
n12
+
matrix
.
n32
*
matrix
.
n13
;
var
a22
=
matrix
.
n33
*
matrix
.
n11
-
matrix
.
n31
*
matrix
.
n13
;
var
a32
=
-
matrix
.
n32
*
matrix
.
n11
+
matrix
.
n31
*
matrix
.
n12
;
var
a13
=
matrix
.
n23
*
matrix
.
n12
-
matrix
.
n22
*
matrix
.
n13
;
var
a23
=
-
matrix
.
n23
*
matrix
.
n11
+
matrix
.
n21
*
matrix
.
n13
;
var
a33
=
matrix
.
n22
*
matrix
.
n11
-
matrix
.
n21
*
matrix
.
n12
;
var
me
=
matrix
.
elements
;
var
a11
=
me
[
10
]
*
me
[
5
]
-
me
[
6
]
*
me
[
9
];
var
a21
=
-
me
[
10
]
*
me
[
1
]
+
me
[
2
]
*
me
[
9
];
var
a31
=
me
[
6
]
*
me
[
1
]
-
me
[
2
]
*
me
[
5
];
var
a12
=
-
me
[
10
]
*
me
[
4
]
+
me
[
6
]
*
me
[
8
];
var
a22
=
me
[
10
]
*
me
[
0
]
-
me
[
2
]
*
me
[
8
];
var
a32
=
-
me
[
6
]
*
me
[
0
]
+
me
[
2
]
*
me
[
4
];
var
a13
=
me
[
9
]
*
me
[
4
]
-
me
[
5
]
*
me
[
8
];
var
a23
=
-
me
[
9
]
*
me
[
0
]
+
me
[
1
]
*
me
[
8
];
var
a33
=
me
[
5
]
*
me
[
0
]
-
me
[
1
]
*
me
[
4
];
var
det
=
m
atrix
.
n11
*
a11
+
matrix
.
n21
*
a12
+
matrix
.
n31
*
a13
;
var
det
=
m
e
[
0
]
*
a11
+
me
[
1
]
*
a12
+
me
[
2
]
*
a13
;
// no inverse
...
...
@@ -39,7 +41,7 @@ THREE.Matrix3.prototype = {
var
idet
=
1.0
/
det
;
var
m
=
this
.
m
;
var
m
=
this
.
elements
;
m
[
0
]
=
idet
*
a11
;
m
[
1
]
=
idet
*
a21
;
m
[
2
]
=
idet
*
a31
;
m
[
3
]
=
idet
*
a12
;
m
[
4
]
=
idet
*
a22
;
m
[
5
]
=
idet
*
a32
;
...
...
@@ -49,10 +51,10 @@ THREE.Matrix3.prototype = {
},
/*
transpose
:
function
()
{
var tmp, m = this.
m
;
var
tmp
,
m
=
this
.
elements
;
tmp
=
m
[
1
];
m
[
1
]
=
m
[
3
];
m
[
3
]
=
tmp
;
tmp
=
m
[
2
];
m
[
2
]
=
m
[
6
];
m
[
6
]
=
tmp
;
...
...
@@ -61,7 +63,7 @@ THREE.Matrix3.prototype = {
return
this
;
},
*/
transposeIntoArray
:
function
(
r
)
{
...
...
src/core/Matrix4.js
浏览文件 @
d3aa9678
此差异已折叠。
点击以展开。
src/core/Projector.js
浏览文件 @
d3aa9678
...
...
@@ -367,7 +367,7 @@ THREE.Projector = function() {
if
(
object
instanceof
THREE
.
Particle
)
{
_vector4
.
set
(
objectMatrixWorld
.
n14
,
objectMatrixWorld
.
n24
,
objectMatrixWorld
.
n34
,
1
);
_vector4
.
set
(
objectMatrixWorld
.
elements
[
12
],
objectMatrixWorld
.
elements
[
13
],
objectMatrixWorld
.
elements
[
14
]
,
1
);
_projScreenMatrix
.
multiplyVector4
(
_vector4
);
_vector4
.
z
/=
_vector4
.
w
;
...
...
@@ -381,8 +381,8 @@ THREE.Projector = function() {
_particle
.
rotation
=
object
.
rotation
.
z
;
_particle
.
scale
.
x
=
object
.
scale
.
x
*
Math
.
abs
(
_particle
.
x
-
(
_vector4
.
x
+
camera
.
projectionMatrix
.
n11
)
/
(
_vector4
.
w
+
camera
.
projectionMatrix
.
n14
)
);
_particle
.
scale
.
y
=
object
.
scale
.
y
*
Math
.
abs
(
_particle
.
y
-
(
_vector4
.
y
+
camera
.
projectionMatrix
.
n22
)
/
(
_vector4
.
w
+
camera
.
projectionMatrix
.
n24
)
);
_particle
.
scale
.
x
=
object
.
scale
.
x
*
Math
.
abs
(
_particle
.
x
-
(
_vector4
.
x
+
camera
.
projectionMatrix
.
elements
[
0
]
)
/
(
_vector4
.
w
+
camera
.
projectionMatrix
.
elements
[
12
]
)
);
_particle
.
scale
.
y
=
object
.
scale
.
y
*
Math
.
abs
(
_particle
.
y
-
(
_vector4
.
y
+
camera
.
projectionMatrix
.
elements
[
5
]
)
/
(
_vector4
.
w
+
camera
.
projectionMatrix
.
elements
[
13
]
)
);
_particle
.
material
=
object
.
material
;
...
...
src/core/Quaternion.js
浏览文件 @
d3aa9678
...
...
@@ -92,13 +92,13 @@ THREE.Quaternion.prototype = {
}
var
absQ
=
Math
.
pow
(
m
.
determinant
(),
1.0
/
3.0
);
this
.
w
=
Math
.
sqrt
(
Math
.
max
(
0
,
absQ
+
m
.
n11
+
m
.
n22
+
m
.
n33
)
)
/
2
;
this
.
x
=
Math
.
sqrt
(
Math
.
max
(
0
,
absQ
+
m
.
n11
-
m
.
n22
-
m
.
n33
)
)
/
2
;
this
.
y
=
Math
.
sqrt
(
Math
.
max
(
0
,
absQ
-
m
.
n11
+
m
.
n22
-
m
.
n33
)
)
/
2
;
this
.
z
=
Math
.
sqrt
(
Math
.
max
(
0
,
absQ
-
m
.
n11
-
m
.
n22
+
m
.
n33
)
)
/
2
;
this
.
x
=
copySign
(
this
.
x
,
(
m
.
n32
-
m
.
n23
)
);
this
.
y
=
copySign
(
this
.
y
,
(
m
.
n13
-
m
.
n31
)
);
this
.
z
=
copySign
(
this
.
z
,
(
m
.
n21
-
m
.
n12
)
);
this
.
w
=
Math
.
sqrt
(
Math
.
max
(
0
,
absQ
+
m
.
elements
[
0
]
+
m
.
elements
[
5
]
+
m
.
elements
[
10
]
)
)
/
2
;
this
.
x
=
Math
.
sqrt
(
Math
.
max
(
0
,
absQ
+
m
.
elements
[
0
]
-
m
.
elements
[
5
]
-
m
.
elements
[
10
]
)
)
/
2
;
this
.
y
=
Math
.
sqrt
(
Math
.
max
(
0
,
absQ
-
m
.
elements
[
0
]
+
m
.
elements
[
5
]
-
m
.
elements
[
10
]
)
)
/
2
;
this
.
z
=
Math
.
sqrt
(
Math
.
max
(
0
,
absQ
-
m
.
elements
[
0
]
-
m
.
elements
[
5
]
+
m
.
elements
[
10
]
)
)
/
2
;
this
.
x
=
copySign
(
this
.
x
,
(
m
.
elements
[
6
]
-
m
.
elements
[
9
]
)
);
this
.
y
=
copySign
(
this
.
y
,
(
m
.
elements
[
8
]
-
m
.
elements
[
2
]
)
);
this
.
z
=
copySign
(
this
.
z
,
(
m
.
elements
[
1
]
-
m
.
elements
[
4
]
)
);
this
.
normalize
();
return
this
;
...
...
src/core/Vector3.js
浏览文件 @
d3aa9678
...
...
@@ -262,9 +262,9 @@ THREE.Vector3.prototype = {
getPositionFromMatrix
:
function
(
m
)
{
this
.
x
=
m
.
n14
;
this
.
y
=
m
.
n24
;
this
.
z
=
m
.
n34
;
this
.
x
=
m
.
elements
[
12
]
;
this
.
y
=
m
.
elements
[
13
]
;
this
.
z
=
m
.
elements
[
14
]
;
return
this
;
...
...
@@ -276,9 +276,9 @@ THREE.Vector3.prototype = {
var
sy
=
scale
?
scale
.
y
:
1
;
var
sz
=
scale
?
scale
.
z
:
1
;
var
m11
=
m
.
n11
/
sx
,
m12
=
m
.
n12
/
sy
,
m13
=
m
.
n13
/
sz
;
var
m21
=
m
.
n21
/
sx
,
m22
=
m
.
n22
/
sy
,
m23
=
m
.
n23
/
sz
;
var
m33
=
m
.
n33
/
sz
;
var
m11
=
m
.
elements
[
0
]
/
sx
,
m12
=
m
.
elements
[
4
]
/
sy
,
m13
=
m
.
elements
[
8
]
/
sz
;
var
m21
=
m
.
elements
[
1
]
/
sx
,
m22
=
m
.
elements
[
5
]
/
sy
,
m23
=
m
.
elements
[
9
]
/
sz
;
var
m33
=
m
.
elements
[
10
]
/
sz
;
this
.
y
=
Math
.
asin
(
m13
);
...
...
@@ -355,9 +355,9 @@ THREE.Vector3.prototype = {
getScaleFromMatrix
:
function
(
m
)
{
var
sx
=
this
.
set
(
m
.
n11
,
m
.
n21
,
m
.
n31
).
length
();
var
sy
=
this
.
set
(
m
.
n12
,
m
.
n22
,
m
.
n32
).
length
();
var
sz
=
this
.
set
(
m
.
n13
,
m
.
n23
,
m
.
n33
).
length
();
var
sx
=
this
.
set
(
m
.
elements
[
0
],
m
.
elements
[
1
],
m
.
elements
[
2
]
).
length
();
var
sy
=
this
.
set
(
m
.
elements
[
4
],
m
.
elements
[
5
],
m
.
elements
[
6
]
).
length
();
var
sz
=
this
.
set
(
m
.
elements
[
8
],
m
.
elements
[
9
],
m
.
elements
[
10
]
).
length
();
this
.
x
=
sx
;
this
.
y
=
sy
;
...
...
src/extras/controls/RollControls.js
浏览文件 @
d3aa9678
...
...
@@ -89,15 +89,15 @@ THREE.RollControls = function ( object, domElement ) {
xTemp
.
cross
(
yTemp
,
zTemp
).
normalize
();
yTemp
.
cross
(
zTemp
,
xTemp
).
normalize
();
this
.
object
.
matrix
.
n11
=
xTemp
.
x
;
this
.
object
.
matrix
.
n12
=
yTemp
.
x
;
this
.
object
.
matrix
.
n13
=
zTemp
.
x
;
this
.
object
.
matrix
.
n21
=
xTemp
.
y
;
this
.
object
.
matrix
.
n22
=
yTemp
.
y
;
this
.
object
.
matrix
.
n23
=
zTemp
.
y
;
this
.
object
.
matrix
.
n31
=
xTemp
.
z
;
this
.
object
.
matrix
.
n32
=
yTemp
.
z
;
this
.
object
.
matrix
.
n33
=
zTemp
.
z
;
this
.
object
.
matrix
.
elements
[
0
]
=
xTemp
.
x
;
this
.
object
.
matrix
.
elements
[
4
]
=
yTemp
.
x
;
this
.
object
.
matrix
.
elements
[
8
]
=
zTemp
.
x
;
this
.
object
.
matrix
.
elements
[
1
]
=
xTemp
.
y
;
this
.
object
.
matrix
.
elements
[
5
]
=
yTemp
.
y
;
this
.
object
.
matrix
.
elements
[
9
]
=
zTemp
.
y
;
this
.
object
.
matrix
.
elements
[
2
]
=
xTemp
.
z
;
this
.
object
.
matrix
.
elements
[
6
]
=
yTemp
.
z
;
this
.
object
.
matrix
.
elements
[
10
]
=
zTemp
.
z
;
// calculate roll matrix
rollMatrix
.
identity
();
rollMatrix
.
n11
=
Math
.
cos
(
this
.
roll
);
rollMatrix
.
n12
=
-
Math
.
sin
(
this
.
roll
);
rollMatrix
.
n21
=
Math
.
sin
(
this
.
roll
);
rollMatrix
.
n22
=
Math
.
cos
(
this
.
roll
);
rollMatrix
.
elements
[
0
]
=
Math
.
cos
(
this
.
roll
);
rollMatrix
.
elements
[
4
]
=
-
Math
.
sin
(
this
.
roll
);
rollMatrix
.
elements
[
1
]
=
Math
.
sin
(
this
.
roll
);
rollMatrix
.
elements
[
5
]
=
Math
.
cos
(
this
.
roll
);
// multiply camera with roll
...
...
@@ -106,34 +106,34 @@ THREE.RollControls = function ( object, domElement ) {
// set position
this
.
object
.
matrix
.
n14
=
this
.
object
.
position
.
x
;
this
.
object
.
matrix
.
n24
=
this
.
object
.
position
.
y
;
this
.
object
.
matrix
.
n34
=
this
.
object
.
position
.
z
;
this
.
object
.
matrix
.
elements
[
12
]
=
this
.
object
.
position
.
x
;
this
.
object
.
matrix
.
elements
[
13
]
=
this
.
object
.
position
.
y
;
this
.
object
.
matrix
.
elements
[
14
]
=
this
.
object
.
position
.
z
;
};
this
.
translateX
=
function
(
distance
)
{
this
.
object
.
position
.
x
+=
this
.
object
.
matrix
.
n11
*
distance
;
this
.
object
.
position
.
y
+=
this
.
object
.
matrix
.
n21
*
distance
;
this
.
object
.
position
.
z
+=
this
.
object
.
matrix
.
n31
*
distance
;
this
.
object
.
position
.
x
+=
this
.
object
.
matrix
.
elements
[
0
]
*
distance
;
this
.
object
.
position
.
y
+=
this
.
object
.
matrix
.
elements
[
1
]
*
distance
;
this
.
object
.
position
.
z
+=
this
.
object
.
matrix
.
elements
[
2
]
*
distance
;
};
this
.
translateY
=
function
(
distance
)
{
this
.
object
.
position
.
x
+=
this
.
object
.
matrix
.
n12
*
distance
;
this
.
object
.
position
.
y
+=
this
.
object
.
matrix
.
n22
*
distance
;
this
.
object
.
position
.
z
+=
this
.
object
.
matrix
.
n32
*
distance
;
this
.
object
.
position
.
x
+=
this
.
object
.
matrix
.
elements
[
4
]
*
distance
;
this
.
object
.
position
.
y
+=
this
.
object
.
matrix
.
elements
[
5
]
*
distance
;
this
.
object
.
position
.
z
+=
this
.
object
.
matrix
.
elements
[
6
]
*
distance
;
};
this
.
translateZ
=
function
(
distance
)
{
this
.
object
.
position
.
x
-=
this
.
object
.
matrix
.
n13
*
distance
;
this
.
object
.
position
.
y
-=
this
.
object
.
matrix
.
n23
*
distance
;
this
.
object
.
position
.
z
-=
this
.
object
.
matrix
.
n33
*
distance
;
this
.
object
.
position
.
x
-=
this
.
object
.
matrix
.
elements
[
8
]
*
distance
;
this
.
object
.
position
.
y
-=
this
.
object
.
matrix
.
elements
[
9
]
*
distance
;
this
.
object
.
position
.
z
-=
this
.
object
.
matrix
.
elements
[
10
]
*
distance
;
};
...
...
@@ -142,7 +142,7 @@ THREE.RollControls = function ( object, domElement ) {
// please note that the amount is NOT degrees, but a scale value
xTemp
.
set
(
this
.
object
.
matrix
.
n11
,
this
.
object
.
matrix
.
n21
,
this
.
object
.
matrix
.
n31
);
xTemp
.
set
(
this
.
object
.
matrix
.
elements
[
0
],
this
.
object
.
matrix
.
elements
[
1
],
this
.
object
.
matrix
.
elements
[
2
]
);
xTemp
.
multiplyScalar
(
amount
);
this
.
forward
.
subSelf
(
xTemp
);
...
...
@@ -154,7 +154,7 @@ THREE.RollControls = function ( object, domElement ) {
// please note that the amount is NOT degrees, but a scale value
yTemp
.
set
(
this
.
object
.
matrix
.
n12
,
this
.
object
.
matrix
.
n22
,
this
.
object
.
matrix
.
n32
);
yTemp
.
set
(
this
.
object
.
matrix
.
elements
[
4
],
this
.
object
.
matrix
.
elements
[
5
],
this
.
object
.
matrix
.
elements
[
6
]
);
yTemp
.
multiplyScalar
(
amount
);
this
.
forward
.
addSelf
(
yTemp
);
...
...
src/extras/renderers/AnaglyphWebGLRenderer.js
浏览文件 @
d3aa9678
...
...
@@ -126,16 +126,16 @@ if ( THREE.WebGLRenderer ) {
// translate xOffset
eyeRight
.
n14
=
eyeSep
;
eyeLeft
.
n14
=
-
eyeSep
;
eyeRight
.
elements
[
12
]
=
eyeSep
;
eyeLeft
.
elements
[
12
]
=
-
eyeSep
;
// for left eye
xmin
=
-
ymax
*
_aspect
+
eyeSepOnProjection
;
xmax
=
ymax
*
_aspect
+
eyeSepOnProjection
;
projectionMatrix
.
n11
=
2
*
_near
/
(
xmax
-
xmin
);
projectionMatrix
.
n13
=
(
xmax
+
xmin
)
/
(
xmax
-
xmin
);
projectionMatrix
.
elements
[
0
]
=
2
*
_near
/
(
xmax
-
xmin
);
projectionMatrix
.
elements
[
8
]
=
(
xmax
+
xmin
)
/
(
xmax
-
xmin
);
_cameraL
.
projectionMatrix
.
copy
(
projectionMatrix
);
...
...
@@ -144,8 +144,8 @@ if ( THREE.WebGLRenderer ) {
xmin
=
-
ymax
*
_aspect
-
eyeSepOnProjection
;
xmax
=
ymax
*
_aspect
-
eyeSepOnProjection
;
projectionMatrix
.
n11
=
2
*
_near
/
(
xmax
-
xmin
);
projectionMatrix
.
n13
=
(
xmax
+
xmin
)
/
(
xmax
-
xmin
);
projectionMatrix
.
elements
[
0
]
=
2
*
_near
/
(
xmax
-
xmin
);
projectionMatrix
.
elements
[
8
]
=
(
xmax
+
xmin
)
/
(
xmax
-
xmin
);
_cameraR
.
projectionMatrix
.
copy
(
projectionMatrix
);
...
...
src/extras/renderers/ParallaxBarrierWebGLRenderer.js
浏览文件 @
d3aa9678
...
...
@@ -128,16 +128,16 @@ if ( THREE.WebGLRenderer ) {
// translate xOffset
eyeRight
.
n14
=
eyeSep
;
eyeLeft
.
n14
=
-
eyeSep
;
eyeRight
.
elements
[
12
]
=
eyeSep
;
eyeLeft
.
elements
[
12
]
=
-
eyeSep
;
// for left eye
xmin
=
-
ymax
*
_aspect
+
eyeSepOnProjection
;
xmax
=
ymax
*
_aspect
+
eyeSepOnProjection
;
projectionMatrix
.
n11
=
2
*
_near
/
(
xmax
-
xmin
);
projectionMatrix
.
n13
=
(
xmax
+
xmin
)
/
(
xmax
-
xmin
);
projectionMatrix
.
elements
[
0
]
=
2
*
_near
/
(
xmax
-
xmin
);
projectionMatrix
.
elements
[
8
]
=
(
xmax
+
xmin
)
/
(
xmax
-
xmin
);
_cameraL
.
projectionMatrix
.
copy
(
projectionMatrix
);
...
...
@@ -146,8 +146,8 @@ if ( THREE.WebGLRenderer ) {
xmin
=
-
ymax
*
_aspect
-
eyeSepOnProjection
;
xmax
=
ymax
*
_aspect
-
eyeSepOnProjection
;
projectionMatrix
.
n11
=
2
*
_near
/
(
xmax
-
xmin
);
projectionMatrix
.
n13
=
(
xmax
+
xmin
)
/
(
xmax
-
xmin
);
projectionMatrix
.
elements
[
0
]
=
2
*
_near
/
(
xmax
-
xmin
);
projectionMatrix
.
elements
[
8
]
=
(
xmax
+
xmin
)
/
(
xmax
-
xmin
);
_cameraR
.
projectionMatrix
.
copy
(
projectionMatrix
);
...
...
src/extras/renderers/plugins/DepthPassPlugin.js
浏览文件 @
d3aa9678
...
...
@@ -92,8 +92,8 @@ THREE.DepthPassPlugin = function ( ) {
if
(
!
(
object
instanceof
THREE
.
Mesh
)
||
!
(
object
.
frustumCulled
)
||
_frustum
.
contains
(
object
)
)
{
object
.
matrixWorld
.
flattenToArray
(
object
.
_objectMatrixArray
);
object
.
_modelViewMatrix
.
multiply
ToArray
(
camera
.
matrixWorldInverse
,
object
.
matrixWorld
,
object
.
_modelViewMatrixArray
);
//
object.matrixWorld.flattenToArray( object._objectMatrixArray );
object
.
_modelViewMatrix
.
multiply
(
camera
.
matrixWorldInverse
,
object
.
matrixWorld
);
webglObject
.
render
=
true
;
...
...
@@ -155,13 +155,15 @@ THREE.DepthPassPlugin = function ( ) {
if
(
object
.
visible
&&
object
.
castShadow
)
{
if
(
object
.
matrixAutoUpdate
)
{
/*
if ( object.matrixAutoUpdate ) {
object.matrixWorld.flattenToArray( object._objectMatrixArray );
}
*/
object
.
_modelViewMatrix
.
multiply
ToArray
(
camera
.
matrixWorldInverse
,
object
.
matrixWorld
,
object
.
_modelViewMatrixArray
);
object
.
_modelViewMatrix
.
multiply
(
camera
.
matrixWorldInverse
,
object
.
matrixWorld
);
_renderer
.
renderImmediateObject
(
camera
,
scene
.
__lights
,
fog
,
_depthMaterial
,
object
);
...
...
src/extras/renderers/plugins/LensFlarePlugin.js
浏览文件 @
d3aa9678
...
...
@@ -164,7 +164,7 @@ THREE.LensFlarePlugin = function ( ) {
flare
=
flares
[
i
];
tempPosition
.
set
(
flare
.
matrixWorld
.
n14
,
flare
.
matrixWorld
.
n24
,
flare
.
matrixWorld
.
n34
);
tempPosition
.
set
(
flare
.
matrixWorld
.
elements
[
12
],
flare
.
matrixWorld
.
elements
[
13
],
flare
.
matrixWorld
.
elements
[
14
]
);
camera
.
matrixWorldInverse
.
multiplyVector3
(
tempPosition
);
camera
.
projectionMatrix
.
multiplyVector3
(
tempPosition
);
...
...
src/extras/renderers/plugins/ShadowMapPlugin.js
浏览文件 @
d3aa9678
...
...
@@ -222,8 +222,8 @@ THREE.ShadowMapPlugin = function ( ) {
if
(
!
(
object
instanceof
THREE
.
Mesh
)
||
!
(
object
.
frustumCulled
)
||
_frustum
.
contains
(
object
)
)
{
object
.
matrixWorld
.
flattenToArray
(
object
.
_objectMatrixArray
);
object
.
_modelViewMatrix
.
multiply
ToArray
(
shadowCamera
.
matrixWorldInverse
,
object
.
matrixWorld
,
object
.
_modelViewMatrixArray
);
//
object.matrixWorld.flattenToArray( object._objectMatrixArray );
object
.
_modelViewMatrix
.
multiply
(
shadowCamera
.
matrixWorldInverse
,
object
.
matrixWorld
);
webglObject
.
render
=
true
;
...
...
@@ -285,13 +285,15 @@ THREE.ShadowMapPlugin = function ( ) {
if
(
object
.
visible
&&
object
.
castShadow
)
{
if
(
object
.
matrixAutoUpdate
)
{
/*
if ( object.matrixAutoUpdate ) {
object.matrixWorld.flattenToArray( object._objectMatrixArray );
}
*/
object
.
_modelViewMatrix
.
multiply
ToArray
(
shadowCamera
.
matrixWorldInverse
,
object
.
matrixWorld
,
object
.
_modelViewMatrixArray
);
object
.
_modelViewMatrix
.
multiply
(
shadowCamera
.
matrixWorldInverse
,
object
.
matrixWorld
);
_renderer
.
renderImmediateObject
(
shadowCamera
,
scene
.
__lights
,
fog
,
_depthMaterial
,
object
);
...
...
src/extras/renderers/plugins/SpritePlugin.js
浏览文件 @
d3aa9678
...
...
@@ -129,8 +129,8 @@ THREE.SpritePlugin = function ( ) {
if
(
!
sprite
.
useScreenCoordinates
)
{
sprite
.
_modelViewMatrix
.
multiply
ToArray
(
camera
.
matrixWorldInverse
,
sprite
.
matrixWorld
,
sprite
.
_modelViewMatrixArray
);
sprite
.
z
=
-
sprite
.
_modelViewMatrix
.
n34
;
sprite
.
_modelViewMatrix
.
multiply
(
camera
.
matrixWorldInverse
,
sprite
.
matrixWorld
);
sprite
.
z
=
-
sprite
.
_modelViewMatrix
.
elements
[
14
]
;
}
else
{
...
...
@@ -163,7 +163,7 @@ THREE.SpritePlugin = function ( ) {
_gl
.
uniform1i
(
uniforms
.
useScreenCoordinates
,
0
);
_gl
.
uniform1i
(
uniforms
.
affectedByDistance
,
sprite
.
affectedByDistance
?
1
:
0
);
_gl
.
uniformMatrix4fv
(
uniforms
.
modelViewMatrix
,
false
,
sprite
.
_modelViewMatrix
Array
);
_gl
.
uniformMatrix4fv
(
uniforms
.
modelViewMatrix
,
false
,
sprite
.
_modelViewMatrix
.
elements
);
}
...
...
src/objects/LOD.js
浏览文件 @
d3aa9678
...
...
@@ -48,7 +48,7 @@ THREE.LOD.prototype.update = function ( camera ) {
camera
.
matrixWorldInverse
.
getInverse
(
camera
.
matrixWorld
);
var
inverse
=
camera
.
matrixWorldInverse
;
var
distance
=
-
(
inverse
.
n31
*
this
.
matrixWorld
.
n14
+
inverse
.
n32
*
this
.
matrixWorld
.
n24
+
inverse
.
n33
*
this
.
matrixWorld
.
n34
+
inverse
.
n34
);
var
distance
=
-
(
inverse
.
elements
[
2
]
*
this
.
matrixWorld
.
elements
[
12
]
+
inverse
.
elements
[
6
]
*
this
.
matrixWorld
.
elements
[
13
]
+
inverse
.
elements
[
10
]
*
this
.
matrixWorld
.
elements
[
14
]
+
inverse
.
elements
[
14
]
);
this
.
LODs
[
0
].
object3D
.
visible
=
true
;
...
...
src/renderers/CanvasRenderer.js
浏览文件 @
d3aa9678
...
...
@@ -546,16 +546,16 @@ THREE.CanvasRenderer = function ( parameters ) {
var
cameraMatrix
=
camera
.
matrixWorldInverse
;
_vector3
.
copy
(
element
.
vertexNormalsWorld
[
uv1
]
);
_uv1x
=
(
_vector3
.
x
*
cameraMatrix
.
n11
+
_vector3
.
y
*
cameraMatrix
.
n12
+
_vector3
.
z
*
cameraMatrix
.
n13
)
*
0.5
+
0.5
;
_uv1y
=
-
(
_vector3
.
x
*
cameraMatrix
.
n21
+
_vector3
.
y
*
cameraMatrix
.
n22
+
_vector3
.
z
*
cameraMatrix
.
n23
)
*
0.5
+
0.5
;
_uv1x
=
(
_vector3
.
x
*
cameraMatrix
.
elements
[
0
]
+
_vector3
.
y
*
cameraMatrix
.
elements
[
4
]
+
_vector3
.
z
*
cameraMatrix
.
elements
[
8
]
)
*
0.5
+
0.5
;
_uv1y
=
-
(
_vector3
.
x
*
cameraMatrix
.
elements
[
1
]
+
_vector3
.
y
*
cameraMatrix
.
elements
[
5
]
+
_vector3
.
z
*
cameraMatrix
.
elements
[
9
]
)
*
0.5
+
0.5
;
_vector3
.
copy
(
element
.
vertexNormalsWorld
[
uv2
]
);
_uv2x
=
(
_vector3
.
x
*
cameraMatrix
.
n11
+
_vector3
.
y
*
cameraMatrix
.
n12
+
_vector3
.
z
*
cameraMatrix
.
n13
)
*
0.5
+
0.5
;
_uv2y
=
-
(
_vector3
.
x
*
cameraMatrix
.
n21
+
_vector3
.
y
*
cameraMatrix
.
n22
+
_vector3
.
z
*
cameraMatrix
.
n23
)
*
0.5
+
0.5
;
_uv2x
=
(
_vector3
.
x
*
cameraMatrix
.
elements
[
0
]
+
_vector3
.
y
*
cameraMatrix
.
elements
[
4
]
+
_vector3
.
z
*
cameraMatrix
.
elements
[
8
]
)
*
0.5
+
0.5
;
_uv2y
=
-
(
_vector3
.
x
*
cameraMatrix
.
elements
[
1
]
+
_vector3
.
y
*
cameraMatrix
.
elements
[
5
]
+
_vector3
.
z
*
cameraMatrix
.
elements
[
9
]
)
*
0.5
+
0.5
;
_vector3
.
copy
(
element
.
vertexNormalsWorld
[
uv3
]
);
_uv3x
=
(
_vector3
.
x
*
cameraMatrix
.
n11
+
_vector3
.
y
*
cameraMatrix
.
n12
+
_vector3
.
z
*
cameraMatrix
.
n13
)
*
0.5
+
0.5
;
_uv3y
=
-
(
_vector3
.
x
*
cameraMatrix
.
n21
+
_vector3
.
y
*
cameraMatrix
.
n22
+
_vector3
.
z
*
cameraMatrix
.
n23
)
*
0.5
+
0.5
;
_uv3x
=
(
_vector3
.
x
*
cameraMatrix
.
elements
[
0
]
+
_vector3
.
y
*
cameraMatrix
.
elements
[
4
]
+
_vector3
.
z
*
cameraMatrix
.
elements
[
8
]
)
*
0.5
+
0.5
;
_uv3y
=
-
(
_vector3
.
x
*
cameraMatrix
.
elements
[
1
]
+
_vector3
.
y
*
cameraMatrix
.
elements
[
5
]
+
_vector3
.
z
*
cameraMatrix
.
elements
[
9
]
)
*
0.5
+
0.5
;
patternPath
(
_v1x
,
_v1y
,
_v2x
,
_v2y
,
_v3x
,
_v3y
,
_uv1x
,
_uv1y
,
_uv2x
,
_uv2y
,
_uv3x
,
_uv3y
,
material
.
envMap
);
...
...
src/renderers/WebGLRenderer.js
浏览文件 @
d3aa9678
...
...
@@ -3371,7 +3371,7 @@ THREE.WebGLRenderer = function ( parameters ) {
if
(
!
(
object
instanceof
THREE
.
Mesh
||
object
instanceof
THREE
.
ParticleSystem
)
||
!
(
object
.
frustumCulled
)
||
_frustum
.
contains
(
object
)
)
{
object
.
matrixWorld
.
flattenToArray
(
object
.
_objectMatrixArray
);
//
object.matrixWorld.flattenToArray( object._objectMatrixArray );
setupMatrices
(
object
,
camera
);
...
...
@@ -3419,11 +3419,13 @@ THREE.WebGLRenderer = function ( parameters ) {
if
(
object
.
visible
)
{
if
(
object
.
matrixAutoUpdate
)
{
/*
if ( object.matrixAutoUpdate ) {
object.matrixWorld.flattenToArray( object._objectMatrixArray );
}
*/
setupMatrices
(
object
,
camera
);
...
...
@@ -3828,11 +3830,11 @@ THREE.WebGLRenderer = function ( parameters ) {
object
.
_modelViewMatrix
=
new
THREE
.
Matrix4
();
object
.
_normalMatrix
=
new
THREE
.
Matrix3
();
object
.
_normalMatrixArray
=
new
Float32Array
(
9
);
object
.
_modelViewMatrixArray
=
new
Float32Array
(
16
);
object
.
_objectMatrixArray
=
new
Float32Array
(
16
);
//
object._normalMatrixArray = new Float32Array( 9 );
//
object._modelViewMatrixArray = new Float32Array( 16 );
//
object._objectMatrixArray = new Float32Array( 16 );
object
.
matrixWorld
.
flattenToArray
(
object
.
_objectMatrixArray
);
//
object.matrixWorld.flattenToArray( object._objectMatrixArray );
if
(
object
instanceof
THREE
.
Mesh
)
{
...
...
@@ -4533,7 +4535,7 @@ THREE.WebGLRenderer = function ( parameters ) {
if
(
p_uniforms
.
objectMatrix
!==
null
)
{
_gl
.
uniformMatrix4fv
(
p_uniforms
.
objectMatrix
,
false
,
object
.
_objectMatrixArray
);
_gl
.
uniformMatrix4fv
(
p_uniforms
.
objectMatrix
,
false
,
object
.
matrixWorld
.
elements
);
}
...
...
@@ -4728,11 +4730,11 @@ THREE.WebGLRenderer = function ( parameters ) {
function
loadUniformsMatrices
(
uniforms
,
object
)
{
_gl
.
uniformMatrix4fv
(
uniforms
.
modelViewMatrix
,
false
,
object
.
_modelViewMatrix
Array
);
_gl
.
uniformMatrix4fv
(
uniforms
.
modelViewMatrix
,
false
,
object
.
_modelViewMatrix
.
elements
);
if
(
uniforms
.
normalMatrix
)
{
_gl
.
uniformMatrix3fv
(
uniforms
.
normalMatrix
,
false
,
object
.
_normalMatrix
Array
);
_gl
.
uniformMatrix3fv
(
uniforms
.
normalMatrix
,
false
,
object
.
_normalMatrix
.
elements
);
}
...
...
@@ -4958,10 +4960,10 @@ THREE.WebGLRenderer = function ( parameters ) {
function
setupMatrices
(
object
,
camera
)
{
object
.
_modelViewMatrix
.
multiply
ToArray
(
camera
.
matrixWorldInverse
,
object
.
matrixWorld
,
object
.
_modelViewMatrixArray
);
object
.
_modelViewMatrix
.
multiply
(
camera
.
matrixWorldInverse
,
object
.
matrixWorld
);
object
.
_normalMatrix
.
getInverse
(
object
.
_modelViewMatrix
);
object
.
_normalMatrix
.
transpose
IntoArray
(
object
.
_normalMatrixArray
);
object
.
_normalMatrix
.
transpose
(
);
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录