Axiom.Core.SubMesh.AddBoneAssignment C# (CSharp) Method

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 void AddBoneAssignment( VertexBoneAssignment boneAssignment )
		{
			if ( !boneAssignmentList.ContainsKey( boneAssignment.vertexIndex ) )
				boneAssignmentList[ boneAssignment.vertexIndex ] = new List<VertexBoneAssignment>();
			boneAssignmentList[ boneAssignment.vertexIndex ].Add( boneAssignment );
			boneAssignmentsOutOfDate = true;
		}

Usage Example

 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);
         }
     }
 }
All Usage Examples Of Axiom.Core.SubMesh::AddBoneAssignment