Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

Using Int4 in vertex data?

$
0
0

@AcidFaucent wrote:

I have a custom vertex format that requires int4 for bone indices, however there's no VertexElementFormat.IntVector4 or anything of the like. What's the appropriate way to get an int4 through?

I haven't gotten around to using it yet but I assume that if a marshal blit is used for the vertex data then the element format description will be mostly irrelevant.

public struct FinalVertex : IVertexType
{
    public Vector3 Position;
    public Vector3 Normal;
    public Vector4 Tangent; //W contains handedness
    public Vector2 TextureCoordinate;
    public Vector4 BoneWeights;
    public IntVector4 BoneIndices; //>>struct IntVector4 { int x, y, z, w; }
}

VertexElement[] elements = new VertexElement[] {
    new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),                  // 12 bytes
    new VertexElement(12, VertexElementFormat.Vector3, VertexElementUsage.Normal, 0),                   // 12 bytes
    new VertexElement(24, VertexElementFormat.Vector4, VertexElementUsage.Tangent, 0),                  // 16 bytes, handed tangent
    new VertexElement(40, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0),        // 8 bytes
    new VertexElement(48, VertexElementFormat.Vector4, VertexElementUsage.BlendWeight, 0),              // 16 bytes
    new VertexElement(64, VertexElementFormat.Vector4, VertexElementUsage.BlendIndices, 0)              // 16 bytes, >>assuming it's just a blit
};`

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles