mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
VertexLayout cleanup
This commit is contained in:
@@ -13,12 +13,12 @@ namespace GlitchyEngine.Renderer
|
|||||||
|
|
||||||
public ID3DBlob* nativeShaderCode ~ _?.Release();
|
public ID3DBlob* nativeShaderCode ~ _?.Release();
|
||||||
|
|
||||||
public this(GraphicsContext context, VertexElement[] ownElements, VertexShader vertexShader)
|
public this(GraphicsContext context, VertexElement[] elements, VertexShader vertexShader)
|
||||||
{
|
{
|
||||||
nativeShaderCode = vertexShader.nativeCode..AddRef();
|
nativeShaderCode = vertexShader.nativeCode..AddRef();
|
||||||
|
|
||||||
_context = context..AddRef();
|
_context = context..AddRef();
|
||||||
_elements = ownElements;
|
_elements = elements;
|
||||||
|
|
||||||
CreateNativeLayout();
|
CreateNativeLayout();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,18 +77,16 @@ namespace GlitchyEngine.Renderer
|
|||||||
{
|
{
|
||||||
private GraphicsContext _context ~ _?.ReleaseRef();
|
private GraphicsContext _context ~ _?.ReleaseRef();
|
||||||
|
|
||||||
private VertexElement[] _elements ~ delete _;
|
private VertexElement[] _elements;
|
||||||
|
|
||||||
public GraphicsContext Context => _context;
|
public GraphicsContext Context => _context;
|
||||||
|
|
||||||
public VertexElement[] Elements => _elements;
|
public VertexElement[] Elements => _elements;
|
||||||
|
|
||||||
// Todo: DirectX needs shader!
|
public this(GraphicsContext context, VertexElement[] elements, VertexShader vertexShader)
|
||||||
/// Takes ownership of ownElements!
|
|
||||||
public this(GraphicsContext context, VertexElement[] ownElements, VertexShader vertexShader)
|
|
||||||
{
|
{
|
||||||
_context = context..AddRef();
|
_context = context..AddRef();
|
||||||
_elements = ownElements;
|
_elements = elements;
|
||||||
|
|
||||||
CreateNativeLayout();
|
CreateNativeLayout();
|
||||||
}
|
}
|
||||||
@@ -98,6 +96,6 @@ namespace GlitchyEngine.Renderer
|
|||||||
|
|
||||||
public interface IVertexData
|
public interface IVertexData
|
||||||
{
|
{
|
||||||
static VertexLayout VertexLayout {get;}
|
static VertexElement[] VertexElements {get;}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,15 +37,17 @@ namespace Sandbox
|
|||||||
TexCoord = texCoord;
|
TexCoord = texCoord;
|
||||||
}
|
}
|
||||||
|
|
||||||
//public static readonly InputElementDescription[] InputLayout ~ delete _;
|
public static readonly VertexElement[] VertexElements ~ delete _;
|
||||||
|
|
||||||
public static readonly VertexLayout VertexLayout ~ delete _;
|
public static VertexElement[] IVertexData.VertexElements => VertexElements;
|
||||||
|
|
||||||
public static VertexLayout IVertexData.VertexLayout => VertexLayout;
|
|
||||||
|
|
||||||
static this()
|
static this()
|
||||||
{
|
{
|
||||||
//VertexLayout = new VertexLayout();
|
VertexElements = new VertexElement[](
|
||||||
|
VertexElement(.R32G32B32_Float, "POSITION"),
|
||||||
|
VertexElement(.R8G8B8A8_UNorm, "COLOR"),
|
||||||
|
VertexElement(.R32G32_Float, "TEXCOORD"),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,11 +112,7 @@ namespace Sandbox
|
|||||||
|
|
||||||
// Create Input Layout
|
// Create Input Layout
|
||||||
|
|
||||||
_vertexLayout = new VertexLayout(_context, new .(
|
_vertexLayout = new VertexLayout(_context, VertexColorTexture.VertexElements, _textureEffect.VertexShader);
|
||||||
VertexElement(.R32G32B32_Float, "POSITION"),
|
|
||||||
VertexElement(.R8G8B8A8_UNorm, "COLOR"),
|
|
||||||
VertexElement(.R32G32_Float, "TEXCOORD"),
|
|
||||||
), _textureEffect.VertexShader);
|
|
||||||
|
|
||||||
|
|
||||||
_cBuffer = _effect.PixelShader.Buffers["Constants"] as ConstantBuffer;
|
_cBuffer = _effect.PixelShader.Buffers["Constants"] as ConstantBuffer;
|
||||||
|
|||||||
Reference in New Issue
Block a user