Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fktz008
three.js
提交
1fb1c463
T
three.js
项目概览
fktz008
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
1fb1c463
编写于
4月 08, 2012
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'alteredq/dev' into dev
上级
155b7af1
9ab854de
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
43 addition
and
47 deletion
+43
-47
src/core/Matrix3.js
src/core/Matrix3.js
+37
-0
src/core/Matrix4.js
src/core/Matrix4.js
+2
-40
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+4
-7
未找到文件。
src/core/Matrix3.js
浏览文件 @
1fb1c463
...
...
@@ -12,6 +12,43 @@ THREE.Matrix3.prototype = {
constructor
:
THREE
.
Matrix3
,
getInverse
:
function
(
m
)
{
// input: THREE.Matrix4
// ( based on http://code.google.com/p/webgl-mjs/ )
var
a11
=
m
.
n33
*
m
.
n22
-
m
.
n32
*
m
.
n23
,
a21
=
-
m
.
n33
*
m
.
n21
+
m
.
n31
*
m
.
n23
,
a31
=
m
.
n32
*
m
.
n21
-
m
.
n31
*
m
.
n22
,
a12
=
-
m
.
n33
*
m
.
n12
+
m
.
n32
*
m
.
n13
,
a22
=
m
.
n33
*
m
.
n11
-
m
.
n31
*
m
.
n13
,
a32
=
-
m
.
n32
*
m
.
n11
+
m
.
n31
*
m
.
n12
,
a13
=
m
.
n23
*
m
.
n12
-
m
.
n22
*
m
.
n13
,
a23
=
-
m
.
n23
*
m
.
n11
+
m
.
n21
*
m
.
n13
,
a33
=
m
.
n22
*
m
.
n11
-
m
.
n21
*
m
.
n12
;
var
det
=
m
.
n11
*
a11
+
m
.
n21
*
a12
+
m
.
n31
*
a13
;
// no inverse
if
(
det
===
0
)
{
console
.
warn
(
"
Matrix3.getInverse(): determinant == 0
"
);
}
var
idet
=
1.0
/
det
;
var
m
=
this
.
m
;
m
[
0
]
=
idet
*
a11
;
m
[
1
]
=
idet
*
a21
;
m
[
2
]
=
idet
*
a31
;
m
[
3
]
=
idet
*
a12
;
m
[
4
]
=
idet
*
a22
;
m
[
5
]
=
idet
*
a32
;
m
[
6
]
=
idet
*
a13
;
m
[
7
]
=
idet
*
a23
;
m
[
8
]
=
idet
*
a33
;
return
this
;
},
/*
transpose: function () {
...
...
src/core/Matrix4.js
浏览文件 @
1fb1c463
...
...
@@ -20,8 +20,6 @@ THREE.Matrix4 = function ( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33
);
this
.
m33
=
new
THREE
.
Matrix3
();
};
THREE
.
Matrix4
.
prototype
=
{
...
...
@@ -232,6 +230,7 @@ THREE.Matrix4.prototype = {
//TODO: make this more efficient
//( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm )
return
(
n14
*
n23
*
n32
*
n41
-
n13
*
n24
*
n32
*
n41
-
...
...
@@ -962,6 +961,7 @@ THREE.Matrix4.prototype = {
},
clone
:
function
()
{
return
new
THREE
.
Matrix4
(
...
...
@@ -977,44 +977,6 @@ THREE.Matrix4.prototype = {
};
THREE
.
Matrix4
.
makeInvert3x3
=
function
(
m1
)
{
// input: THREE.Matrix4, output: THREE.Matrix3
// ( based on http://code.google.com/p/webgl-mjs/ )
var
m33
=
m1
.
m33
,
m33m
=
m33
.
m
,
a11
=
m1
.
n33
*
m1
.
n22
-
m1
.
n32
*
m1
.
n23
,
a21
=
-
m1
.
n33
*
m1
.
n21
+
m1
.
n31
*
m1
.
n23
,
a31
=
m1
.
n32
*
m1
.
n21
-
m1
.
n31
*
m1
.
n22
,
a12
=
-
m1
.
n33
*
m1
.
n12
+
m1
.
n32
*
m1
.
n13
,
a22
=
m1
.
n33
*
m1
.
n11
-
m1
.
n31
*
m1
.
n13
,
a32
=
-
m1
.
n32
*
m1
.
n11
+
m1
.
n31
*
m1
.
n12
,
a13
=
m1
.
n23
*
m1
.
n12
-
m1
.
n22
*
m1
.
n13
,
a23
=
-
m1
.
n23
*
m1
.
n11
+
m1
.
n21
*
m1
.
n13
,
a33
=
m1
.
n22
*
m1
.
n11
-
m1
.
n21
*
m1
.
n12
,
det
=
m1
.
n11
*
a11
+
m1
.
n21
*
a12
+
m1
.
n31
*
a13
,
idet
;
// no inverse
if
(
det
===
0
)
{
return
null
;
}
idet
=
1.0
/
det
;
m33m
[
0
]
=
idet
*
a11
;
m33m
[
1
]
=
idet
*
a21
;
m33m
[
2
]
=
idet
*
a31
;
m33m
[
3
]
=
idet
*
a12
;
m33m
[
4
]
=
idet
*
a22
;
m33m
[
5
]
=
idet
*
a32
;
m33m
[
6
]
=
idet
*
a13
;
m33m
[
7
]
=
idet
*
a23
;
m33m
[
8
]
=
idet
*
a33
;
return
m33
;
}
THREE
.
Matrix4
.
__v1
=
new
THREE
.
Vector3
();
THREE
.
Matrix4
.
__v2
=
new
THREE
.
Vector3
();
THREE
.
Matrix4
.
__v3
=
new
THREE
.
Vector3
();
...
...
src/renderers/WebGLRenderer.js
浏览文件 @
1fb1c463
...
...
@@ -301,6 +301,7 @@ THREE.WebGLRenderer = function ( parameters ) {
object
.
__webglInit
=
false
;
delete
object
.
_modelViewMatrix
;
delete
object
.
_normalMatrix
;
delete
object
.
_normalMatrixArray
;
delete
object
.
_modelViewMatrixArray
;
...
...
@@ -3824,6 +3825,7 @@ THREE.WebGLRenderer = function ( parameters ) {
object
.
__webglInit
=
true
;
object
.
_modelViewMatrix
=
new
THREE
.
Matrix4
();
object
.
_normalMatrix
=
new
THREE
.
Matrix3
();
object
.
_normalMatrixArray
=
new
Float32Array
(
9
);
object
.
_modelViewMatrixArray
=
new
Float32Array
(
16
);
...
...
@@ -4937,13 +4939,8 @@ THREE.WebGLRenderer = function ( parameters ) {
object
.
_modelViewMatrix
.
multiplyToArray
(
camera
.
matrixWorldInverse
,
object
.
matrixWorld
,
object
.
_modelViewMatrixArray
);
var
inverseMatrix
=
THREE
.
Matrix4
.
makeInvert3x3
(
object
.
_modelViewMatrix
);
if
(
inverseMatrix
)
{
inverseMatrix
.
transposeIntoArray
(
object
.
_normalMatrixArray
);
}
object
.
_normalMatrix
.
getInverse
(
object
.
_modelViewMatrix
);
object
.
_normalMatrix
.
transposeIntoArray
(
object
.
_normalMatrixArray
);
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录