amino
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 
95 AA_API struct aa_rx_wf_obj *
96 aa_rx_wf_parse(const char *filename);
97 
101 AA_API void
102 aa_rx_wf_obj_get_vertices( const struct aa_rx_wf_obj *obj,
103  const double **verticies, size_t *n );
104 
108 AA_API void
109 aa_rx_wf_obj_get_normals( const struct aa_rx_wf_obj *obj,
110  const double **normals, size_t *n );
111 
115 AA_API void
116 aa_rx_wf_obj_get_vertex_indices( const struct aa_rx_wf_obj *obj,
117  const int32_t **v, size_t *n );
118 
122 AA_API void
123 aa_rx_wf_obj_get_normal_indices( const struct aa_rx_wf_obj *obj,
124  const int32_t **v, size_t *n );
128 AA_API void
129 aa_rx_wf_obj_get_uv_indices( const struct aa_rx_wf_obj *obj,
130  const int32_t **v, size_t *n );
131 
135 AA_API void
136 aa_rx_wf_obj_get_texture_indices( const struct aa_rx_wf_obj *obj,
137  const int32_t **v, size_t *n );
138 
139 
140 /* forward declaration of opaque structure
141  */
142 struct aa_rx_wf_mtl;
143 
144 /* forward declaration of opaque structure
145  */
146 struct aa_rx_wf_material;
147 
148 AA_API struct aa_rx_wf_mtl *
149 aa_rx_wf_mtl_parse(const char *mtl_name );
150 
151 
152 AA_API void
153 aa_rx_wf_mtl_destroy( struct aa_rx_wf_mtl * );
154 
155 AA_API size_t
156 aa_rx_wf_mtl_material_count( const struct aa_rx_wf_mtl * mtl);
157 
158 AA_API struct aa_rx_wf_material *
159 aa_rx_wf_mtl_get_material( const struct aa_rx_wf_mtl * mtl, size_t i);
160 
161 AA_API int
162 aa_rx_wf_material_has_specular_weight( const struct aa_rx_wf_material * material );
163 
164 AA_API int
165 aa_rx_wf_material_has_specular( const struct aa_rx_wf_material * material );
166 
167 AA_API int
168 aa_rx_wf_material_has_ambient( const struct aa_rx_wf_material * material );
169 
170 AA_API int
171 aa_rx_wf_material_has_emission( const struct aa_rx_wf_material * material );
172 
173 AA_API int
174 aa_rx_wf_material_has_diffuse( const struct aa_rx_wf_material * material );
175 
176 AA_API int
177 aa_rx_wf_material_has_alpha( const struct aa_rx_wf_material * material );
178 
179 AA_API int
180 aa_rx_wf_material_has_ior( const struct aa_rx_wf_material * material );
181 
182 AA_API const char*
183 aa_rx_wf_material_get_name( const struct aa_rx_wf_material * material );
184 
185 AA_API const double*
186 aa_rx_wf_material_get_specular( const struct aa_rx_wf_material * material );
187 
188 AA_API const double*
189 aa_rx_wf_material_get_ambient( const struct aa_rx_wf_material * material );
190 
191 AA_API const double*
192 aa_rx_wf_material_get_emission( const struct aa_rx_wf_material * material );
193 
194 AA_API const double*
195 aa_rx_wf_material_get_diffuse( const struct aa_rx_wf_material * material );
196 
197 AA_API double
198 aa_rx_wf_material_get_alpha( const struct aa_rx_wf_material * material );
199 
200 AA_API double
201 aa_rx_wf_material_get_ior( const struct aa_rx_wf_material * material );
202 
203 #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 void aa_rx_wf_obj_destroy(struct aa_rx_wf_obj *)
Destroy the object for a wavefront obj file.
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 size_t aa_rx_wf_obj_mtl_count(struct aa_rx_wf_obj *obj)
Return the number of MTL files.
AA_API size_t aa_rx_wf_obj_material_count(struct aa_rx_wf_obj *obj)
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 void aa_rx_wf_obj_get_normals(const struct aa_rx_wf_obj *obj, const double **normals, size_t *n)
Retrieve the normals.