draw functions
parent
de3b25ab82
commit
b43ecacfc4
|
@ -24,8 +24,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <FNA3D.h>
|
|
||||||
|
|
||||||
#ifndef REFRESH_H
|
#ifndef REFRESH_H
|
||||||
#define REFRESH_H
|
#define REFRESH_H
|
||||||
|
|
||||||
|
@ -54,6 +52,7 @@ extern "C" {
|
||||||
|
|
||||||
/* Type Declarations */
|
/* Type Declarations */
|
||||||
|
|
||||||
|
typedef struct REFRESH_Device REFRESH_Device;
|
||||||
typedef struct REFRESH_Texture REFRESH_Texture;
|
typedef struct REFRESH_Texture REFRESH_Texture;
|
||||||
typedef struct REFRESH_Buffer REFRESH_Buffer;
|
typedef struct REFRESH_Buffer REFRESH_Buffer;
|
||||||
typedef struct REFRESH_ColorTarget REFRESH_ColorTarget;
|
typedef struct REFRESH_ColorTarget REFRESH_ColorTarget;
|
||||||
|
@ -62,6 +61,16 @@ typedef struct REFRESH_Framebuffer REFRESH_Framebuffer;
|
||||||
typedef struct REFRESH_RenderPass REFRESH_RenderPass;
|
typedef struct REFRESH_RenderPass REFRESH_RenderPass;
|
||||||
typedef struct REFRESH_Pipeline REFRESH_Pipeline;
|
typedef struct REFRESH_Pipeline REFRESH_Pipeline;
|
||||||
|
|
||||||
|
typedef enum REFRESH_PrimitiveType
|
||||||
|
{
|
||||||
|
REFRESH_PRIMITIVETYPE_POINTLIST,
|
||||||
|
REFRESH_PRIMITIVETYPE_LINELIST,
|
||||||
|
REFRESH_PRIMITIVETYPE_LINESTRIP,
|
||||||
|
REFRESH_PRIMITIVETYPE_TRIANGLELIST,
|
||||||
|
REFRESH_PRIMITIVETYPE_TRIANGLESTRIP,
|
||||||
|
REFRESH_PRIMITIVETYPE_TRIANGLEFAN
|
||||||
|
} REFRESH_PrimitiveType;
|
||||||
|
|
||||||
typedef enum REFRESH_LoadOp
|
typedef enum REFRESH_LoadOp
|
||||||
{
|
{
|
||||||
REFRESH_LOADOP_LOAD,
|
REFRESH_LOADOP_LOAD,
|
||||||
|
@ -136,10 +145,60 @@ typedef enum REFRESH_BufferUsage
|
||||||
|
|
||||||
/* Structures */
|
/* Structures */
|
||||||
|
|
||||||
|
typedef struct REFRESH_Color
|
||||||
|
{
|
||||||
|
uint8_t r;
|
||||||
|
uint8_t g;
|
||||||
|
uint8_t b;
|
||||||
|
uint8_t a;
|
||||||
|
} REFRESH_Color;
|
||||||
|
|
||||||
|
typedef struct REFRESH_Rect
|
||||||
|
{
|
||||||
|
int32_t x;
|
||||||
|
int32_t y;
|
||||||
|
int32_t w;
|
||||||
|
int32_t h;
|
||||||
|
} REFRESH_Rect;
|
||||||
|
|
||||||
|
typedef struct REFRESH_Vec4
|
||||||
|
{
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
float z;
|
||||||
|
float w;
|
||||||
|
} REFRESH_Vec4;
|
||||||
|
|
||||||
|
typedef struct REFRESH_Viewport
|
||||||
|
{
|
||||||
|
int32_t x;
|
||||||
|
int32_t y;
|
||||||
|
int32_t w;
|
||||||
|
int32_t h;
|
||||||
|
float minDepth;
|
||||||
|
float maxDepth;
|
||||||
|
} REFRESH_Viewport;
|
||||||
|
|
||||||
|
typedef enum REFRESH_VertexElementFormat
|
||||||
|
{
|
||||||
|
REFRESH_VERTEXELEMENTFORMAT_SINGLE,
|
||||||
|
REFRESH_VERTEXELEMENTFORMAT_VECTOR2,
|
||||||
|
REFRESH_VERTEXELEMENTFORMAT_VECTOR3,
|
||||||
|
REFRESH_VERTEXELEMENTFORMAT_VECTOR4,
|
||||||
|
REFRESH_VERTEXELEMENTFORMAT_COLOR,
|
||||||
|
REFRESH_VERTEXELEMENTFORMAT_BYTE4,
|
||||||
|
REFRESH_VERTEXELEMENTFORMAT_SHORT2,
|
||||||
|
REFRESH_VERTEXELEMENTFORMAT_SHORT4,
|
||||||
|
REFRESH_VERTEXELEMENTFORMAT_NORMALIZEDSHORT2,
|
||||||
|
REFRESH_VERTEXELEMENTFORMAT_NORMALIZEDSHORT4,
|
||||||
|
REFRESH_VERTEXELEMENTFORMAT_HALFVECTOR2,
|
||||||
|
REFRESH_VERTEXELEMENTFORMAT_HALFVECTOR4
|
||||||
|
} REFRESH_VertexElementFormat;
|
||||||
|
|
||||||
typedef struct REFRESH_VertexElement
|
typedef struct REFRESH_VertexElement
|
||||||
{
|
{
|
||||||
int32_t offset;
|
int32_t offset;
|
||||||
FNA3D_VertexElementFormat vertexElementFormat;
|
REFRESH_VertexElementFormat vertexElementFormat;
|
||||||
int32_t usageIndex;
|
int32_t usageIndex;
|
||||||
} REFRESH_VertexElement;
|
} REFRESH_VertexElement;
|
||||||
|
|
||||||
|
@ -176,6 +235,83 @@ REFRESHAPI uint32_t REFRESH_LinkedVersion(void);
|
||||||
|
|
||||||
/* Functions */
|
/* Functions */
|
||||||
|
|
||||||
|
/* Drawing */
|
||||||
|
|
||||||
|
/* Clears the active draw buffers of any previous contents.
|
||||||
|
*
|
||||||
|
* options: Bitflags to specify color/depth/stencil buffers for clearing.
|
||||||
|
* color: The new value of the cleared color buffer.
|
||||||
|
* depth: The new value of the cleared depth buffer.
|
||||||
|
* stencil: The new value of the cleared stencil buffer.
|
||||||
|
*/
|
||||||
|
REFRESHAPI void REFRESH_Clear(
|
||||||
|
REFRESH_Device *device,
|
||||||
|
REFRESH_Vec4 **colors,
|
||||||
|
uint32_t colorCount,
|
||||||
|
float depth,
|
||||||
|
int32_t stencil
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Draws data from vertex/index buffers.
|
||||||
|
*
|
||||||
|
* primitiveType: The primitive topology of the vertex data.
|
||||||
|
* baseVertex: The starting offset to read from the vertex buffer.
|
||||||
|
* minVertexIndex: The lowest index value expected from the index buffer.
|
||||||
|
* numVertices: The highest offset expected from the index buffer.
|
||||||
|
* startIndex: The starting offset to read from the index buffer.
|
||||||
|
* primitiveCount: The number of primitives to draw.
|
||||||
|
* indices: The index buffer to bind for this draw call.
|
||||||
|
* indexElementSize: The size of the index type for this index buffer.
|
||||||
|
*/
|
||||||
|
REFRESHAPI void REFRESH_DrawIndexedPrimitives(
|
||||||
|
REFRESH_Device *device,
|
||||||
|
REFRESH_PrimitiveType primitiveType,
|
||||||
|
int32_t baseVertex,
|
||||||
|
int32_t minVertexIndex,
|
||||||
|
int32_t numVertices,
|
||||||
|
int32_t startIndex,
|
||||||
|
int32_t primitiveCount,
|
||||||
|
REFRESH_Buffer *indices,
|
||||||
|
REFRESH_IndexElementSize indexElementSize
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Draws data from vertex/index buffers with instancing enabled.
|
||||||
|
*
|
||||||
|
* primitiveType: The primitive topology of the vertex data.
|
||||||
|
* baseVertex: The starting offset to read from the vertex buffer.
|
||||||
|
* minVertexIndex: The lowest index value expected from the index buffer.
|
||||||
|
* numVertices: The highest offset expected from the index buffer.
|
||||||
|
* startIndex: The starting offset to read from the index buffer.
|
||||||
|
* primitiveCount: The number of primitives to draw.
|
||||||
|
* instanceCount: The number of instances that will be drawn.
|
||||||
|
* indices: The index buffer to bind for this draw call.
|
||||||
|
* indexElementSize: The size of the index type for this index buffer.
|
||||||
|
*/
|
||||||
|
REFRESHAPI void REFRESH_DrawInstancedPrimitives(
|
||||||
|
REFRESH_Device *device,
|
||||||
|
REFRESH_PrimitiveType primitiveType,
|
||||||
|
int32_t baseVertex,
|
||||||
|
int32_t minVertexIndex,
|
||||||
|
int32_t numVertices,
|
||||||
|
int32_t startIndex,
|
||||||
|
int32_t primitiveCount,
|
||||||
|
int32_t instanceCount,
|
||||||
|
REFRESH_Buffer *indices,
|
||||||
|
REFRESH_IndexElementSize indexElementSize
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Draws data from vertex buffers.
|
||||||
|
* primitiveType: The primitive topology of the vertex data.
|
||||||
|
* vertexStart: The starting offset to read from the vertex buffer.
|
||||||
|
* primitiveCount: The number of primitives to draw.
|
||||||
|
*/
|
||||||
|
REFRESHAPI void REFRESH_DrawPrimitives(
|
||||||
|
REFRESH_Device *device,
|
||||||
|
REFRESH_PrimitiveType primitiveType,
|
||||||
|
int32_t vertexStart,
|
||||||
|
int32_t primitiveCount
|
||||||
|
);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
Loading…
Reference in New Issue