1#include "rs_core.rsh" 2#include "rs_graphics.rsh" 3#include "rs_structs.h" 4 5/** 6* Mesh 7*/ 8extern uint32_t __attribute__((overloadable)) 9 rsgMeshGetVertexAllocationCount(rs_mesh m) { 10 Mesh_t *mesh = (Mesh_t *)m.p; 11 if (mesh == NULL) { 12 return 0; 13 } 14 return mesh->mHal.state.vertexBuffersCount; 15} 16 17extern uint32_t __attribute__((overloadable)) 18 rsgMeshGetPrimitiveCount(rs_mesh m) { 19 Mesh_t *mesh = (Mesh_t *)m.p; 20 if (mesh == NULL) { 21 return 0; 22 } 23 return mesh->mHal.state.primitivesCount; 24} 25 26extern rs_allocation __attribute__((overloadable)) 27 rsgMeshGetVertexAllocation(rs_mesh m, uint32_t index) { 28 Mesh_t *mesh = (Mesh_t *)m.p; 29 if (mesh == NULL || index >= mesh->mHal.state.vertexBuffersCount) { 30 rs_allocation nullAlloc = {0}; 31 return nullAlloc; 32 } 33 rs_allocation returnAlloc = {mesh->mHal.state.vertexBuffers[index]}; 34 return returnAlloc; 35} 36 37extern rs_allocation __attribute__((overloadable)) 38 rsgMeshGetIndexAllocation(rs_mesh m, uint32_t index) { 39 Mesh_t *mesh = (Mesh_t *)m.p; 40 if (mesh == NULL || index >= mesh->mHal.state.primitivesCount) { 41 rs_allocation nullAlloc = {0}; 42 return nullAlloc; 43 } 44 rs_allocation returnAlloc = {mesh->mHal.state.indexBuffers[index]}; 45 return returnAlloc; 46} 47 48extern rs_primitive __attribute__((overloadable)) 49 rsgMeshGetPrimitive(rs_mesh m, uint32_t index) { 50 Mesh_t *mesh = (Mesh_t *)m.p; 51 if (mesh == NULL || index >= mesh->mHal.state.primitivesCount) { 52 return RS_PRIMITIVE_INVALID; 53 } 54 return mesh->mHal.state.primitives[index]; 55} 56