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 = RS_NULL_OBJ;
33         return nullAlloc;
34     }
35     rs_allocation returnAlloc = {mesh->mHal.state.vertexBuffers[index]};
36     rs_allocation rs_retval = RS_NULL_OBJ;
37     rsSetObject(&rs_retval, returnAlloc);
38     return rs_retval;
39 }
40 
41 extern rs_allocation __attribute__((overloadable))
rsgMeshGetIndexAllocation(rs_mesh m,uint32_t index)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 = RS_NULL_OBJ;
46         return nullAlloc;
47     }
48     rs_allocation returnAlloc = {mesh->mHal.state.indexBuffers[index]};
49     rs_allocation rs_retval = RS_NULL_OBJ;
50     rsSetObject(&rs_retval, returnAlloc);
51     return rs_retval;
52 }
53 
54 extern rs_primitive __attribute__((overloadable))
rsgMeshGetPrimitive(rs_mesh m,uint32_t index)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