rs_mesh.c revision 95e71d3d05a583a807013de5c81f952e1ba054be
1#ifndef __LP64__ 2 3#include "rs_core.rsh" 4#include "rs_graphics.rsh" 5#include "rs_structs.h" 6 7/** 8* Mesh 9*/ 10extern uint32_t __attribute__((overloadable)) 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 19extern uint32_t __attribute__((overloadable)) 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 28extern rs_allocation __attribute__((overloadable)) 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 rs_allocation rs_retval = {0}; 37 rsSetObject(&rs_retval, returnAlloc); 38 return rs_retval; 39} 40 41extern rs_allocation __attribute__((overloadable)) 42 rsgMeshGetIndexAllocation(rs_mesh m, uint32_t index) { 43 Mesh_t *mesh = (Mesh_t *)m.p; 44 if (mesh == NULL || index >= mesh->mHal.state.primitivesCount) { 45 rs_allocation nullAlloc = {0}; 46 return nullAlloc; 47 } 48 rs_allocation returnAlloc = {mesh->mHal.state.indexBuffers[index]}; 49 rs_allocation rs_retval = {0}; 50 rsSetObject(&rs_retval, returnAlloc); 51 return rs_retval; 52} 53 54extern rs_primitive __attribute__((overloadable)) 55 rsgMeshGetPrimitive(rs_mesh m, uint32_t index) { 56 Mesh_t *mesh = (Mesh_t *)m.p; 57 if (mesh == NULL || index >= mesh->mHal.state.primitivesCount) { 58 return RS_PRIMITIVE_INVALID; 59 } 60 return mesh->mHal.state.primitives[index]; 61} 62 63#endif 64 65