Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
8a9b4ab4
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,发现更多精彩内容 >>
提交
8a9b4ab4
编写于
3月 08, 2011
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
差异文件
Merge remote branch 'empaempa/master'
上级
90fc8e87
42b0d7e0
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
213 addition
and
153 deletion
+213
-153
build/Three.js
build/Three.js
+130
-130
src/animation/Animation.js
src/animation/Animation.js
+22
-12
src/animation/AnimationHandler.js
src/animation/AnimationHandler.js
+28
-8
src/core/Matrix4.js
src/core/Matrix4.js
+19
-2
src/objects/SkinnedMesh.js
src/objects/SkinnedMesh.js
+14
-1
未找到文件。
build/Three.js
浏览文件 @
8a9b4ab4
此差异已折叠。
点击以展开。
src/animation/Animation.js
浏览文件 @
8a9b4ab4
...
...
@@ -162,12 +162,11 @@ THREE.Animation.prototype.update = function( deltaTimeMS ) {
// use JIT?
if
(
JIThierarchy
[
h
][
frame
]
!==
undefined
)
{
if
(
this
.
JITCompile
&&
JIThierarchy
[
h
][
frame
]
!==
undefined
)
{
if
(
object
instanceof
THREE
.
Bone
)
{
object
.
skinMatrix
=
JIThierarchy
[
h
][
frame
];
object
.
skinMatrix
.
flattenToArrayOffset
(
this
.
root
.
boneMatrices
,
h
*
16
);
object
.
matrixAutoUpdate
=
false
;
object
.
matrixWorldNeedsUpdate
=
false
;
...
...
@@ -186,14 +185,18 @@ THREE.Animation.prototype.update = function( deltaTimeMS ) {
// make sure so original matrix and not JIT matrix is set
if
(
object
instanceof
THREE
.
Bone
)
{
object
.
skinMatrix
=
object
.
animationCache
.
originalMatrix
;
}
else
{
object
.
matrix
=
object
.
animationCache
.
originalMatrix
;
if
(
this
.
JITCompile
)
{
if
(
object
instanceof
THREE
.
Bone
)
{
object
.
skinMatrix
=
object
.
animationCache
.
originalMatrix
;
}
else
{
object
.
matrix
=
object
.
animationCache
.
originalMatrix
;
}
}
...
...
@@ -209,17 +212,24 @@ THREE.Animation.prototype.update = function( deltaTimeMS ) {
// switch keys?
if
(
nextKey
.
time
<
unloopedCurrentTime
)
{
if
(
nextKey
.
time
<
=
unloopedCurrentTime
)
{
// did we loop?
if
(
currentTime
<
unloopedCurrentTime
)
{
if
(
currentTime
<
=
unloopedCurrentTime
)
{
if
(
this
.
loop
)
{
prevKey
=
this
.
data
.
hierarchy
[
h
].
keys
[
0
];
nextKey
=
this
.
getNextKeyWith
(
type
,
h
,
1
);
while
(
nextKey
.
time
<
currentTime
)
{
prevKey
=
nextKey
;
nextKey
=
this
.
getNextKeyWith
(
type
,
h
,
nextKey
.
index
+
1
);
}
}
else
{
this
.
stop
();
...
...
@@ -256,7 +266,7 @@ THREE.Animation.prototype.update = function( deltaTimeMS ) {
if
(
scale
<
0
||
scale
>
1
)
{
console
.
log
(
"
THREE.Animation.update: Warning! Scale out of bounds:
"
+
scale
);
console
.
log
(
"
THREE.Animation.update: Warning! Scale out of bounds:
"
+
scale
+
"
on bone
"
+
h
);
scale
=
scale
<
0
?
0
:
1
;
}
...
...
src/animation/AnimationHandler.js
浏览文件 @
8a9b4ab4
...
...
@@ -118,8 +118,8 @@ THREE.AnimationHandler = (function() {
return
;
// THIS SHOULD BE REMOVED WHEN LENGTH IS UPDATED TO MS IN EXPORT FORMAT!
data
.
length
=
parseInt
(
data
.
length
*
1000
,
10
);
data
.
fps
*=
0.001
;
//
data.length = parseInt( data.length * 1000, 10 );
//
data.fps *= 0.001;
// loop through all keys
...
...
@@ -135,11 +135,7 @@ THREE.AnimationHandler = (function() {
// THIS SHOULD BE REMOVED WHEN LENGTH IS UPDATED TO MS IN EXPORT FORMAT!
data
.
hierarchy
[
h
].
keys
[
k
].
time
=
parseInt
(
data
.
hierarchy
[
h
].
keys
[
k
].
time
*
1000
,
10
);
// set index
data
.
hierarchy
[
h
].
keys
[
k
].
index
=
k
;
//data.hierarchy[ h ].keys[ k ].time = parseInt( data.hierarchy[ h ].keys[ k ].time * 1000, 10 );
// create quaternions
...
...
@@ -151,13 +147,37 @@ THREE.AnimationHandler = (function() {
data
.
hierarchy
[
h
].
keys
[
k
].
rot
=
new
THREE
.
Quaternion
(
quat
[
0
],
quat
[
1
],
quat
[
2
],
quat
[
3
]
);
}
}
// remove all keys that are on the same time
for
(
var
k
=
1
;
k
<
data
.
hierarchy
[
h
].
keys
.
length
;
k
++
)
{
if
(
data
.
hierarchy
[
h
].
keys
[
k
].
time
===
data
.
hierarchy
[
h
].
keys
[
k
-
1
].
time
)
{
data
.
hierarchy
[
h
].
keys
.
splice
(
k
,
1
);
k
--
;
}
}
// set index
for
(
var
k
=
1
;
k
<
data
.
hierarchy
[
h
].
keys
.
length
;
k
++
)
{
data
.
hierarchy
[
h
].
keys
[
k
].
index
=
k
;
}
}
// JIT
var
lengthInFrames
=
parseInt
(
data
.
length
*
data
.
fps
*
0.001
,
10
);
var
lengthInFrames
=
parseInt
(
data
.
length
*
data
.
fps
,
10
);
data
.
JIT
=
{};
data
.
JIT
.
hierarchy
=
[];
...
...
src/core/Matrix4.js
浏览文件 @
8a9b4ab4
...
...
@@ -72,9 +72,24 @@ THREE.Matrix4.prototype = {
var
x
=
THREE
.
Matrix4
.
__v1
,
y
=
THREE
.
Matrix4
.
__v2
,
z
=
THREE
.
Matrix4
.
__v3
;
z
.
sub
(
eye
,
center
).
normalize
();
if
(
z
.
length
()
===
0
)
{
z
.
z
=
1
;
}
x
.
cross
(
up
,
z
).
normalize
();
if
(
x
.
length
()
===
0
)
{
z
.
x
+=
0.0001
;
x
.
cross
(
up
,
z
).
normalize
();
}
y
.
cross
(
z
,
x
).
normalize
();
this
.
n11
=
x
.
x
;
this
.
n12
=
y
.
x
;
this
.
n13
=
z
.
x
;
this
.
n21
=
x
.
y
;
this
.
n22
=
y
.
y
;
this
.
n23
=
z
.
y
;
this
.
n31
=
x
.
z
;
this
.
n32
=
y
.
z
;
this
.
n33
=
z
.
z
;
...
...
@@ -604,8 +619,10 @@ THREE.Matrix4.makeInvert3x3 = function ( m1 ) {
idet
;
// no inverse
if
(
det
==
0
)
throw
"
matrix not invertible
"
;
if
(
det
==
0
)
{
throw
"
matrix not invertible
"
;
}
idet
=
1.0
/
det
;
m33m
[
0
]
=
idet
*
a11
;
m33m
[
1
]
=
idet
*
a21
;
m33m
[
2
]
=
idet
*
a31
;
...
...
src/objects/SkinnedMesh.js
浏览文件 @
8a9b4ab4
...
...
@@ -17,7 +17,6 @@ THREE.SkinnedMesh = function( geometry, materials ) {
// init bones
this
.
identityMatrix
=
new
THREE
.
Matrix4
();
this
.
bones
=
[];
this
.
boneMatrices
=
[];
...
...
@@ -38,6 +37,7 @@ THREE.SkinnedMesh = function( geometry, materials ) {
bone
.
name
=
gbone
.
name
;
bone
.
position
.
set
(
p
[
0
],
p
[
1
],
p
[
2
]
);
bone
.
quaternion
.
set
(
q
[
0
],
q
[
1
],
q
[
2
],
q
[
3
]
);
bone
.
useQuaternion
=
true
;
if
(
s
!==
undefined
)
{
...
...
@@ -139,6 +139,19 @@ THREE.SkinnedMesh.prototype.update = function ( parentMatrixWorld, forceUpdate,
}
// flatten to array
var
b
,
bl
=
this
.
bones
.
length
;
ba
=
this
.
bones
;
bm
=
this
.
boneMatrices
;
for
(
b
=
0
;
b
<
bl
;
b
++
)
{
ba
[
b
].
skinMatrix
.
flattenToArrayOffset
(
bm
,
b
*
16
);
}
}
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录