Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
17e23f03
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,发现更多精彩内容 >>
提交
17e23f03
编写于
8月 22, 2011
作者:
T
timk
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
matrix compose / decompose metho
上级
aa53050a
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
112 addition
and
59 deletion
+112
-59
build/Three.js
build/Three.js
+57
-56
src/core/Matrix4.js
src/core/Matrix4.js
+53
-1
src/extras/collada/dae.js
src/extras/collada/dae.js
+2
-2
未找到文件。
build/Three.js
浏览文件 @
17e23f03
此差异已折叠。
点击以展开。
src/core/Matrix4.js
浏览文件 @
17e23f03
...
...
@@ -6,6 +6,7 @@
* @author D1plo1d / http://github.com/D1plo1d
* @author alteredq / http://alteredqualia.com/
* @author mikael emtinger / http://gomo.se/
* @author timknip / http://www.floorplanner.com/
*/
THREE
.
Matrix4
=
function
(
n11
,
n12
,
n13
,
n14
,
n21
,
n22
,
n23
,
n24
,
n31
,
n32
,
n33
,
n34
,
n41
,
n42
,
n43
,
n44
)
{
...
...
@@ -667,6 +668,57 @@ THREE.Matrix4.prototype = {
},
compose
:
function
(
translation
,
rotation
,
scale
)
{
var
mr
=
new
THREE
.
Matrix4
();
var
ms
=
new
THREE
.
Matrix4
();
mr
.
setRotationFromQuaternion
(
rotation
);
ms
.
setScale
(
scale
.
x
,
scale
.
y
,
scale
.
z
);
this
.
multiply
(
mr
,
ms
);
this
.
n14
=
translation
.
x
;
this
.
n24
=
translation
.
y
;
this
.
n34
=
translation
.
z
;
return
this
;
},
decompose
:
function
(
translation
,
rotation
,
scale
)
{
// grab the axis vecs
var
x
=
new
THREE
.
Vector3
(
this
.
n11
,
this
.
n21
,
this
.
n31
);
var
y
=
new
THREE
.
Vector3
(
this
.
n12
,
this
.
n22
,
this
.
n32
);
var
z
=
new
THREE
.
Vector3
(
this
.
n13
,
this
.
n23
,
this
.
n33
);
translation
=
(
translation
instanceof
THREE
.
Vector3
)
?
translation
:
new
THREE
.
Vector3
();
rotation
=
(
rotation
instanceof
THREE
.
Quaternion
)
?
rotation
:
new
THREE
.
Quaternion
();
scale
=
(
scale
instanceof
THREE
.
Vector3
)
?
scale
:
new
THREE
.
Vector3
();
scale
.
x
=
x
.
length
();
scale
.
y
=
y
.
length
();
scale
.
z
=
z
.
length
();
translation
.
x
=
this
.
n14
;
translation
.
y
=
this
.
n24
;
translation
.
z
=
this
.
n34
;
// scale the rotation part
var
matrix
=
this
.
clone
();
matrix
.
n11
/=
scale
.
x
;
matrix
.
n21
/=
scale
.
x
;
matrix
.
n31
/=
scale
.
x
;
matrix
.
n12
/=
scale
.
y
;
matrix
.
n22
/=
scale
.
y
;
matrix
.
n32
/=
scale
.
y
;
matrix
.
n13
/=
scale
.
z
;
matrix
.
n23
/=
scale
.
z
;
matrix
.
n33
/=
scale
.
z
;
rotation
.
setFromRotationMatrix
(
matrix
);
},
extractPosition
:
function
(
m
)
{
this
.
n14
=
m
.
n14
;
...
...
@@ -674,7 +726,7 @@ THREE.Matrix4.prototype = {
this
.
n34
=
m
.
n34
;
},
extractRotation
:
function
(
m
,
s
)
{
var
invScaleX
=
1
/
s
.
x
,
invScaleY
=
1
/
s
.
y
,
invScaleZ
=
1
/
s
.
z
;
...
...
src/extras/collada/dae.js
浏览文件 @
17e23f03
...
...
@@ -236,8 +236,8 @@ var DAE = (function() {
obj
.
name
=
node
.
id
||
""
;
obj
.
matrixAutoUpdate
=
false
;
obj
.
matrix
=
node
.
matrix
;
obj
.
matrix
=
node
.
matrix
.
clone
()
;
// FIXME: controllers
for
(
i
=
0
;
i
<
node
.
controllers
.
length
;
i
++
)
{
var
controller
=
controllers
[
node
.
controllers
[
i
].
url
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录