Alex Sakhartchouk | 4a048eb | 2012-03-20 14:07:34 -0700 | [diff] [blame] | 1 | #include "rs_core.rsh" |
| 2 | #include "rs_graphics.rsh" |
Alex Sakhartchouk | ff52255 | 2012-03-21 10:52:59 -0700 | [diff] [blame] | 3 | #include "rs_structs.h" |
Alex Sakhartchouk | 4a048eb | 2012-03-20 14:07:34 -0700 | [diff] [blame] | 4 | |
| 5 | /** |
| 6 | * Mesh |
| 7 | */ |
| 8 | extern uint32_t __attribute__((overloadable)) |
Alex Sakhartchouk | 3cbc3da | 2012-03-22 10:27:44 -0700 | [diff] [blame^] | 9 | rsgMeshGetVertexAllocationCount(rs_mesh m) { |
Alex Sakhartchouk | 4a048eb | 2012-03-20 14:07:34 -0700 | [diff] [blame] | 10 | Mesh_t *mesh = (Mesh_t *)m.p; |
| 11 | if (mesh == NULL) { |
| 12 | return 0; |
| 13 | } |
| 14 | return mesh->mHal.state.vertexBuffersCount; |
| 15 | } |
| 16 | |
| 17 | extern uint32_t __attribute__((overloadable)) |
Alex Sakhartchouk | 3cbc3da | 2012-03-22 10:27:44 -0700 | [diff] [blame^] | 18 | rsgMeshGetPrimitiveCount(rs_mesh m) { |
Alex Sakhartchouk | 4a048eb | 2012-03-20 14:07:34 -0700 | [diff] [blame] | 19 | Mesh_t *mesh = (Mesh_t *)m.p; |
| 20 | if (mesh == NULL) { |
| 21 | return 0; |
| 22 | } |
| 23 | return mesh->mHal.state.primitivesCount; |
| 24 | } |
| 25 | |
| 26 | extern rs_allocation __attribute__((overloadable)) |
Alex Sakhartchouk | 3cbc3da | 2012-03-22 10:27:44 -0700 | [diff] [blame^] | 27 | rsgMeshGetVertexAllocation(rs_mesh m, uint32_t index) { |
Alex Sakhartchouk | 4a048eb | 2012-03-20 14:07:34 -0700 | [diff] [blame] | 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 | |
| 37 | extern rs_allocation __attribute__((overloadable)) |
Alex Sakhartchouk | 3cbc3da | 2012-03-22 10:27:44 -0700 | [diff] [blame^] | 38 | rsgMeshGetIndexAllocation(rs_mesh m, uint32_t index) { |
Alex Sakhartchouk | 4a048eb | 2012-03-20 14:07:34 -0700 | [diff] [blame] | 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 | |
| 48 | extern rs_primitive __attribute__((overloadable)) |
Alex Sakhartchouk | 3cbc3da | 2012-03-22 10:27:44 -0700 | [diff] [blame^] | 49 | rsgMeshGetPrimitive(rs_mesh m, uint32_t index) { |
Alex Sakhartchouk | 4a048eb | 2012-03-20 14:07:34 -0700 | [diff] [blame] | 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 | } |