Add support for signed and unsigned integer vertex attributes.
This commit is contained in:
@@ -45,9 +45,9 @@ namespace OpenRA.Graphics
|
||||
|
||||
public override ShaderVertexAttribute[] Attributes { get; } = new[]
|
||||
{
|
||||
new ShaderVertexAttribute("aVertexPosition", 3, 0),
|
||||
new ShaderVertexAttribute("aVertexTexCoord", 4, 12),
|
||||
new ShaderVertexAttribute("aVertexTexMetadata", 2, 28),
|
||||
new ShaderVertexAttribute("aVertexPosition", ShaderVertexAttributeType.Float, 3, 0),
|
||||
new ShaderVertexAttribute("aVertexTexCoord", ShaderVertexAttributeType.Float, 4, 12),
|
||||
new ShaderVertexAttribute("aVertexTexMetadata", ShaderVertexAttributeType.Float, 2, 28),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace OpenRA.Graphics
|
||||
|
||||
public override ShaderVertexAttribute[] Attributes { get; } = new[]
|
||||
{
|
||||
new ShaderVertexAttribute("aVertexPosition", 2, 0)
|
||||
new ShaderVertexAttribute("aVertexPosition", ShaderVertexAttributeType.Float, 2, 0)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,15 +14,26 @@ using System.Linq;
|
||||
|
||||
namespace OpenRA.Graphics
|
||||
{
|
||||
public enum ShaderVertexAttributeType
|
||||
{
|
||||
// Assign the underlying OpenGL type values
|
||||
// to simplify enum use in the shader
|
||||
Float = 0x1406, // GL_FLOAT
|
||||
Int = 0x1404, // GL_INT
|
||||
UInt = 0x1405 // GL_UNSIGNED_INT
|
||||
}
|
||||
|
||||
public readonly struct ShaderVertexAttribute
|
||||
{
|
||||
public readonly string Name;
|
||||
public readonly ShaderVertexAttributeType Type;
|
||||
public readonly int Components;
|
||||
public readonly int Offset;
|
||||
|
||||
public ShaderVertexAttribute(string name, int components, int offset)
|
||||
public ShaderVertexAttribute(string name, ShaderVertexAttributeType type, int components, int offset)
|
||||
{
|
||||
Name = name;
|
||||
Type = type;
|
||||
Components = components;
|
||||
Offset = offset;
|
||||
}
|
||||
|
||||
@@ -55,10 +55,10 @@ namespace OpenRA.Graphics
|
||||
|
||||
public override ShaderVertexAttribute[] Attributes { get; } = new[]
|
||||
{
|
||||
new ShaderVertexAttribute("aVertexPosition", 3, 0),
|
||||
new ShaderVertexAttribute("aVertexTexCoord", 4, 12),
|
||||
new ShaderVertexAttribute("aVertexTexMetadata", 2, 28),
|
||||
new ShaderVertexAttribute("aVertexTint", 4, 36)
|
||||
new ShaderVertexAttribute("aVertexPosition", ShaderVertexAttributeType.Float, 3, 0),
|
||||
new ShaderVertexAttribute("aVertexTexCoord", ShaderVertexAttributeType.Float, 4, 12),
|
||||
new ShaderVertexAttribute("aVertexTexMetadata", ShaderVertexAttributeType.Float, 2, 28),
|
||||
new ShaderVertexAttribute("aVertexTint", ShaderVertexAttributeType.Float, 4, 36)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user