Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
3d0eac48
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,体验更适合开发者的 AI 搜索 >>
提交
3d0eac48
编写于
7月 03, 2021
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FBXLoader: Matrix4 code clean up.
上级
a40bb1ae
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
20 addition
and
28 deletion
+20
-28
examples/js/loaders/FBXLoader.js
examples/js/loaders/FBXLoader.js
+10
-14
examples/jsm/loaders/FBXLoader.js
examples/jsm/loaders/FBXLoader.js
+10
-14
未找到文件。
examples/js/loaders/FBXLoader.js
浏览文件 @
3d0eac48
...
...
@@ -3745,16 +3745,15 @@
}
const
lLRM
=
new
THREE
.
Matrix4
().
copy
(
lPreRotationM
).
multiply
(
lRotationM
).
multiply
(
lPostRotationM
);
// Global Rotation
const
lLRM
=
lPreRotationM
.
clone
(
).
multiply
(
lRotationM
).
multiply
(
lPostRotationM
);
// Global Rotation
const
lParentGRM
=
new
THREE
.
Matrix4
();
lParentGRM
.
extractRotation
(
lParentGX
);
// Global Shear*Scaling
const
lParentTM
=
new
THREE
.
Matrix4
();
lParentTM
.
copyPosition
(
lParentGX
);
const
lParentGSM
=
new
THREE
.
Matrix4
();
const
lParentGRSM
=
new
THREE
.
Matrix4
().
copy
(
lParentTM
).
invert
().
multiply
(
lParentGX
);
lParentGSM
.
copy
(
lParentGRM
).
invert
().
multiply
(
lParentGRSM
);
const
lParentGRSM
=
lParentTM
.
clone
().
invert
().
multiply
(
lParentGX
);
const
lParentGSM
=
lParentGRM
.
clone
().
invert
().
multiply
(
lParentGRSM
);
const
lLSM
=
lScalingM
;
const
lGlobalRS
=
new
THREE
.
Matrix4
();
...
...
@@ -3769,23 +3768,20 @@
}
else
{
const
lParentLSM
=
new
THREE
.
Matrix4
().
scale
(
new
THREE
.
Vector3
().
setFromMatrixScale
(
lParentLX
)
);
const
lParentLSM_inv
=
new
THREE
.
Matrix4
().
copy
(
lParentLSM
).
invert
();
const
lParentGSM_noLocal
=
new
THREE
.
Matrix4
().
copy
(
lParentGSM
).
multiply
(
lParentLSM_inv
);
const
lParentLSM_inv
=
lParentLSM
.
clone
(
).
invert
();
const
lParentGSM_noLocal
=
lParentGSM
.
clone
(
).
multiply
(
lParentLSM_inv
);
lGlobalRS
.
copy
(
lParentGRM
).
multiply
(
lLRM
).
multiply
(
lParentGSM_noLocal
).
multiply
(
lLSM
);
}
const
lRotationPivotM_inv
=
new
THREE
.
Matrix4
();
lRotationPivotM_inv
.
copy
(
lRotationPivotM
).
invert
();
const
lScalingPivotM_inv
=
new
THREE
.
Matrix4
();
lScalingPivotM_inv
.
copy
(
lScalingPivotM
).
invert
();
// Calculate the local transform matrix
const
lRotationPivotM_inv
=
lRotationPivotM
.
clone
().
invert
();
const
lScalingPivotM_inv
=
lScalingPivotM
.
clone
().
invert
();
// Calculate the local transform matrix
let
lTransform
=
new
THREE
.
Matrix4
();
lTransform
.
copy
(
lTranslationM
).
multiply
(
lRotationOffsetM
).
multiply
(
lRotationPivotM
).
multiply
(
lPreRotationM
).
multiply
(
lRotationM
).
multiply
(
lPostRotationM
).
multiply
(
lRotationPivotM_inv
).
multiply
(
lScalingOffsetM
).
multiply
(
lScalingPivotM
).
multiply
(
lScalingM
).
multiply
(
lScalingPivotM_inv
);
let
lTransform
=
lTranslationM
.
clone
().
multiply
(
lRotationOffsetM
).
multiply
(
lRotationPivotM
).
multiply
(
lPreRotationM
).
multiply
(
lRotationM
).
multiply
(
lPostRotationM
).
multiply
(
lRotationPivotM_inv
).
multiply
(
lScalingOffsetM
).
multiply
(
lScalingPivotM
).
multiply
(
lScalingM
).
multiply
(
lScalingPivotM_inv
);
const
lLocalTWithAllPivotAndOffsetInfo
=
new
THREE
.
Matrix4
().
copyPosition
(
lTransform
);
const
lGlobalTranslation
=
new
THREE
.
Matrix4
().
copy
(
lParentGX
).
multiply
(
lLocalTWithAllPivotAndOffsetInfo
);
const
lGlobalTranslation
=
lParentGX
.
clone
(
).
multiply
(
lLocalTWithAllPivotAndOffsetInfo
);
lGlobalT
.
copyPosition
(
lGlobalTranslation
);
lTransform
=
new
THREE
.
Matrix4
().
copy
(
lGlobalT
).
multiply
(
lGlobalRS
);
// from global to local
lTransform
=
lGlobalT
.
clone
(
).
multiply
(
lGlobalRS
);
// from global to local
lTransform
.
premultiply
(
lParentGX
.
invert
()
);
return
lTransform
;
...
...
examples/jsm/loaders/FBXLoader.js
浏览文件 @
3d0eac48
...
...
@@ -4049,7 +4049,7 @@ function generateTransform( transformData ) {
}
const
lLRM
=
new
Matrix4
().
copy
(
lPreRotationM
).
multiply
(
lRotationM
).
multiply
(
lPostRotationM
);
const
lLRM
=
lPreRotationM
.
clone
(
).
multiply
(
lRotationM
).
multiply
(
lPostRotationM
);
// Global Rotation
const
lParentGRM
=
new
Matrix4
();
lParentGRM
.
extractRotation
(
lParentGX
);
...
...
@@ -4058,9 +4058,8 @@ function generateTransform( transformData ) {
const
lParentTM
=
new
Matrix4
();
lParentTM
.
copyPosition
(
lParentGX
);
const
lParentGSM
=
new
Matrix4
();
const
lParentGRSM
=
new
Matrix4
().
copy
(
lParentTM
).
invert
().
multiply
(
lParentGX
);
lParentGSM
.
copy
(
lParentGRM
).
invert
().
multiply
(
lParentGRSM
);
const
lParentGRSM
=
lParentTM
.
clone
().
invert
().
multiply
(
lParentGX
);
const
lParentGSM
=
lParentGRM
.
clone
().
invert
().
multiply
(
lParentGRSM
);
const
lLSM
=
lScalingM
;
const
lGlobalRS
=
new
Matrix4
();
...
...
@@ -4076,27 +4075,24 @@ function generateTransform( transformData ) {
}
else
{
const
lParentLSM
=
new
Matrix4
().
scale
(
new
Vector3
().
setFromMatrixScale
(
lParentLX
)
);
const
lParentLSM_inv
=
new
Matrix4
().
copy
(
lParentLSM
).
invert
();
const
lParentGSM_noLocal
=
new
Matrix4
().
copy
(
lParentGSM
).
multiply
(
lParentLSM_inv
);
const
lParentLSM_inv
=
lParentLSM
.
clone
(
).
invert
();
const
lParentGSM_noLocal
=
lParentGSM
.
clone
(
).
multiply
(
lParentLSM_inv
);
lGlobalRS
.
copy
(
lParentGRM
).
multiply
(
lLRM
).
multiply
(
lParentGSM_noLocal
).
multiply
(
lLSM
);
}
const
lRotationPivotM_inv
=
new
Matrix4
();
lRotationPivotM_inv
.
copy
(
lRotationPivotM
).
invert
();
const
lScalingPivotM_inv
=
new
Matrix4
();
lScalingPivotM_inv
.
copy
(
lScalingPivotM
).
invert
();
const
lRotationPivotM_inv
=
lRotationPivotM
.
clone
().
invert
();
const
lScalingPivotM_inv
=
lScalingPivotM
.
clone
().
invert
();
// Calculate the local transform matrix
let
lTransform
=
new
Matrix4
();
lTransform
.
copy
(
lTranslationM
).
multiply
(
lRotationOffsetM
).
multiply
(
lRotationPivotM
).
multiply
(
lPreRotationM
).
multiply
(
lRotationM
).
multiply
(
lPostRotationM
).
multiply
(
lRotationPivotM_inv
).
multiply
(
lScalingOffsetM
).
multiply
(
lScalingPivotM
).
multiply
(
lScalingM
).
multiply
(
lScalingPivotM_inv
);
let
lTransform
=
lTranslationM
.
clone
().
multiply
(
lRotationOffsetM
).
multiply
(
lRotationPivotM
).
multiply
(
lPreRotationM
).
multiply
(
lRotationM
).
multiply
(
lPostRotationM
).
multiply
(
lRotationPivotM_inv
).
multiply
(
lScalingOffsetM
).
multiply
(
lScalingPivotM
).
multiply
(
lScalingM
).
multiply
(
lScalingPivotM_inv
);
const
lLocalTWithAllPivotAndOffsetInfo
=
new
Matrix4
().
copyPosition
(
lTransform
);
const
lGlobalTranslation
=
new
Matrix4
().
copy
(
lParentGX
).
multiply
(
lLocalTWithAllPivotAndOffsetInfo
);
const
lGlobalTranslation
=
lParentGX
.
clone
(
).
multiply
(
lLocalTWithAllPivotAndOffsetInfo
);
lGlobalT
.
copyPosition
(
lGlobalTranslation
);
lTransform
=
new
Matrix4
().
copy
(
lGlobalT
).
multiply
(
lGlobalRS
);
lTransform
=
lGlobalT
.
clone
(
).
multiply
(
lGlobalRS
);
// from global to local
lTransform
.
premultiply
(
lParentGX
.
invert
()
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录