public void AddSkeletalMeshVertexData(H1SkeletalMeshVertexDataInterface newVertexData)
 {
     m_VertexDataList.Add(newVertexData);
 }
        public Boolean GenerateSkeleltalMeshObjectGpuSkin()
        {
            // allocate new instance of SkeletalMeshGpuSkin
            m_SkeletalMeshObject = new H1SkeletalMeshObjectGPUSkin(m_SkeletalMesh.SkeletalMeshResource);
            H1SkeletalMeshObjectGPUSkin refSkeletalMeshObject = m_SkeletalMeshObject as H1SkeletalMeshObjectGPUSkin;

            // process soft vertices for each chunk to separate vertex buffers
            // @TODO - handle LOD variation
            List <H1SkelMeshChunk> skelChunks = SkeletalMesh.SkeletalMeshResource.GetLODModel(0).Chunks;

            // @TODO - temporary add LOD_0
            H1SkeletalMeshObjectGPUSkin.H1SkeletalMeshObjectLOD skeletalMeshObjectLOD_0 = refSkeletalMeshObject.AddSkeletalMeshObjectLOD();

            Int32 skelChunkIndex = 0;

            foreach (H1SkelMeshChunk skelChunk in skelChunks)
            {
                H1SkeletalMeshVertexBuffers skeletalMeshVBsRef = skeletalMeshObjectLOD_0.SkelMeshResourceRef.GetLODModel(0).VertexBufferGPUSkin.SkeletalMeshVertexBuffers[skelChunkIndex];

                // add GPUSkinFactory
                skeletalMeshObjectLOD_0.GPUSkinVertexFactories.VertexFactories.Add(new H1GpuSkinVertexFactory());
                H1GpuSkinVertexFactory newGpuSkinVertexFactoryRef = skeletalMeshObjectLOD_0.GPUSkinVertexFactories.VertexFactories.Last();

                // offset tracking
                Int32 currOffset = 0;

                Int32 skelMeshVBsCount = skeletalMeshVBsRef.GetSkeletalMeshVertexDataCount();
                for (Int32 skelMeshVBIndex = 0; skelMeshVBIndex < skelMeshVBsCount; ++skelMeshVBIndex)
                {
                    H1SkeletalMeshVertexDataInterface skeletalMeshVertexData = skeletalMeshVBsRef.GetSkeletalMeshVertexData(skelMeshVBIndex);
                    switch (skeletalMeshVertexData.DataType)
                    {
                    case H1SkeletalMeshVertexDataInterface.VertexDataType.Position:
                    {
                        H1SkeletalMeshVertexData <Vector4> positionVertexData = skeletalMeshVertexData as H1SkeletalMeshVertexData <Vector4>;
                        newGpuSkinVertexFactoryRef.ShaderData.PositionBuffer = H1VertexBuffer.ProcessVertexBuffer(positionVertexData.VertexBuffer);
                        newGpuSkinVertexFactoryRef.PositionStreamComponent   = new H1VertexStreamComponent(H1VertexStreamSematicType.Position, H1VertexElementType.Float4, currOffset++);
                        break;
                    }

                    case H1SkeletalMeshVertexDataInterface.VertexDataType.TangentZ:
                    {
                        H1SkeletalMeshVertexData <Vector4> tangentZVertexData = skeletalMeshVertexData as H1SkeletalMeshVertexData <Vector4>;
                        newGpuSkinVertexFactoryRef.ShaderData.TangentZBuffer = H1VertexBuffer.ProcessVertexBuffer(tangentZVertexData.VertexBuffer);
                        newGpuSkinVertexFactoryRef.TangentZStreamComponent   = new H1VertexStreamComponent(H1VertexStreamSematicType.TangentZ, H1VertexElementType.Float4, currOffset++);
                        break;
                    }

                    case H1SkeletalMeshVertexDataInterface.VertexDataType.TangentX:
                    {
                        H1SkeletalMeshVertexData <Vector4> tangentXVertexData = skeletalMeshVertexData as H1SkeletalMeshVertexData <Vector4>;
                        newGpuSkinVertexFactoryRef.ShaderData.TangentXBuffer = H1VertexBuffer.ProcessVertexBuffer(tangentXVertexData.VertexBuffer);
                        newGpuSkinVertexFactoryRef.TangentXStreamComponent   = new H1VertexStreamComponent(H1VertexStreamSematicType.TangentX, H1VertexElementType.Float4, currOffset++);
                        break;
                    }

                    case H1SkeletalMeshVertexDataInterface.VertexDataType.InfluencedBones:
                    {
                        H1SkeletalMeshVertexData <Int4> boneIndicesVertexData = skeletalMeshVertexData as H1SkeletalMeshVertexData <Int4>;
                        newGpuSkinVertexFactoryRef.ShaderData.BoneIndices     = H1VertexBuffer.ProcessVertexBuffer(boneIndicesVertexData.VertexBuffer);
                        newGpuSkinVertexFactoryRef.BoneIndicesStreamComponent = new H1VertexStreamComponent(H1VertexStreamSematicType.BoneIndices, H1VertexElementType.Int4, currOffset++);
                        break;
                    }

                    case H1SkeletalMeshVertexDataInterface.VertexDataType.InfluencedWeights:
                    {
                        H1SkeletalMeshVertexData <Vector4> blendWeightsVertexData = skeletalMeshVertexData as H1SkeletalMeshVertexData <Vector4>;
                        newGpuSkinVertexFactoryRef.ShaderData.BoneWeights     = H1VertexBuffer.ProcessVertexBuffer(blendWeightsVertexData.VertexBuffer);
                        newGpuSkinVertexFactoryRef.BoneWeightsStreamComponent = new H1VertexStreamComponent(H1VertexStreamSematicType.BoneWeights, H1VertexElementType.Float4, currOffset++);
                        break;
                    }

                    // @TODO - support multiple texcoords
                    case H1SkeletalMeshVertexDataInterface.VertexDataType.Texcoord:
                    {
                        H1SkeletalMeshVertexData <Vector2> texcoordVertexData = skeletalMeshVertexData as H1SkeletalMeshVertexData <Vector2>;
                        newGpuSkinVertexFactoryRef.ShaderData.TexcoordBuffers.Add(H1VertexBuffer.ProcessVertexBuffer(texcoordVertexData.VertexBuffer));
                        newGpuSkinVertexFactoryRef.TexcoordStreamComponents.Add(new H1VertexStreamComponent(H1VertexStreamSematicType.Texcoord, H1VertexElementType.Float2, currOffset++));
                        break;
                    }

                    case H1SkeletalMeshVertexDataInterface.VertexDataType.Color:
                    {
                        H1SkeletalMeshVertexData <Vector4> colorVertexData = skeletalMeshVertexData as H1SkeletalMeshVertexData <Vector4>;
                        newGpuSkinVertexFactoryRef.ShaderData.ColorBuffer = H1VertexBuffer.ProcessVertexBuffer(colorVertexData.VertexBuffer);
                        newGpuSkinVertexFactoryRef.ColorStreamComponent   = new H1VertexStreamComponent(H1VertexStreamSematicType.Color, H1VertexElementType.Float4, currOffset++);
                        break;
                    }
                    }
                }

                // generate RHIVertexFormat Declaration
                newGpuSkinVertexFactoryRef.GenerateVertexDeclaration();

                skelChunkIndex++;
            }

            // add index buffer (containing multiple skeletal mesh chunks's indices)
            List <UInt32> indices    = SkeletalMesh.SkeletalMeshResource.GetLODModel(0).MultiSizeIndexContainer.Indices;
            UInt32        bufferSize = Convert.ToUInt32(Utilities.SizeOf <UInt32>() * indices.Count);

            skeletalMeshObjectLOD_0.IndexBuffer = H1Global <H1ManagedRenderer> .Instance.CreateIndexBuffer(bufferSize);

            // write indices data
            skeletalMeshObjectLOD_0.IndexBuffer.WriteData(indices.ToArray());

            return(true);
        }