Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
243e853a
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,发现更多精彩内容 >>
提交
243e853a
编写于
4月 29, 2018
作者:
T
Takahiro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove MMD KeyframeTrackEx
上级
4aa7ac81
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
31 addition
and
95 deletion
+31
-95
examples/js/loaders/MMDLoader.js
examples/js/loaders/MMDLoader.js
+31
-95
未找到文件。
examples/js/loaders/MMDLoader.js
浏览文件 @
243e853a
...
...
@@ -354,7 +354,15 @@ THREE.MMDLoader.prototype.pourVmdIntoCamera = function ( camera, vmd, name ) {
}
return
new
THREE
.
MMDLoader
[
type
](
node
,
times
,
values
,
interpolations
);
var
track
=
new
THREE
[
type
](
node
,
times
,
values
);
track
.
createInterpolant
=
function
InterpolantFactoryMethodCubicBezier
(
result
)
{
return
new
THREE
.
MMDLoader
.
CubicBezierInterpolation
(
this
.
times
,
this
.
values
,
this
.
getValueSize
(),
result
,
new
Float32Array
(
interpolations
)
);
};
return
track
;
};
...
...
@@ -378,16 +386,6 @@ THREE.MMDLoader.prototype.pourVmdIntoCamera = function ( camera, vmd, name ) {
position
.
add
(
center
);
position
.
applyQuaternion
(
quaternion
);
/*
* Note: This is a workaround not to make Animation system calculate lerp
* if the diff from the last frame is 1 frame (in 30fps).
*/
if
(
times
.
length
>
0
&&
time
<
times
[
times
.
length
-
1
]
+
(
1
/
30
)
*
1.5
)
{
times
[
times
.
length
-
1
]
=
time
-
1
e
-
13
;
}
times
.
push
(
time
);
pushVector3
(
centers
,
center
);
...
...
@@ -419,10 +417,10 @@ THREE.MMDLoader.prototype.pourVmdIntoCamera = function ( camera, vmd, name ) {
var
tracks
=
[];
tracks
.
push
(
createTrack
(
'
.center
'
,
'
VectorKeyframeTrack
Ex
'
,
times
,
centers
,
cInterpolations
)
);
tracks
.
push
(
createTrack
(
'
.quaternion
'
,
'
QuaternionKeyframeTrack
Ex
'
,
times
,
quaternions
,
qInterpolations
)
);
tracks
.
push
(
createTrack
(
'
.position
'
,
'
VectorKeyframeTrack
Ex
'
,
times
,
positions
,
pInterpolations
)
);
tracks
.
push
(
createTrack
(
'
.fov
'
,
'
NumberKeyframeTrack
Ex
'
,
times
,
fovs
,
fInterpolations
)
);
tracks
.
push
(
createTrack
(
'
.center
'
,
'
VectorKeyframeTrack
'
,
times
,
centers
,
cInterpolations
)
);
tracks
.
push
(
createTrack
(
'
.quaternion
'
,
'
QuaternionKeyframeTrack
'
,
times
,
quaternions
,
qInterpolations
)
);
tracks
.
push
(
createTrack
(
'
.position
'
,
'
VectorKeyframeTrack
'
,
times
,
positions
,
pInterpolations
)
);
tracks
.
push
(
createTrack
(
'
.fov
'
,
'
NumberKeyframeTrack
'
,
times
,
fovs
,
fInterpolations
)
);
var
clip
=
new
THREE
.
AnimationClip
(
name
===
undefined
?
THREE
.
Math
.
generateUUID
()
:
name
,
-
1
,
tracks
);
...
...
@@ -1528,6 +1526,20 @@ THREE.MMDLoader.prototype.createAnimation = function ( mesh, vmd, name ) {
};
var
createTrack
=
function
(
node
,
type
,
times
,
values
,
interpolations
)
{
var
track
=
new
THREE
[
type
](
node
,
times
,
values
);
track
.
createInterpolant
=
function
InterpolantFactoryMethodCubicBezier
(
result
)
{
return
new
THREE
.
MMDLoader
.
CubicBezierInterpolation
(
this
.
times
,
this
.
values
,
this
.
getValueSize
(),
result
,
new
Float32Array
(
interpolations
)
);
};
return
track
;
};
for
(
var
i
=
0
;
i
<
orderedMotions
.
length
;
i
++
)
{
var
times
=
[];
...
...
@@ -1574,8 +1586,8 @@ THREE.MMDLoader.prototype.createAnimation = function ( mesh, vmd, name ) {
var
boneName
=
'
.bones[
'
+
bone
.
name
+
'
]
'
;
tracks
.
push
(
new
THREE
.
MMDLoader
.
VectorKeyframeTrackEx
(
boneName
+
'
.position
'
,
times
,
positions
,
pInterpolations
)
);
tracks
.
push
(
new
THREE
.
MMDLoader
.
QuaternionKeyframeTrackEx
(
boneName
+
'
.quaternion
'
,
times
,
rotations
,
rInterpolations
)
);
tracks
.
push
(
createTrack
(
boneName
+
'
.position
'
,
'
VectorKeyframeTrack
'
,
times
,
positions
,
pInterpolations
)
);
tracks
.
push
(
createTrack
(
boneName
+
'
.quaternion
'
,
'
QuaternionKeyframeTrack
'
,
times
,
rotations
,
rInterpolations
)
);
}
...
...
@@ -1759,83 +1771,6 @@ THREE.MMDLoader.DataCreationHelper.prototype = {
};
/*
* extends existing KeyframeTrack for bone and camera animation.
* - use Float64Array for times
* - use Cubic Bezier curves interpolation
*/
THREE
.
MMDLoader
.
VectorKeyframeTrackEx
=
function
(
name
,
times
,
values
,
interpolationParameterArray
)
{
this
.
interpolationParameters
=
new
Float32Array
(
interpolationParameterArray
);
THREE
.
VectorKeyframeTrack
.
call
(
this
,
name
,
times
,
values
);
};
THREE
.
MMDLoader
.
VectorKeyframeTrackEx
.
prototype
=
Object
.
create
(
THREE
.
VectorKeyframeTrack
.
prototype
);
THREE
.
MMDLoader
.
VectorKeyframeTrackEx
.
prototype
.
constructor
=
THREE
.
MMDLoader
.
VectorKeyframeTrackEx
;
THREE
.
MMDLoader
.
VectorKeyframeTrackEx
.
prototype
.
TimeBufferType
=
Float64Array
;
THREE
.
MMDLoader
.
VectorKeyframeTrackEx
.
prototype
.
InterpolantFactoryMethodCubicBezier
=
function
(
result
)
{
return
new
THREE
.
MMDLoader
.
CubicBezierInterpolation
(
this
.
times
,
this
.
values
,
this
.
getValueSize
(),
result
,
this
.
interpolationParameters
);
};
THREE
.
MMDLoader
.
VectorKeyframeTrackEx
.
prototype
.
setInterpolation
=
function
(
interpolation
)
{
this
.
createInterpolant
=
this
.
InterpolantFactoryMethodCubicBezier
;
};
THREE
.
MMDLoader
.
QuaternionKeyframeTrackEx
=
function
(
name
,
times
,
values
,
interpolationParameterArray
)
{
this
.
interpolationParameters
=
new
Float32Array
(
interpolationParameterArray
);
THREE
.
QuaternionKeyframeTrack
.
call
(
this
,
name
,
times
,
values
);
};
THREE
.
MMDLoader
.
QuaternionKeyframeTrackEx
.
prototype
=
Object
.
create
(
THREE
.
QuaternionKeyframeTrack
.
prototype
);
THREE
.
MMDLoader
.
QuaternionKeyframeTrackEx
.
prototype
.
constructor
=
THREE
.
MMDLoader
.
QuaternionKeyframeTrackEx
;
THREE
.
MMDLoader
.
QuaternionKeyframeTrackEx
.
prototype
.
TimeBufferType
=
Float64Array
;
THREE
.
MMDLoader
.
QuaternionKeyframeTrackEx
.
prototype
.
InterpolantFactoryMethodCubicBezier
=
function
(
result
)
{
return
new
THREE
.
MMDLoader
.
CubicBezierInterpolation
(
this
.
times
,
this
.
values
,
this
.
getValueSize
(),
result
,
this
.
interpolationParameters
);
};
THREE
.
MMDLoader
.
QuaternionKeyframeTrackEx
.
prototype
.
setInterpolation
=
function
(
interpolation
)
{
this
.
createInterpolant
=
this
.
InterpolantFactoryMethodCubicBezier
;
};
THREE
.
MMDLoader
.
NumberKeyframeTrackEx
=
function
(
name
,
times
,
values
,
interpolationParameterArray
)
{
this
.
interpolationParameters
=
new
Float32Array
(
interpolationParameterArray
);
THREE
.
NumberKeyframeTrack
.
call
(
this
,
name
,
times
,
values
);
};
THREE
.
MMDLoader
.
NumberKeyframeTrackEx
.
prototype
=
Object
.
create
(
THREE
.
NumberKeyframeTrack
.
prototype
);
THREE
.
MMDLoader
.
NumberKeyframeTrackEx
.
prototype
.
constructor
=
THREE
.
MMDLoader
.
NumberKeyframeTrackEx
;
THREE
.
MMDLoader
.
NumberKeyframeTrackEx
.
prototype
.
TimeBufferType
=
Float64Array
;
THREE
.
MMDLoader
.
NumberKeyframeTrackEx
.
prototype
.
InterpolantFactoryMethodCubicBezier
=
function
(
result
)
{
return
new
THREE
.
MMDLoader
.
CubicBezierInterpolation
(
this
.
times
,
this
.
values
,
this
.
getValueSize
(),
result
,
this
.
interpolationParameters
);
};
THREE
.
MMDLoader
.
NumberKeyframeTrackEx
.
prototype
.
setInterpolation
=
function
(
interpolation
)
{
this
.
createInterpolant
=
this
.
InterpolantFactoryMethodCubicBezier
;
};
THREE
.
MMDLoader
.
CubicBezierInterpolation
=
function
(
parameterPositions
,
sampleValues
,
sampleSize
,
resultBuffer
,
params
)
{
THREE
.
Interpolant
.
call
(
this
,
parameterPositions
,
sampleValues
,
sampleSize
,
resultBuffer
);
...
...
@@ -1856,7 +1791,8 @@ THREE.MMDLoader.CubicBezierInterpolation.prototype.interpolate_ = function ( i1,
var
offset1
=
i1
*
stride
;
var
offset0
=
offset1
-
stride
;
var
weight1
=
(
t
-
t0
)
/
(
t1
-
t0
);
// No interpolation if next key frame is in one frame in 30fps. This is from MMD animation spec.
var
weight1
=
(
(
t1
-
t0
)
<
1
/
30
*
1.5
)
?
0.0
:
(
t
-
t0
)
/
(
t1
-
t0
);
if
(
stride
===
4
)
{
// Quaternion
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录