rs_graphics.rsh
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2011-2012 The Android Open Source Project
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00023 #ifndef __RS_GRAPHICS_RSH__
00024 #define __RS_GRAPHICS_RSH__
00025 
00026 #include "rs_mesh.rsh"
00027 #include "rs_program.rsh"
00028 
00029 #if (defined(RS_VERSION) && (RS_VERSION >= 14))
00030 
00035 extern void __attribute__((overloadable))
00036     rsgBindColorTarget(rs_allocation colorTarget, uint slot);
00037 
00042 extern void __attribute__((overloadable))
00043     rsgClearColorTarget(uint slot);
00044 
00049 extern void __attribute__((overloadable))
00050     rsgBindDepthTarget(rs_allocation depthTarget);
00051 
00055 extern void __attribute__((overloadable))
00056     rsgClearDepthTarget(void);
00057 
00062 extern void __attribute__((overloadable))
00063     rsgClearAllRenderTargets(void);
00064 
00068 extern uint __attribute__((overloadable))
00069     rsgFinish(void);
00070 
00071 #endif //defined(RS_VERSION) && (RS_VERSION >= 14)
00072 
00078 extern void __attribute__((overloadable))
00079     rsgBindProgramFragment(rs_program_fragment pf);
00080 
00086 extern void __attribute__((overloadable))
00087     rsgBindProgramStore(rs_program_store ps);
00088 
00094 extern void __attribute__((overloadable))
00095     rsgBindProgramVertex(rs_program_vertex pv);
00096 
00102 extern void __attribute__((overloadable))
00103     rsgBindProgramRaster(rs_program_raster pr);
00104 
00111 extern void __attribute__((overloadable))
00112     rsgBindSampler(rs_program_fragment, uint slot, rs_sampler);
00113 
00122 extern void __attribute__((overloadable))
00123     rsgBindTexture(rs_program_fragment, uint slot, rs_allocation);
00124 
00131 extern void __attribute__((overloadable))
00132     rsgProgramVertexLoadProjectionMatrix(const rs_matrix4x4 *proj);
00139 extern void __attribute__((overloadable))
00140     rsgProgramVertexLoadModelMatrix(const rs_matrix4x4 *model);
00147 extern void __attribute__((overloadable))
00148     rsgProgramVertexLoadTextureMatrix(const rs_matrix4x4 *tex);
00155 extern void __attribute__((overloadable))
00156     rsgProgramVertexGetProjectionMatrix(rs_matrix4x4 *proj);
00157 
00167 extern void __attribute__((overloadable))
00168     rsgProgramFragmentConstantColor(rs_program_fragment pf, float r, float g, float b, float a);
00169 
00178 extern void __attribute__((overloadable))
00179     rsgBindConstant(rs_program_fragment ps, uint slot, rs_allocation c);
00180 
00189 extern void __attribute__((overloadable))
00190     rsgBindConstant(rs_program_vertex pv, uint slot, rs_allocation c);
00191 
00197 extern uint __attribute__((overloadable))
00198     rsgGetWidth(void);
00199 
00205 extern uint __attribute__((overloadable))
00206     rsgGetHeight(void);
00207 
00208 
00215 extern void __attribute__((overloadable))
00216     rsgAllocationSyncAll(rs_allocation alloc);
00217 
00218 #if (defined(RS_VERSION) && (RS_VERSION >= 14))
00219 
00227 extern void __attribute__((overloadable))
00228     rsgAllocationSyncAll(rs_allocation alloc,
00229                          rs_allocation_usage_type source);
00230 
00231 #endif //defined(RS_VERSION) && (RS_VERSION >= 14)
00232 
00243 extern void __attribute__((overloadable))
00244     rsgDrawRect(float x1, float y1, float x2, float y2, float z);
00245 
00263 extern void __attribute__((overloadable))
00264     rsgDrawQuad(float x1, float y1, float z1,
00265                 float x2, float y2, float z2,
00266                 float x3, float y3, float z3,
00267                 float x4, float y4, float z4);
00268 
00269 
00295 extern void __attribute__((overloadable))
00296     rsgDrawQuadTexCoords(float x1, float y1, float z1, float u1, float v1,
00297                          float x2, float y2, float z2, float u2, float v2,
00298                          float x3, float y3, float z3, float u3, float v3,
00299                          float x4, float y4, float z4, float u4, float v4);
00300 
00301 
00314 extern void __attribute__((overloadable))
00315     rsgDrawSpriteScreenspace(float x, float y, float z, float w, float h);
00316 
00317 extern void __attribute__((overloadable))
00318     rsgDrawPath(rs_path p);
00319 
00326 extern void __attribute__((overloadable))
00327     rsgDrawMesh(rs_mesh ism);
00334 extern void __attribute__((overloadable))
00335     rsgDrawMesh(rs_mesh ism, uint primitiveIndex);
00344 extern void __attribute__((overloadable))
00345     rsgDrawMesh(rs_mesh ism, uint primitiveIndex, uint start, uint len);
00346 
00355 extern void __attribute__((overloadable))
00356     rsgClearColor(float r, float g, float b, float a);
00357 
00361 extern void __attribute__((overloadable))
00362     rsgClearDepth(float value);
00366 extern void __attribute__((overloadable))
00367     rsgDrawText(const char *, int x, int y);
00371 extern void __attribute__((overloadable))
00372     rsgDrawText(rs_allocation, int x, int y);
00377 extern void __attribute__((overloadable))
00378     rsgBindFont(rs_font font);
00386 extern void __attribute__((overloadable))
00387     rsgFontColor(float r, float g, float b, float a);
00392 extern void __attribute__((overloadable))
00393     rsgMeasureText(const char *, int *left, int *right, int *top, int *bottom);
00397 extern void __attribute__((overloadable))
00398     rsgMeasureText(rs_allocation, int *left, int *right, int *top, int *bottom);
00402 extern void __attribute__((overloadable))
00403     rsgMeshComputeBoundingBox(rs_mesh mesh, float *minX, float *minY, float *minZ,
00404                                                 float *maxX, float *maxY, float *maxZ);
00408 __inline__ static void __attribute__((overloadable, always_inline))
00409 rsgMeshComputeBoundingBox(rs_mesh mesh, float3 *bBoxMin, float3 *bBoxMax) {
00410     float x1, y1, z1, x2, y2, z2;
00411     rsgMeshComputeBoundingBox(mesh, &x1, &y1, &z1, &x2, &y2, &z2);
00412     bBoxMin->x = x1;
00413     bBoxMin->y = y1;
00414     bBoxMin->z = z1;
00415     bBoxMax->x = x2;
00416     bBoxMax->y = y2;
00417     bBoxMax->z = z2;
00418 }
00419 
00420 #endif
00421