/src/ics-mr1/frameworks/base/libs/rs/scriptc/rs_graphics.rsh
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2011 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 #if (defined(RS_VERSION) && (RS_VERSION >= 14))
00026 
00031 extern void __attribute__((overloadable))
00032     rsgBindColorTarget(rs_allocation colorTarget, uint slot);
00033 
00038 extern void __attribute__((overloadable))
00039     rsgClearColorTarget(uint slot);
00040 
00045 extern void __attribute__((overloadable))
00046     rsgBindDepthTarget(rs_allocation depthTarget);
00047 
00051 extern void __attribute__((overloadable))
00052     rsgClearDepthTarget(void);
00053 
00058 extern void __attribute__((overloadable))
00059     rsgClearAllRenderTargets(void);
00060 
00064 extern uint __attribute__((overloadable))
00065     rsgFinish(void);
00066 
00067 #endif //defined(RS_VERSION) && (RS_VERSION >= 14)
00068 
00074 extern void __attribute__((overloadable))
00075     rsgBindProgramFragment(rs_program_fragment pf);
00076 
00082 extern void __attribute__((overloadable))
00083     rsgBindProgramStore(rs_program_store ps);
00084 
00090 extern void __attribute__((overloadable))
00091     rsgBindProgramVertex(rs_program_vertex pv);
00092 
00098 extern void __attribute__((overloadable))
00099     rsgBindProgramRaster(rs_program_raster pr);
00100 
00107 extern void __attribute__((overloadable))
00108     rsgBindSampler(rs_program_fragment, uint slot, rs_sampler);
00109 
00118 extern void __attribute__((overloadable))
00119     rsgBindTexture(rs_program_fragment, uint slot, rs_allocation);
00120 
00127 extern void __attribute__((overloadable))
00128     rsgProgramVertexLoadProjectionMatrix(const rs_matrix4x4 *proj);
00135 extern void __attribute__((overloadable))
00136     rsgProgramVertexLoadModelMatrix(const rs_matrix4x4 *model);
00143 extern void __attribute__((overloadable))
00144     rsgProgramVertexLoadTextureMatrix(const rs_matrix4x4 *tex);
00151 extern void __attribute__((overloadable))
00152     rsgProgramVertexGetProjectionMatrix(rs_matrix4x4 *proj);
00153 
00163 extern void __attribute__((overloadable))
00164     rsgProgramFragmentConstantColor(rs_program_fragment pf, float r, float g, float b, float a);
00165 
00171 extern uint __attribute__((overloadable))
00172     rsgGetWidth(void);
00173 
00179 extern uint __attribute__((overloadable))
00180     rsgGetHeight(void);
00181 
00182 
00189 extern void __attribute__((overloadable))
00190     rsgAllocationSyncAll(rs_allocation alloc);
00191 
00192 #if (defined(RS_VERSION) && (RS_VERSION >= 14))
00193 
00201 extern void __attribute__((overloadable))
00202     rsgAllocationSyncAll(rs_allocation alloc,
00203                          rs_allocation_usage_type source);
00204 
00205 #endif //defined(RS_VERSION) && (RS_VERSION >= 14)
00206 
00217 extern void __attribute__((overloadable))
00218     rsgDrawRect(float x1, float y1, float x2, float y2, float z);
00219 
00237 extern void __attribute__((overloadable))
00238     rsgDrawQuad(float x1, float y1, float z1,
00239                 float x2, float y2, float z2,
00240                 float x3, float y3, float z3,
00241                 float x4, float y4, float z4);
00242 
00243 
00269 extern void __attribute__((overloadable))
00270     rsgDrawQuadTexCoords(float x1, float y1, float z1, float u1, float v1,
00271                          float x2, float y2, float z2, float u2, float v2,
00272                          float x3, float y3, float z3, float u3, float v3,
00273                          float x4, float y4, float z4, float u4, float v4);
00274 
00275 
00288 extern void __attribute__((overloadable))
00289     rsgDrawSpriteScreenspace(float x, float y, float z, float w, float h);
00290 
00297 extern void __attribute__((overloadable))
00298     rsgDrawMesh(rs_mesh ism);
00305 extern void __attribute__((overloadable))
00306     rsgDrawMesh(rs_mesh ism, uint primitiveIndex);
00315 extern void __attribute__((overloadable))
00316     rsgDrawMesh(rs_mesh ism, uint primitiveIndex, uint start, uint len);
00317 
00326 extern void __attribute__((overloadable))
00327     rsgClearColor(float r, float g, float b, float a);
00328 
00332 extern void __attribute__((overloadable))
00333     rsgClearDepth(float value);
00337 extern void __attribute__((overloadable))
00338     rsgDrawText(const char *, int x, int y);
00342 extern void __attribute__((overloadable))
00343     rsgDrawText(rs_allocation, int x, int y);
00348 extern void __attribute__((overloadable))
00349     rsgBindFont(rs_font font);
00357 extern void __attribute__((overloadable))
00358     rsgFontColor(float r, float g, float b, float a);
00363 extern void __attribute__((overloadable))
00364     rsgMeasureText(const char *, int *left, int *right, int *top, int *bottom);
00368 extern void __attribute__((overloadable))
00369     rsgMeasureText(rs_allocation, int *left, int *right, int *top, int *bottom);
00373 extern void __attribute__((overloadable))
00374     rsgMeshComputeBoundingBox(rs_mesh mesh, float *minX, float *minY, float *minZ,
00375                                                 float *maxX, float *maxY, float *maxZ);
00379 __inline__ static void __attribute__((overloadable, always_inline))
00380 rsgMeshComputeBoundingBox(rs_mesh mesh, float3 *bBoxMin, float3 *bBoxMax) {
00381     float x1, y1, z1, x2, y2, z2;
00382     rsgMeshComputeBoundingBox(mesh, &x1, &y1, &z1, &x2, &y2, &z2);
00383     bBoxMin->x = x1;
00384     bBoxMin->y = y1;
00385     bBoxMin->z = z1;
00386     bBoxMax->x = x2;
00387     bBoxMax->y = y2;
00388     bBoxMax->z = z2;
00389 }
00390 
00391 #endif
00392