Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame^] | 1 | #include <stdint.h> |
| 2 | |
| 3 | |
| 4 | typedef void * RsAdapter1D; |
| 5 | typedef void * RsAdapter2D; |
| 6 | typedef void * RsAllocation; |
| 7 | typedef void * RsContext; |
| 8 | typedef void * RsDevice; |
| 9 | typedef void * RsElement; |
| 10 | typedef void * RsSampler; |
| 11 | typedef void * RsScript; |
| 12 | typedef void * RsScriptBasicTemp; |
| 13 | typedef void * RsTriangleMesh; |
| 14 | typedef void * RsType; |
| 15 | typedef void * RsProgramFragment; |
| 16 | typedef void * RsProgramFragmentStore; |
| 17 | |
| 18 | |
| 19 | typedef struct { |
| 20 | float m[16]; |
| 21 | } rsc_Matrix; |
| 22 | |
| 23 | |
| 24 | typedef struct { |
| 25 | float v[4]; |
| 26 | } rsc_Vector4; |
| 27 | |
| 28 | #define RS_PROGRAM_VERTEX_MODELVIEW_OFFSET 0 |
| 29 | #define RS_PROGRAM_VERTEX_PROJECTION_OFFSET 16 |
| 30 | #define RS_PROGRAM_VERTEX_TEXTURE_OFFSET 32 |
| 31 | |
| 32 | typedef struct { |
| 33 | const void * (*loadEnvVp)(void *con, uint32_t bank, uint32_t offset); |
| 34 | |
| 35 | float (*loadEnvF)(void *con, uint32_t bank, uint32_t offset); |
| 36 | int32_t (*loadEnvI32)(void *con, uint32_t bank, uint32_t offset); |
| 37 | uint32_t (*loadEnvU32)(void *con, uint32_t bank, uint32_t offset); |
| 38 | void (*loadEnvVec4)(void *con, uint32_t bank, uint32_t offset, rsc_Vector4 *); |
| 39 | void (*loadEnvMatrix)(void *con, uint32_t bank, uint32_t offset, rsc_Matrix *); |
| 40 | |
| 41 | void (*storeEnvF)(void *con, uint32_t bank, uint32_t offset, float); |
| 42 | void (*storeEnvI32)(void *con, uint32_t bank, uint32_t offset, int32_t); |
| 43 | void (*storeEnvU32)(void *con, uint32_t bank, uint32_t offset, uint32_t); |
| 44 | void (*storeEnvVec4)(void *con, uint32_t bank, uint32_t offset, const rsc_Vector4 *); |
| 45 | void (*storeEnvMatrix)(void *con, uint32_t bank, uint32_t offset, const rsc_Matrix *); |
| 46 | |
| 47 | void (*matrixLoadIdentity)(void *con, rsc_Matrix *); |
| 48 | void (*matrixLoadFloat)(void *con, rsc_Matrix *, const float *); |
| 49 | void (*matrixLoadMat)(void *con, rsc_Matrix *, const rsc_Matrix *); |
| 50 | void (*matrixLoadRotate)(void *con, rsc_Matrix *, float rot, float x, float y, float z); |
| 51 | void (*matrixLoadScale)(void *con, rsc_Matrix *, float x, float y, float z); |
| 52 | void (*matrixLoadTranslate)(void *con, rsc_Matrix *, float x, float y, float z); |
| 53 | void (*matrixLoadMultiply)(void *con, rsc_Matrix *, const rsc_Matrix *lhs, const rsc_Matrix *rhs); |
| 54 | void (*matrixMultiply)(void *con, rsc_Matrix *, const rsc_Matrix *rhs); |
| 55 | void (*matrixRotate)(void *con, rsc_Matrix *, float rot, float x, float y, float z); |
| 56 | void (*matrixScale)(void *con, rsc_Matrix *, float x, float y, float z); |
| 57 | void (*matrixTranslate)(void *con, rsc_Matrix *, float x, float y, float z); |
| 58 | |
| 59 | void (*color)(void *con, float r, float g, float b, float a); |
| 60 | |
| 61 | void (*renderTriangleMesh)(void *con, RsTriangleMesh); |
| 62 | void (*renderTriangleMeshRange)(void *con, RsTriangleMesh, uint32_t start, uint32_t count); |
| 63 | |
| 64 | void (*programFragmentBindTexture)(void *con, RsProgramFragment, uint32_t slot, RsAllocation); |
| 65 | void (*programFragmentBindSampler)(void *con, RsProgramFragment, uint32_t slot, RsAllocation); |
| 66 | |
| 67 | void (*materialDiffuse)(void *con, float r, float g, float b, float a); |
| 68 | void (*materialSpecular)(void *con, float r, float g, float b, float a); |
| 69 | void (*lightPosition)(void *con, float x, float y, float z, float w); |
| 70 | void (*materialShininess)(void *con, float s); |
| 71 | |
| 72 | void (*uploadToTexture)(void *con, RsAllocation va, uint32_t baseMipLevel); |
| 73 | |
| 74 | void (*enable)(void *con, uint32_t); |
| 75 | void (*disable)(void *con, uint32_t); |
| 76 | |
| 77 | uint32_t (*rand)(void *con, uint32_t max); |
| 78 | |
| 79 | // Assumes (GL_FIXED) x,y,z (GL_UNSIGNED_BYTE)r,g,b,a |
| 80 | void (*drawTriangleArray)(void *con, RsAllocation alloc, uint32_t count); |
| 81 | |
| 82 | void (*contextBindProgramFragment)(void *con, RsProgramFragment pf); |
| 83 | void (*contextBindProgramFragmentStore)(void *con, RsProgramFragmentStore pfs); |
| 84 | } rsc_FunctionTable; |
| 85 | |
| 86 | typedef void (*rsc_RunScript)(void *con, const rsc_FunctionTable *, uint32_t launchID); |
| 87 | |
| 88 | |
| 89 | /* EnableCap */ |
| 90 | #define GL_LIGHTING 0x0B50 |
| 91 | |
| 92 | /* LightName */ |
| 93 | #define GL_LIGHT0 0x4000 |