AddBoneAssignment() public method

Assigns a vertex to a bone with a given weight, for skeletal animation.
This method is only valid after setting the SkeletonName property. You should not need to modify bone assignments during rendering (only the positions of bones) and the engine reserves the right to do some internal data reformatting of this information, depending on render system requirements.
public AddBoneAssignment ( VertexBoneAssignment boneAssignment ) : void
boneAssignment VertexBoneAssignment
return void
 public static void CopyBoneAssignments(SubMesh dst, SubMesh src, Dictionary<uint, uint> vertexIdMap)
 {
     foreach (KeyValuePair<uint, uint> vertexMapping in vertexIdMap) {
         if (!src.BoneAssignmentList.ContainsKey((int)vertexMapping.Key))
             continue;
         List<VertexBoneAssignment> srcVbaList = src.BoneAssignmentList[(int)vertexMapping.Key];
         foreach (VertexBoneAssignment srcVba in srcVbaList) {
             Debug.Assert(srcVba.vertexIndex == (int)vertexMapping.Key);
             VertexBoneAssignment dstVba = new VertexBoneAssignment();
             dstVba.boneIndex = srcVba.boneIndex;
             dstVba.vertexIndex = (int)vertexMapping.Value;
             dstVba.weight = srcVba.weight;
             dst.AddBoneAssignment(dstVba);
         }
     }
 }
Exemplo n.º 2
0
		protected virtual void ReadSubMeshBoneAssignment( BinaryReader reader, SubMesh sub )
		{
			var assignment = new VertexBoneAssignment();

			// read the data from the file
			assignment.vertexIndex = ReadInt( reader );
			assignment.boneIndex = ReadUShort( reader );
			assignment.weight = ReadFloat( reader );

			// add the assignment to the mesh
			sub.AddBoneAssignment( assignment );
		}
        protected void ReadVertexBoneAssigment(XmlNode node, SubMesh subMesh)
        {
            VertexBoneAssignment assignment = new VertexBoneAssignment();

            // read the data from the file
            assignment.vertexIndex = int.Parse(node.Attributes["vertexindex"].Value);
            assignment.boneIndex = ushort.Parse(node.Attributes["boneindex"].Value); ;
            assignment.weight = float.Parse(node.Attributes["weight"].Value); ;

            // add the assignment to the mesh
            subMesh.AddBoneAssignment(assignment);
        }