mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-06 13:11:53 +00:00
Added (dirty) VertexLayout
This commit is contained in:
@@ -179,101 +179,4 @@ namespace GlitchyEngine.Renderer
|
||||
*/
|
||||
protected extern Result<void> PlatformSetData(void* data, uint32 byteLength, uint32 dstByteOffset, MapType mapType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of data contained in an input slot.
|
||||
*/
|
||||
public enum InputClassification
|
||||
{
|
||||
/**
|
||||
* Input data is per-vertex data.
|
||||
*/
|
||||
PerVertexData = 0,
|
||||
/**
|
||||
* Input data is per-instance data.
|
||||
*/
|
||||
PerInstanceData = 1
|
||||
}
|
||||
|
||||
public struct VertexElement
|
||||
{
|
||||
/**
|
||||
* The semantic associated with this element in a shader input-signature.
|
||||
*/
|
||||
public String SemanticName;
|
||||
/**
|
||||
* The semantic index for the element.
|
||||
* A semantic index modifies a semantic, with an integer index number.
|
||||
* A semantic index is only needed in a case where there is more than one element with the same semantic.
|
||||
* For example, a 4x4 matrix would have four components each with the semantic name "matrix",
|
||||
* however each of the four component would have different semantic indices (0, 1, 2, and 3).
|
||||
*/
|
||||
public uint32 SemanticIndex;
|
||||
/**
|
||||
* The data type of the element data.
|
||||
*/
|
||||
public Format Format;
|
||||
/**
|
||||
* An integer value that identifies the input-assembler (see input slot). Valid values are between 0 and 15.
|
||||
*/
|
||||
public uint32 InputSlot;
|
||||
/**
|
||||
* Optional. Offset (in bytes) from the start of the vertex. Use AppendAligned for convenience to define the current element directly after the previous one, including any packing if necessary.
|
||||
*/
|
||||
public uint32 AlignedByteOffset;
|
||||
/**
|
||||
* Identifies the input data class for a single input slot.
|
||||
*/
|
||||
public InputClassification InputSlotClass;
|
||||
/**
|
||||
* The number of instances to draw using the same per-instance data before advancing in the buffer by one element.
|
||||
* This value must be 0 for an element that contains per-vertex data (the slot class is set to PerVertexData).
|
||||
*/
|
||||
public uint32 InstanceDataStepRate;
|
||||
|
||||
public this() => this = default;
|
||||
|
||||
public this(String semanticName, uint32 semanticIndex, Format format, uint32 inputSlot, uint32 offset = (.)-1, InputClassification slotClass = .PerVertexData, uint32 instanceStepRate = 0)
|
||||
{
|
||||
SemanticName = semanticName;
|
||||
SemanticIndex = semanticIndex;
|
||||
Format = format;
|
||||
InputSlot = inputSlot;
|
||||
AlignedByteOffset = offset;
|
||||
InputSlotClass = slotClass;
|
||||
InstanceDataStepRate = instanceStepRate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use AppendAligned for convenience to define the current element directly after the previous one, including any packing if necessary.
|
||||
*/
|
||||
public static readonly uint32 AppendAligned = 0xffffffff;
|
||||
}
|
||||
|
||||
public abstract class VertexLayout
|
||||
{
|
||||
private GraphicsContext _context;
|
||||
|
||||
private VertexElement[] _elements ~ delete _;
|
||||
|
||||
public GraphicsContext Context => _context;
|
||||
|
||||
public VertexElement[] Elements => _elements;
|
||||
|
||||
/// Takes ownership of ownElements!
|
||||
public this(GraphicsContext context, VertexElement[] ownElements)
|
||||
{
|
||||
_context = context;
|
||||
_elements = ownElements;
|
||||
|
||||
//CreateNativeLayout();
|
||||
}
|
||||
|
||||
private extern void CreateNativeLayout();
|
||||
}
|
||||
|
||||
public interface IVertexData
|
||||
{
|
||||
static VertexLayout VertexLayout {get;}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user