Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
b1f7a8af
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,发现更多精彩内容 >>
提交
b1f7a8af
编写于
5月 17, 2017
作者:
M
Mr.doob
提交者:
GitHub
5月 17, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11285 from Mugen87/mesh
Mesh .updateMorphTargets(): Added BufferGeometry support
上级
49fd9f60
f375cf24
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
83 addition
and
15 deletion
+83
-15
docs/api/core/BufferAttribute.html
docs/api/core/BufferAttribute.html
+4
-0
examples/js/loaders/MMDLoader.js
examples/js/loaders/MMDLoader.js
+1
-0
examples/js/loaders/sea3d/SEA3DLoader.js
examples/js/loaders/sea3d/SEA3DLoader.js
+1
-0
src/animation/PropertyBinding.js
src/animation/PropertyBinding.js
+33
-8
src/core/BufferAttribute.js
src/core/BufferAttribute.js
+1
-0
src/objects/Mesh.js
src/objects/Mesh.js
+43
-7
未找到文件。
docs/api/core/BufferAttribute.html
浏览文件 @
b1f7a8af
...
...
@@ -78,6 +78,10 @@
<h3>
[property:Integer itemSize]
</h3>
<div>
The length of vectors that are being stored in the [page:BufferAttribute.array array].
</div>
<h3>
[property:String name]
</h3>
<div>
Optional name for this attribute instance. Default is an empty string.
</div>
<h3>
[property:Boolean needsUpdate]
</h3>
<div>
...
...
examples/js/loaders/MMDLoader.js
浏览文件 @
b1f7a8af
...
...
@@ -786,6 +786,7 @@ THREE.MMDLoader.prototype.createMesh = function ( model, texturePath, onProgress
var
params
=
{
name
:
m
.
name
};
var
attribute
=
new
THREE
.
Float32BufferAttribute
(
model
.
metadata
.
vertexCount
*
3
,
3
);
attribute
.
name
=
m
.
name
;
for
(
var
j
=
0
;
j
<
model
.
metadata
.
vertexCount
*
3
;
j
++
)
{
...
...
examples/js/loaders/sea3d/SEA3DLoader.js
浏览文件 @
b1f7a8af
...
...
@@ -2876,6 +2876,7 @@ THREE.SEA3D.prototype.readMorpher = function ( sea ) {
var
node
=
sea
.
node
[
i
];
attribs
.
position
[
i
]
=
new
THREE
.
Float32BufferAttribute
(
node
.
vertex
,
3
);
attribs
.
position
[
i
].
name
=
node
.
name
;
if
(
node
.
normal
)
{
...
...
src/animation/PropertyBinding.js
浏览文件 @
b1f7a8af
...
...
@@ -616,19 +616,44 @@ Object.assign( PropertyBinding.prototype, { // prototype, continued
}
if
(
!
targetObject
.
geometry
.
morphTargets
)
{
if
(
targetObject
.
geometry
.
isBufferGeometry
)
{
console
.
error
(
'
can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets
'
,
this
);
return
;
if
(
!
targetObject
.
geometry
.
morphAttributes
)
{
}
console
.
error
(
'
can not bind to morphTargetInfluences becasuse node does not have a geometry.morphAttributes
'
,
this
);
return
;
}
for
(
var
i
=
0
;
i
<
this
.
node
.
geometry
.
morphAttributes
.
position
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
this
.
node
.
geometry
.
morphTargets
.
length
;
i
++
)
{
if
(
targetObject
.
geometry
.
morphAttributes
.
position
[
i
].
name
===
propertyIndex
)
{
propertyIndex
=
i
;
break
;
}
}
if
(
targetObject
.
geometry
.
morphTargets
[
i
].
name
===
propertyIndex
)
{
propertyIndex
=
i
;
break
;
}
else
{
if
(
!
targetObject
.
geometry
.
morphTargets
)
{
console
.
error
(
'
can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets
'
,
this
);
return
;
}
for
(
var
i
=
0
;
i
<
this
.
node
.
geometry
.
morphTargets
.
length
;
i
++
)
{
if
(
targetObject
.
geometry
.
morphTargets
[
i
].
name
===
propertyIndex
)
{
propertyIndex
=
i
;
break
;
}
}
...
...
src/core/BufferAttribute.js
浏览文件 @
b1f7a8af
...
...
@@ -17,6 +17,7 @@ function BufferAttribute( array, itemSize, normalized ) {
}
this
.
uuid
=
_Math
.
generateUUID
();
this
.
name
=
''
;
this
.
array
=
array
;
this
.
itemSize
=
itemSize
;
...
...
src/objects/Mesh.js
浏览文件 @
b1f7a8af
...
...
@@ -56,17 +56,53 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
updateMorphTargets
:
function
()
{
var
morphTargets
=
this
.
geometry
.
morphTargets
;
var
geometry
=
this
.
geometry
;
var
m
,
ml
,
name
;
if
(
morphTargets
!==
undefined
&&
morphTargets
.
length
>
0
)
{
if
(
geometry
.
isBufferGeometry
)
{
this
.
morphTargetInfluences
=
[]
;
this
.
morphTargetDictionary
=
{}
;
var
morphAttributes
=
geometry
.
morphAttributes
;
var
keys
=
Object
.
keys
(
morphAttributes
)
;
for
(
var
m
=
0
,
ml
=
morphTargets
.
length
;
m
<
ml
;
m
++
)
{
if
(
keys
.
length
>
0
)
{
this
.
morphTargetInfluences
.
push
(
0
);
this
.
morphTargetDictionary
[
morphTargets
[
m
].
name
]
=
m
;
var
morphAttribute
=
morphAttributes
[
keys
[
0
]
];
if
(
morphAttribute
!==
undefined
)
{
this
.
morphTargetInfluences
=
[];
this
.
morphTargetDictionary
=
{};
for
(
m
=
0
,
ml
=
morphAttribute
.
length
;
m
<
ml
;
m
++
)
{
name
=
morphAttribute
[
m
].
name
||
String
(
m
);
this
.
morphTargetInfluences
.
push
(
0
);
this
.
morphTargetDictionary
[
name
]
=
m
;
}
}
}
}
else
{
var
morphTargets
=
geometry
.
morphTargets
;
if
(
morphTargets
!==
undefined
&&
morphTargets
.
length
>
0
)
{
this
.
morphTargetInfluences
=
[];
this
.
morphTargetDictionary
=
{};
for
(
m
=
0
,
ml
=
morphTargets
.
length
;
m
<
ml
;
m
++
)
{
name
=
morphTargets
[
m
].
name
||
String
(
m
);
this
.
morphTargetInfluences
.
push
(
0
);
this
.
morphTargetDictionary
[
name
]
=
m
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录