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