amino
Lightweight Robot Utility Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
scene_geom.h
Go to the documentation of this file.
1 /* -*- mode: C; c-basic-offset: 4; -*- */
2 /* ex: set shiftwidth=4 tabstop=4 expandtab: */
3 /*
4  * Copyright (c) 2015, Rice University
5  * All rights reserved.
6  *
7  * Author(s): Neil T. Dantam <ntd@rice.edu>
8  *
9  * Redistribution and use in source and binary forms, with or
10  * without modification, are permitted provided that the following
11  * conditions are met:
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * * Neither the name of copyright holder the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
23  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
24  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
27  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
30  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
31  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  */
37 
38 #ifndef AMINO_RX_SCENE_GEOM_H
39 #define AMINO_RX_SCENE_GEOM_H
40 
45 /*-----------*/
46 /*- Options -*/
47 /*-----------*/
48 
55 struct aa_rx_geom_opt;
56 
60 AA_API struct aa_rx_geom_opt*
62 
66 AA_API void
67 aa_rx_geom_opt_destroy(struct aa_rx_geom_opt*);
68 
72 AA_API void
74  struct aa_rx_geom_opt *opt,
75  int no_shadow );
76 
80 AA_API int
81 aa_rx_geom_opt_get_no_shadow ( struct aa_rx_geom_opt *opt );
82 
86 AA_API int
87 aa_rx_geom_opt_get_visual ( struct aa_rx_geom_opt *opt );
88 
92 AA_API int
93 aa_rx_geom_opt_get_collision ( struct aa_rx_geom_opt *opt );
94 
98 AA_API double
99 aa_rx_geom_opt_get_color_red ( struct aa_rx_geom_opt *opt );
100 
104 AA_API double
105 aa_rx_geom_opt_get_color_blue ( struct aa_rx_geom_opt *opt );
106 
107 
111 AA_API double
112 aa_rx_geom_opt_get_color_green ( struct aa_rx_geom_opt *opt );
113 
117 AA_API double
118 aa_rx_geom_opt_get_alpha ( struct aa_rx_geom_opt *opt );
119 
123 AA_API double
124 aa_rx_geom_opt_get_specular_red ( struct aa_rx_geom_opt *opt );
125 
129 AA_API double
130 aa_rx_geom_opt_get_specular_blue ( struct aa_rx_geom_opt *opt );
131 
135 AA_API double
136 aa_rx_geom_opt_get_specular_green ( struct aa_rx_geom_opt *opt );
137 
141 AA_API void
143  struct aa_rx_geom_opt *opt,
144  double red, double blue, double green );
145 
149 AA_API void
151  struct aa_rx_geom_opt *opt,
152  double alpha );
153 
159 AA_API void
161  struct aa_rx_geom_opt *opt,
162  int visual );
163 
169 AA_API void
171  struct aa_rx_geom_opt *opt,
172  int collision );
173 
177 AA_API void
179  struct aa_rx_geom_opt *opt,
180  double red, double green, double blue );
181 
182 
186 AA_API void
188  struct aa_rx_geom_opt *opt,
189  double scale );
190 
194 AA_API double
196  const struct aa_rx_geom_opt *opt );
197 
198 /*----------*/
199 /*- Shapes -*/
200 /*----------*/
201 
202 
206 AA_API struct aa_rx_geom *
207 aa_rx_geom_copy( struct aa_rx_geom *src );
208 
212 AA_API void
213 aa_rx_geom_destroy( struct aa_rx_geom *geom );
214 
226 };
227 
231 AA_API const char *aa_rx_geom_shape_str( enum aa_rx_geom_shape shape );
232 
237  double dimension[3];
238 };
239 
244  double radius;
245 };
246 
251  double height;
252  double radius;
253 };
254 
259  double height;
260  double start_radius;
261  double end_radius;
262 };
263 
264 
269  double dimension[2];
270  double delta[2];
271  double width;
272 };
273 
283 AA_API void *
284 aa_rx_geom_shape ( const struct aa_rx_geom *g,
285  enum aa_rx_geom_shape *shape_type );
286 
290 AA_API struct aa_rx_geom *
292  struct aa_rx_geom_opt *opt,
293  const double dimension[3] );
294 
298 AA_API struct aa_rx_geom *
300  struct aa_rx_geom_opt *opt,
301  double radius );
302 
306 AA_API struct aa_rx_geom *
308  struct aa_rx_geom_opt *opt,
309  double height,
310  double radius );
311 
315 AA_API struct aa_rx_geom *
317  struct aa_rx_geom_opt *opt,
318  double height,
319  double start_radius,
320  double end_radius );
321 
325 AA_API struct aa_rx_geom *
327  struct aa_rx_geom_opt *opt,
328  const double dimension[2],
329  const double delta[2],
330  double width );
331 
335 struct aa_rx_mesh;
336 
340 AA_API struct aa_rx_mesh* aa_rx_mesh_create();
341 
345 AA_API void aa_rx_mesh_destroy( struct aa_rx_mesh * mesh );
346 
351  struct aa_rx_mesh *mesh, size_t n,
352  const float *vectors, int copy );
353 
358  struct aa_rx_mesh *mesh, size_t n,
359  const float *normals, int copy );
360 
365  struct aa_rx_mesh *mesh, size_t n,
366  const unsigned *indices, int copy );
367 
372  struct aa_rx_mesh *mesh,
373  size_t width, size_t height,
374  const uint8_t *rgba, int copy );
375 
380  struct aa_rx_mesh *mesh,
381  size_t n, const float *uv, int copy );
382 
387  struct aa_rx_mesh *mesh,
388  const struct aa_rx_geom_opt *opt );
389 
393 AA_API struct aa_rx_geom *
395  struct aa_rx_geom_opt *opt,
396  struct aa_rx_mesh *mesh );
397 
401 AA_API void
403  struct aa_rx_sg *sg,
404  const char *frame,
405  struct aa_rx_geom *geom );
406 
407 
408 AA_API unsigned
409 aa_rx_geom_refcount ( const struct aa_rx_geom *g );
410 
411 AA_API unsigned
412 aa_rx_mesh_refcount ( struct aa_rx_mesh *sg );
413 
414 #endif /*AMINO_RX_SCENE_GEOM_H*/
AA_API void aa_rx_mesh_destroy(struct aa_rx_mesh *mesh)
Destroy the mesh.
Shape for a box.
Definition: scene_geom.h:236
AA_API void aa_rx_mesh_set_indices(struct aa_rx_mesh *mesh, size_t n, const unsigned *indices, int copy)
Set the mesh indices.
AA_API double aa_rx_geom_opt_get_color_red(struct aa_rx_geom_opt *opt)
Get red color value.
Invalid shape.
Definition: scene_geom.h:219
Container for scene geometry.
Definition: rxtype.h:55
AA_API int aa_rx_geom_opt_get_no_shadow(struct aa_rx_geom_opt *opt)
Get no-shadow option.
aa_rx_geom_shape
Enumeration of geometry shape types.
Definition: scene_geom.h:218
AA_API struct aa_rx_geom * aa_rx_geom_box(struct aa_rx_geom_opt *opt, const double dimension[3])
Create a box.
AA_API void aa_rx_geom_opt_set_no_shadow(struct aa_rx_geom_opt *opt, int no_shadow)
Set no-shadow option.
AA_API void aa_rx_geom_destroy(struct aa_rx_geom *geom)
Destroy a geometry struct.
Shape for a cylinder.
Definition: scene_geom.h:250
AA_API void aa_rx_mesh_set_uv(struct aa_rx_mesh *mesh, size_t n, const float *uv, int copy)
Set the mesh colors and uv values.
AA_API void aa_rx_geom_opt_set_specular3(struct aa_rx_geom_opt *opt, double red, double green, double blue)
Set specular reflection.
AA_API void aa_rx_mesh_set_vertices(struct aa_rx_mesh *mesh, size_t n, const float *vectors, int copy)
Set the mesh vertices.
A cone shape.
Definition: scene_geom.h:224
AA_API double aa_rx_geom_opt_get_scale(const struct aa_rx_geom_opt *opt)
Get mesh scaling.
Shape for a grid.
Definition: scene_geom.h:268
AA_API double aa_rx_geom_opt_get_color_blue(struct aa_rx_geom_opt *opt)
Get blue color value.
AA_API struct aa_rx_geom * aa_rx_geom_sphere(struct aa_rx_geom_opt *opt, double radius)
Create a sphere.
AA_API void aa_rx_geom_opt_set_scale(struct aa_rx_geom_opt *opt, double scale)
Set mesh scaling.
AA_API double aa_rx_geom_opt_get_specular_blue(struct aa_rx_geom_opt *opt)
Get blue specular value.
Opaque type for a scene_graph.
AA_API void aa_rx_mesh_set_normals(struct aa_rx_mesh *mesh, size_t n, const float *normals, int copy)
Set the mesh normals.
AA_API const char * aa_rx_geom_shape_str(enum aa_rx_geom_shape shape)
Return a string for the shape type.
AA_API struct aa_rx_geom * aa_rx_geom_cone(struct aa_rx_geom_opt *opt, double height, double start_radius, double end_radius)
Create a cone.
AA_API struct aa_rx_geom * aa_rx_geom_cylinder(struct aa_rx_geom_opt *opt, double height, double radius)
Create a cylinder.
AA_API double aa_rx_geom_opt_get_specular_red(struct aa_rx_geom_opt *opt)
Get red specular value.
AA_API struct aa_rx_geom * aa_rx_geom_copy(struct aa_rx_geom *src)
Copy a geometry struct.
AA_API double aa_rx_geom_opt_get_color_green(struct aa_rx_geom_opt *opt)
Get green color value.
AA_API void aa_rx_geom_attach(struct aa_rx_sg *sg, const char *frame, struct aa_rx_geom *geom)
Attach geometry to the scene graph.
AA_API struct aa_rx_geom_opt * aa_rx_geom_opt_create()
Create a geometry option struct.
AA_API int aa_rx_geom_opt_get_collision(struct aa_rx_geom_opt *opt)
Get collision option.
AA_API void aa_rx_geom_opt_set_visual(struct aa_rx_geom_opt *opt, int visual)
Set visual flag.
#define AA_API
calling and name mangling convention for functions
Definition: amino.h:86
Shape for a sphere.
Definition: scene_geom.h:243
AA_API double aa_rx_geom_opt_get_specular_green(struct aa_rx_geom_opt *opt)
Get green specular value.
AA_API struct aa_rx_geom * aa_rx_geom_mesh(struct aa_rx_geom_opt *opt, struct aa_rx_mesh *mesh)
Attach a mesh to frame.
AA_API struct aa_rx_geom * aa_rx_geom_grid(struct aa_rx_geom_opt *opt, const double dimension[2], const double delta[2], double width)
Create a grid.
AA_API void aa_rx_mesh_set_texture(struct aa_rx_mesh *mesh, const struct aa_rx_geom_opt *opt)
Set the mesh texture parameters.
AA_API int aa_rx_geom_opt_get_visual(struct aa_rx_geom_opt *opt)
Get visual option.
AA_API struct aa_rx_mesh * aa_rx_mesh_create()
Create a mesh.
AA_API void aa_rx_mesh_set_rgba(struct aa_rx_mesh *mesh, size_t width, size_t height, const uint8_t *rgba, int copy)
Set the mesh colors and alpha.
AA_API void aa_rx_geom_opt_set_color3(struct aa_rx_geom_opt *opt, double red, double blue, double green)
Set color option.
A triangular mesh shape.
Definition: scene_geom.h:220
Shape for a cone.
Definition: scene_geom.h:258
AA_API void aa_rx_geom_opt_set_alpha(struct aa_rx_geom_opt *opt, double alpha)
Set alpha (transparency) option.
A box (cube) shape.
Definition: scene_geom.h:221
AA_API double aa_rx_geom_opt_get_alpha(struct aa_rx_geom_opt *opt)
Get alpha value.
AA_API void aa_rx_geom_opt_destroy(struct aa_rx_geom_opt *)
Destroy a geometry option struct.
A grid-lines shape.
Definition: scene_geom.h:225
A cylinder shape.
Definition: scene_geom.h:223
A sphere (ball) shape.
Definition: scene_geom.h:222
AA_API void aa_rx_geom_opt_set_collision(struct aa_rx_geom_opt *opt, int collision)
Set collision flag.