Alex Sakhartchouk | 9996b75 | 2011-08-09 11:36:19 -0700 | [diff] [blame] | 1 | /* |
Alex Sakhartchouk | f8e195e | 2012-03-22 10:50:55 -0700 | [diff] [blame] | 2 | * Copyright (C) 2011-2012 The Android Open Source Project |
Alex Sakhartchouk | 9996b75 | 2011-08-09 11:36:19 -0700 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | /** @file rs_graphics.rsh |
Stephen Hines | e227f9a | 2013-05-29 14:48:19 -0700 | [diff] [blame] | 18 | * \brief RenderScript graphics API |
Alex Sakhartchouk | 9996b75 | 2011-08-09 11:36:19 -0700 | [diff] [blame] | 19 | * |
Stephen Hines | e227f9a | 2013-05-29 14:48:19 -0700 | [diff] [blame] | 20 | * A set of graphics functions used by RenderScript. |
Alex Sakhartchouk | 9996b75 | 2011-08-09 11:36:19 -0700 | [diff] [blame] | 21 | * |
| 22 | */ |
Jason Sams | 1b937f5 | 2010-06-09 14:26:16 -0700 | [diff] [blame] | 23 | #ifndef __RS_GRAPHICS_RSH__ |
| 24 | #define __RS_GRAPHICS_RSH__ |
Alex Sakhartchouk | 5909d26 | 2011-11-17 15:59:13 -0800 | [diff] [blame] | 25 | |
Jason Sams | 3ff0fe7 | 2014-05-19 15:06:59 -0700 | [diff] [blame] | 26 | #ifdef __LP64__ |
| 27 | //#error "RenderScript graphics is deprecated and not supported in 64bit mode." |
| 28 | #else |
| 29 | |
Alex Sakhartchouk | f8e195e | 2012-03-22 10:50:55 -0700 | [diff] [blame] | 30 | #include "rs_mesh.rsh" |
| 31 | #include "rs_program.rsh" |
| 32 | |
Alex Sakhartchouk | 4325387 | 2011-09-28 15:23:18 -0700 | [diff] [blame] | 33 | #if (defined(RS_VERSION) && (RS_VERSION >= 14)) |
Alex Sakhartchouk | 7d9c5ff | 2011-04-01 14:19:01 -0700 | [diff] [blame] | 34 | /** |
| 35 | * Set the color target used for all subsequent rendering calls |
| 36 | * @param colorTarget |
| 37 | * @param slot |
| 38 | */ |
| 39 | extern void __attribute__((overloadable)) |
| 40 | rsgBindColorTarget(rs_allocation colorTarget, uint slot); |
| 41 | |
| 42 | /** |
| 43 | * Clear the previously set color target |
| 44 | * @param slot |
| 45 | */ |
| 46 | extern void __attribute__((overloadable)) |
| 47 | rsgClearColorTarget(uint slot); |
| 48 | |
| 49 | /** |
| 50 | * Set the depth target used for all subsequent rendering calls |
| 51 | * @param depthTarget |
| 52 | */ |
| 53 | extern void __attribute__((overloadable)) |
| 54 | rsgBindDepthTarget(rs_allocation depthTarget); |
| 55 | |
| 56 | /** |
| 57 | * Clear the previously set depth target |
| 58 | */ |
| 59 | extern void __attribute__((overloadable)) |
| 60 | rsgClearDepthTarget(void); |
| 61 | |
| 62 | /** |
| 63 | * Clear all color and depth targets and resume rendering into |
| 64 | * the framebuffer |
| 65 | */ |
| 66 | extern void __attribute__((overloadable)) |
| 67 | rsgClearAllRenderTargets(void); |
| 68 | |
| 69 | /** |
Stephen Hines | e227f9a | 2013-05-29 14:48:19 -0700 | [diff] [blame] | 70 | * Force RenderScript to finish all rendering commands |
Alex Sakhartchouk | 7d9c5ff | 2011-04-01 14:19:01 -0700 | [diff] [blame] | 71 | */ |
| 72 | extern uint __attribute__((overloadable)) |
| 73 | rsgFinish(void); |
Jason Sams | f2bcce7 | 2010-03-26 15:33:42 -0700 | [diff] [blame] | 74 | |
Alex Sakhartchouk | 4325387 | 2011-09-28 15:23:18 -0700 | [diff] [blame] | 75 | #endif //defined(RS_VERSION) && (RS_VERSION >= 14) |
| 76 | |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 77 | /** |
| 78 | * Bind a new ProgramFragment to the rendering context. |
| 79 | * |
| 80 | * @param pf |
| 81 | */ |
| 82 | extern void __attribute__((overloadable)) |
| 83 | rsgBindProgramFragment(rs_program_fragment pf); |
| 84 | |
| 85 | /** |
| 86 | * Bind a new ProgramStore to the rendering context. |
| 87 | * |
| 88 | * @param ps |
| 89 | */ |
| 90 | extern void __attribute__((overloadable)) |
| 91 | rsgBindProgramStore(rs_program_store ps); |
| 92 | |
| 93 | /** |
| 94 | * Bind a new ProgramVertex to the rendering context. |
| 95 | * |
| 96 | * @param pv |
| 97 | */ |
| 98 | extern void __attribute__((overloadable)) |
| 99 | rsgBindProgramVertex(rs_program_vertex pv); |
| 100 | |
| 101 | /** |
| 102 | * Bind a new ProgramRaster to the rendering context. |
| 103 | * |
| 104 | * @param pr |
| 105 | */ |
| 106 | extern void __attribute__((overloadable)) |
| 107 | rsgBindProgramRaster(rs_program_raster pr); |
| 108 | |
| 109 | /** |
| 110 | * Bind a new Sampler object to a ProgramFragment. The sampler will |
| 111 | * operate on the texture bound at the matching slot. |
| 112 | * |
| 113 | * @param slot |
| 114 | */ |
Jason Sams | 7349547 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 115 | extern void __attribute__((overloadable)) |
| 116 | rsgBindSampler(rs_program_fragment, uint slot, rs_sampler); |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 117 | |
| 118 | /** |
| 119 | * Bind a new Allocation object to a ProgramFragment. The |
| 120 | * Allocation must be a valid texture for the Program. The sampling |
| 121 | * of the texture will be controled by the Sampler bound at the |
| 122 | * matching slot. |
| 123 | * |
| 124 | * @param slot |
| 125 | */ |
Jason Sams | 7349547 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 126 | extern void __attribute__((overloadable)) |
| 127 | rsgBindTexture(rs_program_fragment, uint slot, rs_allocation); |
Jason Sams | 51f36ab | 2010-03-18 14:36:05 -0700 | [diff] [blame] | 128 | |
Alex Sakhartchouk | 9996b75 | 2011-08-09 11:36:19 -0700 | [diff] [blame] | 129 | /** |
| 130 | * Load the projection matrix for a currently bound fixed function |
| 131 | * vertex program. Calling this function with a custom vertex shader |
| 132 | * would result in an error. |
| 133 | * @param proj projection matrix |
| 134 | */ |
Jason Sams | 7349547 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 135 | extern void __attribute__((overloadable)) |
Alex Sakhartchouk | 9996b75 | 2011-08-09 11:36:19 -0700 | [diff] [blame] | 136 | rsgProgramVertexLoadProjectionMatrix(const rs_matrix4x4 *proj); |
| 137 | /** |
| 138 | * Load the model matrix for a currently bound fixed function |
| 139 | * vertex program. Calling this function with a custom vertex shader |
| 140 | * would result in an error. |
| 141 | * @param model model matrix |
| 142 | */ |
Jason Sams | 7349547 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 143 | extern void __attribute__((overloadable)) |
Alex Sakhartchouk | 9996b75 | 2011-08-09 11:36:19 -0700 | [diff] [blame] | 144 | rsgProgramVertexLoadModelMatrix(const rs_matrix4x4 *model); |
| 145 | /** |
| 146 | * Load the texture matrix for a currently bound fixed function |
| 147 | * vertex program. Calling this function with a custom vertex shader |
| 148 | * would result in an error. |
| 149 | * @param tex texture matrix |
| 150 | */ |
Jason Sams | 7349547 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 151 | extern void __attribute__((overloadable)) |
Alex Sakhartchouk | 9996b75 | 2011-08-09 11:36:19 -0700 | [diff] [blame] | 152 | rsgProgramVertexLoadTextureMatrix(const rs_matrix4x4 *tex); |
| 153 | /** |
| 154 | * Get the projection matrix for a currently bound fixed function |
| 155 | * vertex program. Calling this function with a custom vertex shader |
| 156 | * would result in an error. |
| 157 | * @param proj matrix to store the current projection matrix into |
| 158 | */ |
Jason Sams | 6445e52 | 2010-08-04 17:50:20 -0700 | [diff] [blame] | 159 | extern void __attribute__((overloadable)) |
Alex Sakhartchouk | 9996b75 | 2011-08-09 11:36:19 -0700 | [diff] [blame] | 160 | rsgProgramVertexGetProjectionMatrix(rs_matrix4x4 *proj); |
Alex Sakhartchouk | 95333f9 | 2010-08-16 17:40:10 -0700 | [diff] [blame] | 161 | |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 162 | /** |
| 163 | * Set the constant color for a fixed function emulation program. |
| 164 | * |
| 165 | * @param pf |
| 166 | * @param r |
| 167 | * @param g |
| 168 | * @param b |
| 169 | * @param a |
| 170 | */ |
Alex Sakhartchouk | 95333f9 | 2010-08-16 17:40:10 -0700 | [diff] [blame] | 171 | extern void __attribute__((overloadable)) |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 172 | rsgProgramFragmentConstantColor(rs_program_fragment pf, float r, float g, float b, float a); |
Jason Sams | 6445e52 | 2010-08-04 17:50:20 -0700 | [diff] [blame] | 173 | |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 174 | /** |
Alex Sakhartchouk | a720a14 | 2012-01-10 10:16:52 -0800 | [diff] [blame] | 175 | * Bind a new Allocation object to a ProgramFragment. The |
| 176 | * Allocation must be a valid constant input for the Program. |
| 177 | * |
| 178 | * @param ps program object |
| 179 | * @param slot index of the constant buffer on the program |
| 180 | * @param c constants to bind |
| 181 | */ |
| 182 | extern void __attribute__((overloadable)) |
| 183 | rsgBindConstant(rs_program_fragment ps, uint slot, rs_allocation c); |
| 184 | |
| 185 | /** |
| 186 | * Bind a new Allocation object to a ProgramVertex. The |
| 187 | * Allocation must be a valid constant input for the Program. |
| 188 | * |
| 189 | * @param pv program object |
| 190 | * @param slot index of the constant buffer on the program |
| 191 | * @param c constants to bind |
| 192 | */ |
| 193 | extern void __attribute__((overloadable)) |
| 194 | rsgBindConstant(rs_program_vertex pv, uint slot, rs_allocation c); |
| 195 | |
| 196 | /** |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 197 | * Get the width of the current rendering surface. |
| 198 | * |
| 199 | * @return uint |
| 200 | */ |
Jason Sams | 7349547 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 201 | extern uint __attribute__((overloadable)) |
| 202 | rsgGetWidth(void); |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 203 | |
| 204 | /** |
| 205 | * Get the height of the current rendering surface. |
| 206 | * |
| 207 | * @return uint |
| 208 | */ |
Jason Sams | 7349547 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 209 | extern uint __attribute__((overloadable)) |
| 210 | rsgGetHeight(void); |
Jason Sams | 51f36ab | 2010-03-18 14:36:05 -0700 | [diff] [blame] | 211 | |
Jason Sams | b7e83bd | 2010-12-15 01:41:00 -0800 | [diff] [blame] | 212 | |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 213 | /** |
| 214 | * Sync the contents of an allocation from its SCRIPT memory space to its HW |
| 215 | * memory spaces. |
| 216 | * |
| 217 | * @param alloc |
| 218 | */ |
| 219 | extern void __attribute__((overloadable)) |
| 220 | rsgAllocationSyncAll(rs_allocation alloc); |
| 221 | |
Alex Sakhartchouk | 4325387 | 2011-09-28 15:23:18 -0700 | [diff] [blame] | 222 | #if (defined(RS_VERSION) && (RS_VERSION >= 14)) |
| 223 | |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 224 | /** |
Alex Sakhartchouk | 74a8279 | 2011-06-14 11:13:19 -0700 | [diff] [blame] | 225 | * Sync the contents of an allocation from memory space |
| 226 | * specified by source. |
| 227 | * |
| 228 | * @param alloc |
| 229 | * @param source |
| 230 | */ |
| 231 | extern void __attribute__((overloadable)) |
| 232 | rsgAllocationSyncAll(rs_allocation alloc, |
| 233 | rs_allocation_usage_type source); |
| 234 | |
Alex Sakhartchouk | 4325387 | 2011-09-28 15:23:18 -0700 | [diff] [blame] | 235 | #endif //defined(RS_VERSION) && (RS_VERSION >= 14) |
| 236 | |
Alex Sakhartchouk | 74a8279 | 2011-06-14 11:13:19 -0700 | [diff] [blame] | 237 | /** |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 238 | * Low performance utility function for drawing a simple rectangle. Not |
| 239 | * intended for drawing large quantities of geometry. |
| 240 | * |
| 241 | * @param x1 |
| 242 | * @param y1 |
| 243 | * @param x2 |
| 244 | * @param y2 |
| 245 | * @param z |
| 246 | */ |
Jason Sams | b7e83bd | 2010-12-15 01:41:00 -0800 | [diff] [blame] | 247 | extern void __attribute__((overloadable)) |
Jason Sams | 7349547 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 248 | rsgDrawRect(float x1, float y1, float x2, float y2, float z); |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 249 | |
| 250 | /** |
| 251 | * Low performance utility function for drawing a simple quad. Not intended for |
| 252 | * drawing large quantities of geometry. |
| 253 | * |
| 254 | * @param x1 |
| 255 | * @param y1 |
| 256 | * @param z1 |
| 257 | * @param x2 |
| 258 | * @param y2 |
| 259 | * @param z2 |
| 260 | * @param x3 |
| 261 | * @param y3 |
| 262 | * @param z3 |
| 263 | * @param x4 |
| 264 | * @param y4 |
| 265 | * @param z4 |
| 266 | */ |
Jason Sams | 7349547 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 267 | extern void __attribute__((overloadable)) |
| 268 | rsgDrawQuad(float x1, float y1, float z1, |
| 269 | float x2, float y2, float z2, |
| 270 | float x3, float y3, float z3, |
| 271 | float x4, float y4, float z4); |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 272 | |
| 273 | |
| 274 | /** |
| 275 | * Low performance utility function for drawing a textured quad. Not intended |
| 276 | * for drawing large quantities of geometry. |
| 277 | * |
| 278 | * @param x1 |
| 279 | * @param y1 |
| 280 | * @param z1 |
| 281 | * @param u1 |
| 282 | * @param v1 |
| 283 | * @param x2 |
| 284 | * @param y2 |
| 285 | * @param z2 |
| 286 | * @param u2 |
| 287 | * @param v2 |
| 288 | * @param x3 |
| 289 | * @param y3 |
| 290 | * @param z3 |
| 291 | * @param u3 |
| 292 | * @param v3 |
| 293 | * @param x4 |
| 294 | * @param y4 |
| 295 | * @param z4 |
| 296 | * @param u4 |
| 297 | * @param v4 |
| 298 | */ |
Jason Sams | 7349547 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 299 | extern void __attribute__((overloadable)) |
| 300 | rsgDrawQuadTexCoords(float x1, float y1, float z1, float u1, float v1, |
| 301 | float x2, float y2, float z2, float u2, float v2, |
| 302 | float x3, float y3, float z3, float u3, float v3, |
| 303 | float x4, float y4, float z4, float u4, float v4); |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 304 | |
| 305 | |
| 306 | /** |
| 307 | * Low performance function for drawing rectangles in screenspace. This |
| 308 | * function uses the default passthough ProgramVertex. Any bound ProgramVertex |
| 309 | * is ignored. This function has considerable overhead and should not be used |
| 310 | * for drawing in shipping applications. |
| 311 | * |
| 312 | * @param x |
| 313 | * @param y |
| 314 | * @param z |
| 315 | * @param w |
| 316 | * @param h |
| 317 | */ |
Jason Sams | 7349547 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 318 | extern void __attribute__((overloadable)) |
| 319 | rsgDrawSpriteScreenspace(float x, float y, float z, float w, float h); |
Jason Sams | 51f36ab | 2010-03-18 14:36:05 -0700 | [diff] [blame] | 320 | |
Jason Sams | 9e0afb5 | 2011-10-31 13:23:43 -0700 | [diff] [blame] | 321 | extern void __attribute__((overloadable)) |
| 322 | rsgDrawPath(rs_path p); |
| 323 | |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 324 | /** |
Alex Sakhartchouk | 9996b75 | 2011-08-09 11:36:19 -0700 | [diff] [blame] | 325 | * Draw a mesh using the current context state. The whole mesh is |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 326 | * rendered. |
| 327 | * |
| 328 | * @param ism |
| 329 | */ |
Jason Sams | 7349547 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 330 | extern void __attribute__((overloadable)) |
| 331 | rsgDrawMesh(rs_mesh ism); |
Alex Sakhartchouk | 9996b75 | 2011-08-09 11:36:19 -0700 | [diff] [blame] | 332 | /** |
| 333 | * Draw part of a mesh using the current context state. |
| 334 | * @param ism mesh object to render |
| 335 | * @param primitiveIndex for meshes that contain multiple primitive groups |
| 336 | * this parameter specifies the index of the group to draw. |
| 337 | */ |
Jason Sams | 7349547 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 338 | extern void __attribute__((overloadable)) |
| 339 | rsgDrawMesh(rs_mesh ism, uint primitiveIndex); |
Alex Sakhartchouk | 9996b75 | 2011-08-09 11:36:19 -0700 | [diff] [blame] | 340 | /** |
| 341 | * Draw specified index range of part of a mesh using the current context state. |
| 342 | * @param ism mesh object to render |
| 343 | * @param primitiveIndex for meshes that contain multiple primitive groups |
| 344 | * this parameter specifies the index of the group to draw. |
| 345 | * @param start starting index in the range |
| 346 | * @param len number of indices to draw |
| 347 | */ |
Jason Sams | 7349547 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 348 | extern void __attribute__((overloadable)) |
| 349 | rsgDrawMesh(rs_mesh ism, uint primitiveIndex, uint start, uint len); |
Alex Sakhartchouk | 4e9a7a8 | 2010-07-01 16:14:06 -0700 | [diff] [blame] | 350 | |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 351 | /** |
| 352 | * Clears the rendering surface to the specified color. |
| 353 | * |
| 354 | * @param r |
| 355 | * @param g |
| 356 | * @param b |
| 357 | * @param a |
| 358 | */ |
Jason Sams | 7349547 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 359 | extern void __attribute__((overloadable)) |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 360 | rsgClearColor(float r, float g, float b, float a); |
| 361 | |
| 362 | /** |
| 363 | * Clears the depth suface to the specified value. |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 364 | */ |
Jason Sams | 7349547 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 365 | extern void __attribute__((overloadable)) |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 366 | rsgClearDepth(float value); |
Alex Sakhartchouk | 9996b75 | 2011-08-09 11:36:19 -0700 | [diff] [blame] | 367 | /** |
| 368 | * Draws text given a string and location |
| 369 | */ |
Jason Sams | 7349547 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 370 | extern void __attribute__((overloadable)) |
| 371 | rsgDrawText(const char *, int x, int y); |
Alex Sakhartchouk | 9996b75 | 2011-08-09 11:36:19 -0700 | [diff] [blame] | 372 | /** |
| 373 | * \overload |
| 374 | */ |
Jason Sams | 7349547 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 375 | extern void __attribute__((overloadable)) |
| 376 | rsgDrawText(rs_allocation, int x, int y); |
Alex Sakhartchouk | 9996b75 | 2011-08-09 11:36:19 -0700 | [diff] [blame] | 377 | /** |
| 378 | * Binds the font object to be used for all subsequent font rendering calls |
| 379 | * @param font object to bind |
| 380 | */ |
Jason Sams | 7349547 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 381 | extern void __attribute__((overloadable)) |
Alex Sakhartchouk | 9996b75 | 2011-08-09 11:36:19 -0700 | [diff] [blame] | 382 | rsgBindFont(rs_font font); |
| 383 | /** |
| 384 | * Sets the font color for all subsequent rendering calls |
| 385 | * @param r red component |
| 386 | * @param g green component |
| 387 | * @param b blue component |
| 388 | * @param a alpha component |
| 389 | */ |
Alex Sakhartchouk | 9fc9f03 | 2010-08-04 14:45:48 -0700 | [diff] [blame] | 390 | extern void __attribute__((overloadable)) |
Alex Sakhartchouk | 9996b75 | 2011-08-09 11:36:19 -0700 | [diff] [blame] | 391 | rsgFontColor(float r, float g, float b, float a); |
| 392 | /** |
| 393 | * Returns the bounding box of the text relative to (0, 0) |
| 394 | * Any of left, right, top, bottom could be NULL |
| 395 | */ |
Alex Sakhartchouk | 09c6735 | 2010-10-05 11:33:27 -0700 | [diff] [blame] | 396 | extern void __attribute__((overloadable)) |
| 397 | rsgMeasureText(const char *, int *left, int *right, int *top, int *bottom); |
Alex Sakhartchouk | 9996b75 | 2011-08-09 11:36:19 -0700 | [diff] [blame] | 398 | /** |
| 399 | * \overload |
| 400 | */ |
Alex Sakhartchouk | 09c6735 | 2010-10-05 11:33:27 -0700 | [diff] [blame] | 401 | extern void __attribute__((overloadable)) |
| 402 | rsgMeasureText(rs_allocation, int *left, int *right, int *top, int *bottom); |
Alex Sakhartchouk | 9996b75 | 2011-08-09 11:36:19 -0700 | [diff] [blame] | 403 | /** |
| 404 | * Computes an axis aligned bounding box of a mesh object |
| 405 | */ |
Alex Sakhartchouk | ba4aa5c | 2010-08-13 14:32:23 -0700 | [diff] [blame] | 406 | extern void __attribute__((overloadable)) |
| 407 | rsgMeshComputeBoundingBox(rs_mesh mesh, float *minX, float *minY, float *minZ, |
| 408 | float *maxX, float *maxY, float *maxZ); |
Alex Sakhartchouk | 9996b75 | 2011-08-09 11:36:19 -0700 | [diff] [blame] | 409 | /** |
| 410 | * \overload |
| 411 | */ |
Jason Sams | 399dc9e | 2010-10-15 17:57:07 -0700 | [diff] [blame] | 412 | __inline__ static void __attribute__((overloadable, always_inline)) |
Alex Sakhartchouk | ba4aa5c | 2010-08-13 14:32:23 -0700 | [diff] [blame] | 413 | rsgMeshComputeBoundingBox(rs_mesh mesh, float3 *bBoxMin, float3 *bBoxMax) { |
| 414 | float x1, y1, z1, x2, y2, z2; |
| 415 | rsgMeshComputeBoundingBox(mesh, &x1, &y1, &z1, &x2, &y2, &z2); |
| 416 | bBoxMin->x = x1; |
| 417 | bBoxMin->y = y1; |
| 418 | bBoxMin->z = z1; |
| 419 | bBoxMax->x = x2; |
| 420 | bBoxMax->y = y2; |
| 421 | bBoxMax->z = z2; |
| 422 | } |
| 423 | |
Jason Sams | 3ff0fe7 | 2014-05-19 15:06:59 -0700 | [diff] [blame] | 424 | #endif //__LP64__ |
Jason Sams | 1b937f5 | 2010-06-09 14:26:16 -0700 | [diff] [blame] | 425 | #endif |
Jason Sams | 51f36ab | 2010-03-18 14:36:05 -0700 | [diff] [blame] | 426 | |