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