Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
ef729e0e
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,发现更多精彩内容 >>
提交
ef729e0e
编写于
6月 16, 2015
作者:
G
Greg Tatum
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Finalized SkinnedMesh docs
上级
949f971e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
61 addition
and
33 deletion
+61
-33
docs/api/core/Geometry.html
docs/api/core/Geometry.html
+2
-1
docs/api/objects/SkinnedMesh.html
docs/api/objects/SkinnedMesh.html
+42
-11
docs/scenes/bones-browser.html
docs/scenes/bones-browser.html
+17
-21
未找到文件。
docs/api/core/Geometry.html
浏览文件 @
ef729e0e
...
...
@@ -113,11 +113,12 @@
Array of [page:Vector4 Vector4s] representing the indices of individual bones in the [page:Skeleton.bones] array,
The indices match the number and order of vertices in the geometry.
<code>
// e.g.
geometry.skinIndices[15] = new THREE.Vector4( 0, 5, 9, 0 );
geometry.skinWeights[15] = new THREE.Vector4( 0.2, 0.5, 0.3, 0 );
// corresponds with the following vertex
geometry.vertices[15]
geometry.vertices[15]
;
// these bones will be used like so:
skeleton.bones[0]; // weight of 0.2
...
...
docs/api/objects/SkinnedMesh.html
浏览文件 @
ef729e0e
...
...
@@ -34,19 +34,20 @@
}
var
mesh =
THREE.SkinnedMesh(
geometry
,
material
);
//
See
example
from
THREE.Skeleton
for
the
armSkeleton
var
rootBone =
armSkeleton.bones[0];
mesh.add
(
rootBone
);
//
Bind
the
skeleton
to
the
mesh
mesh.bind
(
armSkeleton
);
//
Add
the
root
bone
,
then
recalculate
the
skeleton
inverses
mesh.add
(
armSkeleton.bones
[0]
);
mesh.updateMatrixWorld
(
true
);
//
ensure
the
bones
matrices
are
already
recomputed
//
Update
the
inverse
matrices
in
the
skeleton
to
reflect
the
newly
bound
skeleton
skeleton.calculateInverses
();
//
Move
the
bones
and
manipulate
the
model
armSkeleton.bones[0].rotation.x =
-0.1;
armSkeleton.bones[1].rotation.x =
0.2;
</
code
>
...
...
@@ -55,8 +56,8 @@
<h3>
[name]([page:Geometry geometry], [page:Material material], [page:boolean useVertexTexture])
</h3>
<div>
geometry —
-
An instance of [page:Geometry]. [page:Geometry.skinIndices] and [page:Geometry.skinWeights] should be set.
<br
/>
material —
-
An instance of [page:Material] (optional).
<br
/>
geometry — An instance of [page:Geometry]. [page:Geometry.skinIndices] and [page:Geometry.skinWeights] should be set.
<br
/>
material — An instance of [page:Material] (optional).
<br
/>
useVertexTexture -- Defines whether a vertex texture can be used (optional).
</div>
...
...
@@ -64,7 +65,6 @@
<h2>
Properties
</h2>
<h3>
[property:array bones]
</h3>
<div>
This contains the array of bones for this mesh. These should be set in the constructor.
...
...
@@ -85,19 +85,50 @@
This array of matrices contains the matrices of the bones. These get calculated in the constructor.
</div>
<h3>
[property:string bindMode]
</h3>
<div>
Either "attached" or "detached". "attached" uses the [page:SkinnedMesh.matrixWorld] property for the base transform
matrix of the bones. "detached" uses the [page:SkinnedMesh.bindMatrix].
</div>
<h3>
[property:Matrix4 bindMatrix]
</h3>
<div>
The base matrix that is used for the bound bone transforms.
</div>
<h3>
[property:Matrix4 inverseBindMatrix]
</h3>
<div>
The inverse of the bindMatrix.
</div>
<h2>
Methods
</h2>
<h3>
[method:null bind]([page:Skeleton skeleton], [page:Matrix4 bindMatrix])
</h3>
<div>
skeleton — [page:Skeleton]
<br/>
bindMatrix — [page:Matrix4] that represents the base transform of the skeleton
</div>
<div>
Bind a skeleton to the skinned mesh. The bindMatrix gets saved to .bindMatrix property and the .bindMatrixInverse
gets calculated.
</div>
<h3>
[method:null normalizeSkinWeights]()
</h3>
<div>
Normalizes the [page:Geometry.skinWeights] vectors. Does not affect [page:BufferGeometry].
</div>
<h3>
[method:null pose]()
</h3>
<div>
This method sets the skinnedmesh in the rest pose.
This method sets the skinned
mesh in the rest pose.
</div>
<h3>
[method:Bone addBone]([page:Bone bone])
</h3>
<div>
bone
--
This is the bone that needs to be added. (optional)
bone
—
This is the bone that needs to be added. (optional)
</div>
<div>
This method adds the bone to the skinnedmesh when it is provided. It creates a new bone and adds that when no bone is given.
This method adds the bone to the skinned
mesh when it is provided. It creates a new bone and adds that when no bone is given.
</div>
<h2>
Source
</h2>
...
...
docs/scenes/bones-browser.html
浏览文件 @
ef729e0e
...
...
@@ -148,17 +148,12 @@
shading
:
THREE
.
FlatShading
});
var
mesh
=
new
THREE
.
SkinnedMesh
(
geometry
,
material
);
var
mesh
=
new
THREE
.
SkinnedMesh
(
geometry
,
material
);
var
skeleton
=
new
THREE
.
Skeleton
(
bones
);
mesh
.
bind
(
skeleton
);
mesh
.
add
(
bones
[
0
]
);
mesh
.
updateMatrixWorld
(
true
);
mesh
.
bind
(
skeleton
);
skeleton
.
calculateInverses
();
skeletonHelper
=
new
THREE
.
SkeletonHelper
(
mesh
);
...
...
@@ -166,6 +161,7 @@
scene
.
add
(
skeletonHelper
);
return
mesh
;
};
function
setupDatGui
()
{
...
...
@@ -173,7 +169,7 @@
var
folder
=
gui
.
addFolder
(
"
General Options
"
);
folder
.
add
(
state
,
"
animateBones
"
);
folder
.
__controllers
[
0
].
name
(
"
Animate Bones
"
)
folder
.
__controllers
[
0
].
name
(
"
Animate Bones
"
)
;
folder
.
add
(
mesh
,
"
pose
"
);
folder
.
__controllers
[
1
].
name
(
"
.pose()
"
);
...
...
@@ -182,7 +178,7 @@
for
(
var
i
=
0
;
i
<
bones
.
length
;
i
++
)
{
var
bone
=
bones
[
i
]
var
bone
=
bones
[
i
]
;
folder
=
gui
.
addFolder
(
"
Bone
"
+
i
);
...
...
@@ -198,17 +194,17 @@
folder
.
add
(
bone
.
scale
,
'
y
'
,
0
,
2
);
folder
.
add
(
bone
.
scale
,
'
z
'
,
0
,
2
);
folder
.
__controllers
[
0
].
name
(
"
position.x
"
)
folder
.
__controllers
[
1
].
name
(
"
position.y
"
)
folder
.
__controllers
[
2
].
name
(
"
position.z
"
)
folder
.
__controllers
[
0
].
name
(
"
position.x
"
)
;
folder
.
__controllers
[
1
].
name
(
"
position.y
"
)
;
folder
.
__controllers
[
2
].
name
(
"
position.z
"
)
;
folder
.
__controllers
[
3
].
name
(
"
rotation.x
"
)
folder
.
__controllers
[
4
].
name
(
"
rotation.y
"
)
folder
.
__controllers
[
5
].
name
(
"
rotation.z
"
)
folder
.
__controllers
[
3
].
name
(
"
rotation.x
"
)
;
folder
.
__controllers
[
4
].
name
(
"
rotation.y
"
)
;
folder
.
__controllers
[
5
].
name
(
"
rotation.z
"
)
;
folder
.
__controllers
[
6
].
name
(
"
scale.x
"
)
folder
.
__controllers
[
7
].
name
(
"
scale.y
"
)
folder
.
__controllers
[
8
].
name
(
"
scale.z
"
)
folder
.
__controllers
[
6
].
name
(
"
scale.x
"
)
;
folder
.
__controllers
[
7
].
name
(
"
scale.y
"
)
;
folder
.
__controllers
[
8
].
name
(
"
scale.z
"
)
;
}
...
...
@@ -218,8 +214,8 @@
var
segmentHeight
=
8
;
var
segmentCount
=
4
;
var
height
=
segmentHeight
*
segmentCount
var
halfHeight
=
height
*
0.5
var
height
=
segmentHeight
*
segmentCount
;
var
halfHeight
=
height
*
0.5
;
var
sizing
=
{
segmentHeight
:
segmentHeight
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录