blob: 7fdebdcd0468d1c4ffb931faad03a3586068d1e6 [file] [log] [blame]
Alex Sakhartchouk9996b752011-08-09 11:36:19 -07001/*
2 * Copyright (C) 2011 The Android Open Source Project
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 Sams1b937f52010-06-09 14:26:16 -070023#ifndef __RS_GRAPHICS_RSH__
24#define __RS_GRAPHICS_RSH__
Alex Sakhartchouk5909d262011-11-17 15:59:13 -080025
26// These are API 15 once it get official
27typedef enum {
28 RS_DEPTH_FUNC_ALWAYS,
29 RS_DEPTH_FUNC_LESS,
30 RS_DEPTH_FUNC_LEQUAL,
31 RS_DEPTH_FUNC_GREATER,
32 RS_DEPTH_FUNC_GEQUAL,
33 RS_DEPTH_FUNC_EQUAL,
Alex Sakhartchouk25a59d02011-12-29 11:17:38 -080034 RS_DEPTH_FUNC_NOTEQUAL,
35
36 RS_DEPTH_FUNC_INVALID = 100,
Alex Sakhartchouk5909d262011-11-17 15:59:13 -080037} rs_depth_func;
38
39typedef enum {
40 RS_BLEND_SRC_ZERO, // 0
41 RS_BLEND_SRC_ONE, // 1
42 RS_BLEND_SRC_DST_COLOR, // 2
43 RS_BLEND_SRC_ONE_MINUS_DST_COLOR, // 3
44 RS_BLEND_SRC_SRC_ALPHA, // 4
45 RS_BLEND_SRC_ONE_MINUS_SRC_ALPHA, // 5
46 RS_BLEND_SRC_DST_ALPHA, // 6
47 RS_BLEND_SRC_ONE_MINUS_DST_ALPHA, // 7
Alex Sakhartchouk25a59d02011-12-29 11:17:38 -080048 RS_BLEND_SRC_SRC_ALPHA_SATURATE, // 8
49
50 RS_BLEND_SRC_INVALID = 100,
Alex Sakhartchouk5909d262011-11-17 15:59:13 -080051} rs_blend_src_func;
52
53typedef enum {
54 RS_BLEND_DST_ZERO, // 0
55 RS_BLEND_DST_ONE, // 1
56 RS_BLEND_DST_SRC_COLOR, // 2
57 RS_BLEND_DST_ONE_MINUS_SRC_COLOR, // 3
58 RS_BLEND_DST_SRC_ALPHA, // 4
59 RS_BLEND_DST_ONE_MINUS_SRC_ALPHA, // 5
60 RS_BLEND_DST_DST_ALPHA, // 6
Alex Sakhartchouk25a59d02011-12-29 11:17:38 -080061 RS_BLEND_DST_ONE_MINUS_DST_ALPHA, // 7
62
63 RS_BLEND_DST_INVALID = 100,
Alex Sakhartchouk5909d262011-11-17 15:59:13 -080064} rs_blend_dst_func;
65
66typedef enum {
67 RS_CULL_BACK,
68 RS_CULL_FRONT,
Alex Sakhartchouk25a59d02011-12-29 11:17:38 -080069 RS_CULL_NONE,
70
71 RS_CULL_INVALID = 100,
Alex Sakhartchouk5909d262011-11-17 15:59:13 -080072} rs_cull_mode;
73
74typedef enum {
75 RS_SAMPLER_NEAREST,
76 RS_SAMPLER_LINEAR,
77 RS_SAMPLER_LINEAR_MIP_LINEAR,
78 RS_SAMPLER_WRAP,
79 RS_SAMPLER_CLAMP,
80 RS_SAMPLER_LINEAR_MIP_NEAREST,
Alex Sakhartchouk25a59d02011-12-29 11:17:38 -080081
82 RS_SAMPLER_INVALID = 100,
Alex Sakhartchouk5909d262011-11-17 15:59:13 -080083} rs_sampler_value;
84
Alex Sakhartchouk43253872011-09-28 15:23:18 -070085#if (defined(RS_VERSION) && (RS_VERSION >= 14))
Alex Sakhartchouk7d9c5ff2011-04-01 14:19:01 -070086/**
87 * Set the color target used for all subsequent rendering calls
88 * @param colorTarget
89 * @param slot
90 */
91extern void __attribute__((overloadable))
92 rsgBindColorTarget(rs_allocation colorTarget, uint slot);
93
94/**
95 * Clear the previously set color target
96 * @param slot
97 */
98extern void __attribute__((overloadable))
99 rsgClearColorTarget(uint slot);
100
101/**
102 * Set the depth target used for all subsequent rendering calls
103 * @param depthTarget
104 */
105extern void __attribute__((overloadable))
106 rsgBindDepthTarget(rs_allocation depthTarget);
107
108/**
109 * Clear the previously set depth target
110 */
111extern void __attribute__((overloadable))
112 rsgClearDepthTarget(void);
113
114/**
115 * Clear all color and depth targets and resume rendering into
116 * the framebuffer
117 */
118extern void __attribute__((overloadable))
119 rsgClearAllRenderTargets(void);
120
121/**
Alex Sakhartchouk9996b752011-08-09 11:36:19 -0700122 * Force Renderscript to finish all rendering commands
Alex Sakhartchouk7d9c5ff2011-04-01 14:19:01 -0700123 */
124extern uint __attribute__((overloadable))
125 rsgFinish(void);
Jason Samsf2bcce72010-03-26 15:33:42 -0700126
Alex Sakhartchouk43253872011-09-28 15:23:18 -0700127#endif //defined(RS_VERSION) && (RS_VERSION >= 14)
128
Jason Sams09aeb8a2011-01-28 15:49:07 -0800129/**
130 * Bind a new ProgramFragment to the rendering context.
131 *
132 * @param pf
133 */
134extern void __attribute__((overloadable))
135 rsgBindProgramFragment(rs_program_fragment pf);
136
137/**
138 * Bind a new ProgramStore to the rendering context.
139 *
140 * @param ps
141 */
142extern void __attribute__((overloadable))
143 rsgBindProgramStore(rs_program_store ps);
144
Alex Sakhartchouk5909d262011-11-17 15:59:13 -0800145
146/**
147 * @hide
148 * Get program store depth function
149 *
150 * @param ps
151 */
152extern rs_depth_func __attribute__((overloadable))
153 rsgProgramStoreGetDepthFunc(rs_program_store ps);
154
155/**
156 * @hide
157 * Get program store depth mask
158 *
159 * @param ps
160 */
161extern bool __attribute__((overloadable))
162 rsgProgramStoreGetDepthMask(rs_program_store ps);
163/**
164 * @hide
165 * Get program store red component color mask
166 *
167 * @param ps
168 */
169extern bool __attribute__((overloadable))
170 rsgProgramStoreGetColorMaskR(rs_program_store ps);
171
172/**
173 * @hide
174 * Get program store green component color mask
175 *
176 * @param ps
177 */
178extern bool __attribute__((overloadable))
179 rsgProgramStoreGetColorMaskG(rs_program_store ps);
180
181/**
182 * @hide
183 * Get program store blur component color mask
184 *
185 * @param ps
186 */
187extern bool __attribute__((overloadable))
188 rsgProgramStoreGetColorMaskB(rs_program_store ps);
189
190/**
191 * @hide
192 * Get program store alpha component color mask
193 *
194 * @param ps
195 */
196extern bool __attribute__((overloadable))
197 rsgProgramStoreGetColorMaskA(rs_program_store ps);
198
199/**
200 * @hide
201 * Get program store blend source function
202 *
203 * @param ps
204 */
205extern rs_blend_src_func __attribute__((overloadable))
206 rsgProgramStoreGetBlendSrcFunc(rs_program_store ps);
207
208/**
209 * @hide
210 * Get program store blend destination function
211 *
212 * @param ps
213 */
214extern rs_blend_dst_func __attribute__((overloadable))
215 rsgProgramStoreGetBlendDstFunc(rs_program_store ps);
216
217/**
218 * @hide
219 * Get program store dither state
220 *
221 * @param ps
222 */
223extern bool __attribute__((overloadable))
224 rsgProgramStoreGetDitherEnabled(rs_program_store ps);
225
226
Jason Sams09aeb8a2011-01-28 15:49:07 -0800227/**
228 * Bind a new ProgramVertex to the rendering context.
229 *
230 * @param pv
231 */
232extern void __attribute__((overloadable))
233 rsgBindProgramVertex(rs_program_vertex pv);
234
235/**
236 * Bind a new ProgramRaster to the rendering context.
237 *
238 * @param pr
239 */
240extern void __attribute__((overloadable))
241 rsgBindProgramRaster(rs_program_raster pr);
242
243/**
Alex Sakhartchouk5909d262011-11-17 15:59:13 -0800244 * @hide
245 * Get program raster point sprite state
246 *
247 * @param pr
248 */
249extern bool __attribute__((overloadable))
250 rsgProgramRasterGetPointSpriteEnabled(rs_program_raster pr);
251
252/**
253 * @hide
254 * Get program raster cull mode
255 *
256 * @param pr
257 */
258extern rs_cull_mode __attribute__((overloadable))
259 rsgProgramRasterGetCullMode(rs_program_raster pr);
260
261/**
Jason Sams09aeb8a2011-01-28 15:49:07 -0800262 * Bind a new Sampler object to a ProgramFragment. The sampler will
263 * operate on the texture bound at the matching slot.
264 *
265 * @param slot
266 */
Jason Sams73495472010-07-29 17:31:14 -0700267extern void __attribute__((overloadable))
268 rsgBindSampler(rs_program_fragment, uint slot, rs_sampler);
Jason Sams09aeb8a2011-01-28 15:49:07 -0800269
270/**
Alex Sakhartchouk5909d262011-11-17 15:59:13 -0800271 * @hide
272 * Get sampler minification value
273 *
274 * @param pr
275 */
276extern rs_sampler_value __attribute__((overloadable))
277 rsgSamplerGetMinification(rs_sampler s);
278
279/**
280 * @hide
281 * Get sampler magnification value
282 *
283 * @param pr
284 */
285extern rs_sampler_value __attribute__((overloadable))
286 rsgSamplerGetMagnification(rs_sampler s);
287
288/**
289 * @hide
290 * Get sampler wrap S value
291 *
292 * @param pr
293 */
294extern rs_sampler_value __attribute__((overloadable))
295 rsgSamplerGetWrapS(rs_sampler s);
296
297/**
298 * @hide
299 * Get sampler wrap T value
300 *
301 * @param pr
302 */
303extern rs_sampler_value __attribute__((overloadable))
304 rsgSamplerGetWrapT(rs_sampler s);
305
306/**
307 * @hide
308 * Get sampler anisotropy
309 *
310 * @param pr
311 */
312extern float __attribute__((overloadable))
313 rsgSamplerGetAnisotropy(rs_sampler s);
314
315/**
Jason Sams09aeb8a2011-01-28 15:49:07 -0800316 * Bind a new Allocation object to a ProgramFragment. The
317 * Allocation must be a valid texture for the Program. The sampling
318 * of the texture will be controled by the Sampler bound at the
319 * matching slot.
320 *
321 * @param slot
322 */
Jason Sams73495472010-07-29 17:31:14 -0700323extern void __attribute__((overloadable))
324 rsgBindTexture(rs_program_fragment, uint slot, rs_allocation);
Jason Sams51f36ab2010-03-18 14:36:05 -0700325
Alex Sakhartchouk9996b752011-08-09 11:36:19 -0700326/**
327 * Load the projection matrix for a currently bound fixed function
328 * vertex program. Calling this function with a custom vertex shader
329 * would result in an error.
330 * @param proj projection matrix
331 */
Jason Sams73495472010-07-29 17:31:14 -0700332extern void __attribute__((overloadable))
Alex Sakhartchouk9996b752011-08-09 11:36:19 -0700333 rsgProgramVertexLoadProjectionMatrix(const rs_matrix4x4 *proj);
334/**
335 * Load the model matrix for a currently bound fixed function
336 * vertex program. Calling this function with a custom vertex shader
337 * would result in an error.
338 * @param model model matrix
339 */
Jason Sams73495472010-07-29 17:31:14 -0700340extern void __attribute__((overloadable))
Alex Sakhartchouk9996b752011-08-09 11:36:19 -0700341 rsgProgramVertexLoadModelMatrix(const rs_matrix4x4 *model);
342/**
343 * Load the texture matrix for a currently bound fixed function
344 * vertex program. Calling this function with a custom vertex shader
345 * would result in an error.
346 * @param tex texture matrix
347 */
Jason Sams73495472010-07-29 17:31:14 -0700348extern void __attribute__((overloadable))
Alex Sakhartchouk9996b752011-08-09 11:36:19 -0700349 rsgProgramVertexLoadTextureMatrix(const rs_matrix4x4 *tex);
350/**
351 * Get the projection matrix for a currently bound fixed function
352 * vertex program. Calling this function with a custom vertex shader
353 * would result in an error.
354 * @param proj matrix to store the current projection matrix into
355 */
Jason Sams6445e522010-08-04 17:50:20 -0700356extern void __attribute__((overloadable))
Alex Sakhartchouk9996b752011-08-09 11:36:19 -0700357 rsgProgramVertexGetProjectionMatrix(rs_matrix4x4 *proj);
Alex Sakhartchouk95333f92010-08-16 17:40:10 -0700358
Jason Sams09aeb8a2011-01-28 15:49:07 -0800359/**
360 * Set the constant color for a fixed function emulation program.
361 *
362 * @param pf
363 * @param r
364 * @param g
365 * @param b
366 * @param a
367 */
Alex Sakhartchouk95333f92010-08-16 17:40:10 -0700368extern void __attribute__((overloadable))
Jason Sams09aeb8a2011-01-28 15:49:07 -0800369 rsgProgramFragmentConstantColor(rs_program_fragment pf, float r, float g, float b, float a);
Jason Sams6445e522010-08-04 17:50:20 -0700370
Jason Sams09aeb8a2011-01-28 15:49:07 -0800371/**
Alex Sakhartchouka720a142012-01-10 10:16:52 -0800372 * Bind a new Allocation object to a ProgramFragment. The
373 * Allocation must be a valid constant input for the Program.
374 *
375 * @param ps program object
376 * @param slot index of the constant buffer on the program
377 * @param c constants to bind
378 */
379extern void __attribute__((overloadable))
380 rsgBindConstant(rs_program_fragment ps, uint slot, rs_allocation c);
381
382/**
383 * Bind a new Allocation object to a ProgramVertex. The
384 * Allocation must be a valid constant input for the Program.
385 *
386 * @param pv program object
387 * @param slot index of the constant buffer on the program
388 * @param c constants to bind
389 */
390extern void __attribute__((overloadable))
391 rsgBindConstant(rs_program_vertex pv, uint slot, rs_allocation c);
392
393/**
Jason Sams09aeb8a2011-01-28 15:49:07 -0800394 * Get the width of the current rendering surface.
395 *
396 * @return uint
397 */
Jason Sams73495472010-07-29 17:31:14 -0700398extern uint __attribute__((overloadable))
399 rsgGetWidth(void);
Jason Sams09aeb8a2011-01-28 15:49:07 -0800400
401/**
402 * Get the height of the current rendering surface.
403 *
404 * @return uint
405 */
Jason Sams73495472010-07-29 17:31:14 -0700406extern uint __attribute__((overloadable))
407 rsgGetHeight(void);
Jason Sams51f36ab2010-03-18 14:36:05 -0700408
Jason Samsb7e83bd2010-12-15 01:41:00 -0800409
Jason Sams09aeb8a2011-01-28 15:49:07 -0800410/**
411 * Sync the contents of an allocation from its SCRIPT memory space to its HW
412 * memory spaces.
413 *
414 * @param alloc
415 */
416extern void __attribute__((overloadable))
417 rsgAllocationSyncAll(rs_allocation alloc);
418
Alex Sakhartchouk43253872011-09-28 15:23:18 -0700419#if (defined(RS_VERSION) && (RS_VERSION >= 14))
420
Jason Sams09aeb8a2011-01-28 15:49:07 -0800421/**
Alex Sakhartchouk74a82792011-06-14 11:13:19 -0700422 * Sync the contents of an allocation from memory space
423 * specified by source.
424 *
425 * @param alloc
426 * @param source
427 */
428extern void __attribute__((overloadable))
429 rsgAllocationSyncAll(rs_allocation alloc,
430 rs_allocation_usage_type source);
431
Alex Sakhartchouk43253872011-09-28 15:23:18 -0700432#endif //defined(RS_VERSION) && (RS_VERSION >= 14)
433
Alex Sakhartchouk74a82792011-06-14 11:13:19 -0700434/**
Jason Sams09aeb8a2011-01-28 15:49:07 -0800435 * Low performance utility function for drawing a simple rectangle. Not
436 * intended for drawing large quantities of geometry.
437 *
438 * @param x1
439 * @param y1
440 * @param x2
441 * @param y2
442 * @param z
443 */
Jason Samsb7e83bd2010-12-15 01:41:00 -0800444extern void __attribute__((overloadable))
Jason Sams73495472010-07-29 17:31:14 -0700445 rsgDrawRect(float x1, float y1, float x2, float y2, float z);
Jason Sams09aeb8a2011-01-28 15:49:07 -0800446
447/**
448 * Low performance utility function for drawing a simple quad. Not intended for
449 * drawing large quantities of geometry.
450 *
451 * @param x1
452 * @param y1
453 * @param z1
454 * @param x2
455 * @param y2
456 * @param z2
457 * @param x3
458 * @param y3
459 * @param z3
460 * @param x4
461 * @param y4
462 * @param z4
463 */
Jason Sams73495472010-07-29 17:31:14 -0700464extern void __attribute__((overloadable))
465 rsgDrawQuad(float x1, float y1, float z1,
466 float x2, float y2, float z2,
467 float x3, float y3, float z3,
468 float x4, float y4, float z4);
Jason Sams09aeb8a2011-01-28 15:49:07 -0800469
470
471/**
472 * Low performance utility function for drawing a textured quad. Not intended
473 * for drawing large quantities of geometry.
474 *
475 * @param x1
476 * @param y1
477 * @param z1
478 * @param u1
479 * @param v1
480 * @param x2
481 * @param y2
482 * @param z2
483 * @param u2
484 * @param v2
485 * @param x3
486 * @param y3
487 * @param z3
488 * @param u3
489 * @param v3
490 * @param x4
491 * @param y4
492 * @param z4
493 * @param u4
494 * @param v4
495 */
Jason Sams73495472010-07-29 17:31:14 -0700496extern void __attribute__((overloadable))
497 rsgDrawQuadTexCoords(float x1, float y1, float z1, float u1, float v1,
498 float x2, float y2, float z2, float u2, float v2,
499 float x3, float y3, float z3, float u3, float v3,
500 float x4, float y4, float z4, float u4, float v4);
Jason Sams09aeb8a2011-01-28 15:49:07 -0800501
502
503/**
504 * Low performance function for drawing rectangles in screenspace. This
505 * function uses the default passthough ProgramVertex. Any bound ProgramVertex
506 * is ignored. This function has considerable overhead and should not be used
507 * for drawing in shipping applications.
508 *
509 * @param x
510 * @param y
511 * @param z
512 * @param w
513 * @param h
514 */
Jason Sams73495472010-07-29 17:31:14 -0700515extern void __attribute__((overloadable))
516 rsgDrawSpriteScreenspace(float x, float y, float z, float w, float h);
Jason Sams51f36ab2010-03-18 14:36:05 -0700517
Jason Sams9e0afb52011-10-31 13:23:43 -0700518extern void __attribute__((overloadable))
519 rsgDrawPath(rs_path p);
520
Jason Sams09aeb8a2011-01-28 15:49:07 -0800521/**
Alex Sakhartchouk9996b752011-08-09 11:36:19 -0700522 * Draw a mesh using the current context state. The whole mesh is
Jason Sams09aeb8a2011-01-28 15:49:07 -0800523 * rendered.
524 *
525 * @param ism
526 */
Jason Sams73495472010-07-29 17:31:14 -0700527extern void __attribute__((overloadable))
528 rsgDrawMesh(rs_mesh ism);
Alex Sakhartchouk9996b752011-08-09 11:36:19 -0700529/**
530 * Draw part of a mesh using the current context state.
531 * @param ism mesh object to render
532 * @param primitiveIndex for meshes that contain multiple primitive groups
533 * this parameter specifies the index of the group to draw.
534 */
Jason Sams73495472010-07-29 17:31:14 -0700535extern void __attribute__((overloadable))
536 rsgDrawMesh(rs_mesh ism, uint primitiveIndex);
Alex Sakhartchouk9996b752011-08-09 11:36:19 -0700537/**
538 * Draw specified index range of part of a mesh using the current context state.
539 * @param ism mesh object to render
540 * @param primitiveIndex for meshes that contain multiple primitive groups
541 * this parameter specifies the index of the group to draw.
542 * @param start starting index in the range
543 * @param len number of indices to draw
544 */
Jason Sams73495472010-07-29 17:31:14 -0700545extern void __attribute__((overloadable))
546 rsgDrawMesh(rs_mesh ism, uint primitiveIndex, uint start, uint len);
Alex Sakhartchouk4e9a7a82010-07-01 16:14:06 -0700547
Jason Sams09aeb8a2011-01-28 15:49:07 -0800548/**
549 * Clears the rendering surface to the specified color.
550 *
551 * @param r
552 * @param g
553 * @param b
554 * @param a
555 */
Jason Sams73495472010-07-29 17:31:14 -0700556extern void __attribute__((overloadable))
Jason Sams09aeb8a2011-01-28 15:49:07 -0800557 rsgClearColor(float r, float g, float b, float a);
558
559/**
560 * Clears the depth suface to the specified value.
Jason Sams09aeb8a2011-01-28 15:49:07 -0800561 */
Jason Sams73495472010-07-29 17:31:14 -0700562extern void __attribute__((overloadable))
Jason Sams09aeb8a2011-01-28 15:49:07 -0800563 rsgClearDepth(float value);
Alex Sakhartchouk9996b752011-08-09 11:36:19 -0700564/**
565 * Draws text given a string and location
566 */
Jason Sams73495472010-07-29 17:31:14 -0700567extern void __attribute__((overloadable))
568 rsgDrawText(const char *, int x, int y);
Alex Sakhartchouk9996b752011-08-09 11:36:19 -0700569/**
570 * \overload
571 */
Jason Sams73495472010-07-29 17:31:14 -0700572extern void __attribute__((overloadable))
573 rsgDrawText(rs_allocation, int x, int y);
Alex Sakhartchouk9996b752011-08-09 11:36:19 -0700574/**
575 * Binds the font object to be used for all subsequent font rendering calls
576 * @param font object to bind
577 */
Jason Sams73495472010-07-29 17:31:14 -0700578extern void __attribute__((overloadable))
Alex Sakhartchouk9996b752011-08-09 11:36:19 -0700579 rsgBindFont(rs_font font);
580/**
581 * Sets the font color for all subsequent rendering calls
582 * @param r red component
583 * @param g green component
584 * @param b blue component
585 * @param a alpha component
586 */
Alex Sakhartchouk9fc9f032010-08-04 14:45:48 -0700587extern void __attribute__((overloadable))
Alex Sakhartchouk9996b752011-08-09 11:36:19 -0700588 rsgFontColor(float r, float g, float b, float a);
589/**
590 * Returns the bounding box of the text relative to (0, 0)
591 * Any of left, right, top, bottom could be NULL
592 */
Alex Sakhartchouk09c67352010-10-05 11:33:27 -0700593extern void __attribute__((overloadable))
594 rsgMeasureText(const char *, int *left, int *right, int *top, int *bottom);
Alex Sakhartchouk9996b752011-08-09 11:36:19 -0700595/**
596 * \overload
597 */
Alex Sakhartchouk09c67352010-10-05 11:33:27 -0700598extern void __attribute__((overloadable))
599 rsgMeasureText(rs_allocation, int *left, int *right, int *top, int *bottom);
Alex Sakhartchouk9996b752011-08-09 11:36:19 -0700600/**
601 * Computes an axis aligned bounding box of a mesh object
602 */
Alex Sakhartchoukba4aa5c2010-08-13 14:32:23 -0700603extern void __attribute__((overloadable))
604 rsgMeshComputeBoundingBox(rs_mesh mesh, float *minX, float *minY, float *minZ,
605 float *maxX, float *maxY, float *maxZ);
Alex Sakhartchouk9996b752011-08-09 11:36:19 -0700606/**
607 * \overload
608 */
Jason Sams399dc9e2010-10-15 17:57:07 -0700609__inline__ static void __attribute__((overloadable, always_inline))
Alex Sakhartchoukba4aa5c2010-08-13 14:32:23 -0700610rsgMeshComputeBoundingBox(rs_mesh mesh, float3 *bBoxMin, float3 *bBoxMax) {
611 float x1, y1, z1, x2, y2, z2;
612 rsgMeshComputeBoundingBox(mesh, &x1, &y1, &z1, &x2, &y2, &z2);
613 bBoxMin->x = x1;
614 bBoxMin->y = y1;
615 bBoxMin->z = z1;
616 bBoxMax->x = x2;
617 bBoxMax->y = y2;
618 bBoxMax->z = z2;
619}
620
Jason Sams1b937f52010-06-09 14:26:16 -0700621#endif
Jason Sams51f36ab2010-03-18 14:36:05 -0700622