amino  1.0-beta2
Lightweight Robot Utility Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
wavefront.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 
39 #ifndef AMINO_RX_WAVEFRONT_H
40 #define AMINO_RX_WAVEFRONT_H
41 
47 /* forward declaration of opaque structure
48  */
49 struct aa_rx_wf_obj;
50 
51 
55 #define AA_RX_WF_OBJ_FACE_NONE -1
56 
57 
61 AA_API void
62 aa_rx_wf_obj_destroy( struct aa_rx_wf_obj * );
63 
64 
68 AA_API size_t
69 aa_rx_wf_obj_mtl_count( struct aa_rx_wf_obj *obj );
70 
74 AA_API const char *
75 aa_rx_wf_obj_get_mtl_filename( struct aa_rx_wf_obj *obj, size_t i );
76 
80 AA_API const struct aa_rx_wf_mtl *
81 aa_rx_wf_obj_get_mtl( struct aa_rx_wf_obj *obj, size_t i );
82 
86 AA_API size_t
87 aa_rx_wf_obj_material_count( struct aa_rx_wf_obj *obj );
88 
92 AA_API const char *
93 aa_rx_wf_obj_get_material_name( struct aa_rx_wf_obj *obj, size_t i );
94 
98 AA_API struct aa_rx_wf_obj *
99 aa_rx_wf_parse(const char *filename);
100 
104 AA_API void
105 aa_rx_wf_obj_get_vertices( const struct aa_rx_wf_obj *obj,
106  const double **verticies, size_t *n );
107 
111 AA_API void
112 aa_rx_wf_obj_get_normals( const struct aa_rx_wf_obj *obj,
113  const double **normals, size_t *n );
114 
118 AA_API void
119 aa_rx_wf_obj_get_vertex_indices( const struct aa_rx_wf_obj *obj,
120  const int32_t **v, size_t *n );
121 
125 AA_API void
126 aa_rx_wf_obj_get_normal_indices( const struct aa_rx_wf_obj *obj,
127  const int32_t **v, size_t *n );
131 AA_API void
132 aa_rx_wf_obj_get_uv_indices( const struct aa_rx_wf_obj *obj,
133  const int32_t **v, size_t *n );
134 
138 AA_API void
139 aa_rx_wf_obj_get_texture_indices( const struct aa_rx_wf_obj *obj,
140  const int32_t **v, size_t *n );
141 
142 
143 /* forward declaration of opaque structure
144  */
145 struct aa_rx_wf_mtl;
146 
147 /* forward declaration of opaque structure
148  */
149 struct aa_rx_wf_material;
150 
154 AA_API struct aa_rx_wf_mtl *
155 aa_rx_wf_mtl_parse(const char *mtl_name );
156 
157 
161 AA_API void
162 aa_rx_wf_mtl_destroy( struct aa_rx_wf_mtl * );
163 
167 AA_API size_t
168 aa_rx_wf_mtl_material_count( const struct aa_rx_wf_mtl * mtl);
169 
173 AA_API struct aa_rx_wf_material *
174 aa_rx_wf_mtl_get_material( const struct aa_rx_wf_mtl * mtl, size_t i);
175 
179 AA_API int
180 aa_rx_wf_material_has_specular_weight( const struct aa_rx_wf_material * material );
181 
185 AA_API int
186 aa_rx_wf_material_has_specular( const struct aa_rx_wf_material * material );
187 
191 AA_API int
192 aa_rx_wf_material_has_ambient( const struct aa_rx_wf_material * material );
193 
197 AA_API int
198 aa_rx_wf_material_has_emission( const struct aa_rx_wf_material * material );
199 
203 AA_API int
204 aa_rx_wf_material_has_diffuse( const struct aa_rx_wf_material * material );
205 
209 AA_API int
210 aa_rx_wf_material_has_alpha( const struct aa_rx_wf_material * material );
211 
215 AA_API int
216 aa_rx_wf_material_has_ior( const struct aa_rx_wf_material * material );
217 
221 AA_API const char*
222 aa_rx_wf_material_get_name( const struct aa_rx_wf_material * material );
223 
227 AA_API const double*
228 aa_rx_wf_material_get_specular( const struct aa_rx_wf_material * material );
229 
233 AA_API const double*
234 aa_rx_wf_material_get_ambient( const struct aa_rx_wf_material * material );
235 
239 AA_API const double*
240 aa_rx_wf_material_get_emission( const struct aa_rx_wf_material * material );
241 
245 AA_API const double*
246 aa_rx_wf_material_get_diffuse( const struct aa_rx_wf_material * material );
247 
251 AA_API double
252 aa_rx_wf_material_get_alpha( const struct aa_rx_wf_material * material );
253 
257 AA_API double
258 aa_rx_wf_material_get_ior( const struct aa_rx_wf_material * material );
259 
260 #endif //AMINO_RX_WAVEFRONT_H
AA_API const char * aa_rx_wf_obj_get_mtl_filename(struct aa_rx_wf_obj *obj, size_t i)
Return the ith MTL filename.
AA_API void aa_rx_wf_obj_get_uv_indices(const struct aa_rx_wf_obj *obj, const int32_t **v, size_t *n)
Retrieve the uv indices.
AA_API double aa_rx_wf_material_get_alpha(const struct aa_rx_wf_material *material)
Return the material's alpha value.
AA_API void aa_rx_wf_obj_destroy(struct aa_rx_wf_obj *)
Destroy the object for a wavefront obj file.
AA_API int aa_rx_wf_material_has_specular(const struct aa_rx_wf_material *material)
Does the material have a specular value?
AA_API const double * aa_rx_wf_material_get_emission(const struct aa_rx_wf_material *material)
Return the material's emission value.
AA_API void aa_rx_wf_obj_get_vertices(const struct aa_rx_wf_obj *obj, const double **verticies, size_t *n)
Retrieve the verticies.
AA_API const struct aa_rx_wf_mtl * aa_rx_wf_obj_get_mtl(struct aa_rx_wf_obj *obj, size_t i)
Return the ith MTL struct.
AA_API int aa_rx_wf_material_has_specular_weight(const struct aa_rx_wf_material *material)
Does the material have a specular weight?
AA_API struct aa_rx_wf_material * aa_rx_wf_mtl_get_material(const struct aa_rx_wf_mtl *mtl, size_t i)
Return the i'th material.
AA_API size_t aa_rx_wf_obj_mtl_count(struct aa_rx_wf_obj *obj)
Return the number of MTL files.
AA_API int aa_rx_wf_material_has_alpha(const struct aa_rx_wf_material *material)
Does the material have an alpha value?
AA_API double aa_rx_wf_material_get_ior(const struct aa_rx_wf_material *material)
Return the material's index-of-refraction value.
AA_API const double * aa_rx_wf_material_get_specular(const struct aa_rx_wf_material *material)
Return the material's specular value.
AA_API size_t aa_rx_wf_obj_material_count(struct aa_rx_wf_obj *obj)
Return the number of materials.
AA_API int aa_rx_wf_material_has_diffuse(const struct aa_rx_wf_material *material)
Does the material have an diffuse value?
AA_API void aa_rx_wf_mtl_destroy(struct aa_rx_wf_mtl *)
Destroy a wavefront MTL object.
AA_API int aa_rx_wf_material_has_emission(const struct aa_rx_wf_material *material)
Does the material have an emission value?
AA_API size_t aa_rx_wf_mtl_material_count(const struct aa_rx_wf_mtl *mtl)
Return the number of materials.
AA_API void aa_rx_wf_obj_get_vertex_indices(const struct aa_rx_wf_obj *obj, const int32_t **v, size_t *n)
Retrieve the vertex indices.
AA_API void aa_rx_wf_obj_get_texture_indices(const struct aa_rx_wf_obj *obj, const int32_t **v, size_t *n)
Retrieve the texture indices.
AA_API void aa_rx_wf_obj_get_normal_indices(const struct aa_rx_wf_obj *obj, const int32_t **v, size_t *n)
Retrieve the normal indices.
AA_API const char * aa_rx_wf_obj_get_material_name(struct aa_rx_wf_obj *obj, size_t i)
Return the name of the ith material.
#define AA_API
calling and name mangling convention for functions
Definition: amino.h:95
AA_API struct aa_rx_wf_mtl * aa_rx_wf_mtl_parse(const char *mtl_name)
Parse a wavefront MTL file.
AA_API const double * aa_rx_wf_material_get_ambient(const struct aa_rx_wf_material *material)
Return the material's ambient value.
AA_API int aa_rx_wf_material_has_ior(const struct aa_rx_wf_material *material)
Does the material have an index-of-refraction value?
AA_API struct aa_rx_wf_obj * aa_rx_wf_parse(const char *filename)
Parse a wavefront OBJ file.
AA_API const double * aa_rx_wf_material_get_diffuse(const struct aa_rx_wf_material *material)
Return the material's diffuse value.
AA_API const char * aa_rx_wf_material_get_name(const struct aa_rx_wf_material *material)
Return the material's name.
AA_API void aa_rx_wf_obj_get_normals(const struct aa_rx_wf_obj *obj, const double **normals, size_t *n)
Retrieve the normals.
AA_API int aa_rx_wf_material_has_ambient(const struct aa_rx_wf_material *material)
Does the material have an ambient value?