我正在尝试执行此操作,但是似乎没有任何内容分配给BoneIDs
或BoneWeights
,在C#中执行此操作的正确方法是什么?
public unsafe struct VertexBoneData
{
public Vector3 Position;
public Vector3 Normal;
public Vector2 TexCoord;
public fixed float BoneIDs[Bone.MaxBoneCount];
public fixed float BoneWeights[Bone.MaxBoneCount];
public float GetBoneID(int i)
{
return BoneIDs[i];
}
public void SetBoneID(int i, float value)
{
BoneIDs[i] = value;
}
public float GetBoneWeight(int i)
{
return BoneWeights[i];
}
public void SetBoneWeight(int i, float value)
{
BoneWeights[i] = value;
}
}
使用法警技术
const int MaxBoneCount = 10;
public struct VertexBoneData
{
public Vector3 Position;
public Vector3 Normal;
public Vector2 TexCoord;
[MarshalAs(UnmanagedType.I4, SizeConst = MaxBoneCount)]
public float BoneIDs[];
[MarshalAs(UnmanagedType.I4, SizeConst = MaxBoneCount)]
public float BoneWeights[];
}