rs_mesh.c revision 3ff0fe77fdba8ad4a920dc27157d8c1786bb3661
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    return returnAlloc;
37}
38
39extern rs_allocation __attribute__((overloadable))
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
50extern rs_primitive __attribute__((overloadable))
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