2018-09-26 00:10:09 +00:00
|
|
|
#include "data/modelData.h"
|
2018-07-04 20:51:35 +00:00
|
|
|
#include <stdbool.h>
|
2017-03-11 22:13:49 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2018-12-08 03:11:14 +00:00
|
|
|
#define MAX_ATTRIBUTES 16
|
2019-02-14 01:20:43 +00:00
|
|
|
#define MAX_ATTRIBUTE_NAME_LENGTH 32
|
2018-12-08 03:11:14 +00:00
|
|
|
|
2019-04-05 11:58:29 +00:00
|
|
|
struct Buffer;
|
|
|
|
struct Material;
|
|
|
|
|
2018-12-08 03:11:14 +00:00
|
|
|
typedef struct {
|
2019-04-05 11:58:29 +00:00
|
|
|
struct Buffer* buffer;
|
2019-01-27 22:29:06 +00:00
|
|
|
uint32_t offset;
|
|
|
|
unsigned stride : 8;
|
|
|
|
unsigned divisor : 8;
|
|
|
|
unsigned type : 3; // AttributeType
|
|
|
|
unsigned components : 3;
|
|
|
|
unsigned normalized : 1;
|
|
|
|
unsigned disabled : 1;
|
2018-12-08 03:11:14 +00:00
|
|
|
} MeshAttribute;
|
|
|
|
|
2020-02-23 07:18:54 +00:00
|
|
|
typedef struct Mesh Mesh;
|
|
|
|
Mesh* lovrMeshCreate(DrawMode mode, struct Buffer* vertexBuffer, uint32_t vertexCount);
|
2018-02-26 08:59:03 +00:00
|
|
|
void lovrMeshDestroy(void* ref);
|
2019-04-05 11:58:29 +00:00
|
|
|
struct Buffer* lovrMeshGetVertexBuffer(Mesh* mesh);
|
|
|
|
struct Buffer* lovrMeshGetIndexBuffer(Mesh* mesh);
|
|
|
|
void lovrMeshSetIndexBuffer(Mesh* mesh, struct Buffer* buffer, uint32_t indexCount, size_t indexSize, size_t offset);
|
2018-12-27 21:50:42 +00:00
|
|
|
uint32_t lovrMeshGetVertexCount(Mesh* mesh);
|
|
|
|
uint32_t lovrMeshGetIndexCount(Mesh* mesh);
|
|
|
|
size_t lovrMeshGetIndexSize(Mesh* mesh);
|
2020-02-23 07:18:54 +00:00
|
|
|
uint32_t lovrMeshGetAttributeCount(Mesh* mesh);
|
2018-12-08 03:11:14 +00:00
|
|
|
void lovrMeshAttachAttribute(Mesh* mesh, const char* name, MeshAttribute* attribute);
|
2018-03-13 23:12:12 +00:00
|
|
|
void lovrMeshDetachAttribute(Mesh* mesh, const char* name);
|
2020-02-23 07:18:54 +00:00
|
|
|
const MeshAttribute* lovrMeshGetAttribute(Mesh* mesh, uint32_t index);
|
|
|
|
uint32_t lovrMeshGetAttributeIndex(Mesh* mesh, const char* name);
|
|
|
|
const char* lovrMeshGetAttributeName(Mesh* mesh, uint32_t index);
|
2017-10-31 08:14:09 +00:00
|
|
|
bool lovrMeshIsAttributeEnabled(Mesh* mesh, const char* name);
|
|
|
|
void lovrMeshSetAttributeEnabled(Mesh* mesh, const char* name, bool enabled);
|
2018-12-27 21:50:42 +00:00
|
|
|
DrawMode lovrMeshGetDrawMode(Mesh* mesh);
|
|
|
|
void lovrMeshSetDrawMode(Mesh* mesh, DrawMode mode);
|
2018-06-04 02:00:31 +00:00
|
|
|
void lovrMeshGetDrawRange(Mesh* mesh, uint32_t* start, uint32_t* count);
|
|
|
|
void lovrMeshSetDrawRange(Mesh* mesh, uint32_t start, uint32_t count);
|
2019-04-05 11:58:29 +00:00
|
|
|
struct Material* lovrMeshGetMaterial(Mesh* mesh);
|
|
|
|
void lovrMeshSetMaterial(Mesh* mesh, struct Material* material);
|