1 /* Copyright (c) 2005 Robert Kooima */
3 /* Permission is hereby granted, free of charge, to any person obtaining a */
4 /* copy of this software and associated documentation files (the "Software"), */
5 /* to deal in the Software without restriction, including without limitation */
6 /* the rights to use, copy, modify, merge, publish, distribute, sublicense, */
7 /* and/or sell copies of the Software, and to permit persons to whom the */
8 /* Software is furnished to do so, subject to the following conditions: */
10 /* The above copyright notice and this permission notice shall be included in */
11 /* all copies or substantial portions of the Software. */
13 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR */
14 /* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, */
15 /* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL */
16 /* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER */
17 /* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
18 /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER */
19 /* DEALINGS IN THE SOFTWARE. */
24 /*============================================================================*/
26 #define OBJ_INDEX_IS_INT
28 #ifdef OBJ_INDEX_IS_INT
29 typedef unsigned int obj_index_t;
31 typedef unsigned short obj_index_t;
34 /*============================================================================*/
40 /*============================================================================*/
71 struct obj_prop kv[OBJ_PROP_COUNT];
125 int cloc[OBJ_PROP_COUNT];
126 int oloc[OBJ_PROP_COUNT];
127 int Mloc[OBJ_PROP_COUNT];
134 /*----------------------------------------------------------------------------*/
136 struct obj *obj_create(const char *);
137 void obj_render(struct obj *);
138 void obj_delete(struct obj *);
140 /*----------------------------------------------------------------------------*/
142 int obj_add_mtrl(struct obj *);
143 int obj_add_vert(struct obj *);
144 int obj_add_poly(struct obj *, int);
145 int obj_add_line(struct obj *, int);
146 int obj_add_surf(struct obj *);
148 int obj_num_mtrl(const struct obj *);
149 int obj_num_vert(const struct obj *);
150 int obj_num_poly(const struct obj *, int);
151 int obj_num_line(const struct obj *, int);
152 int obj_num_surf(const struct obj *);
154 void obj_del_mtrl(struct obj *, int);
155 void obj_del_vert(struct obj *, int);
156 void obj_del_poly(struct obj *, int, int);
157 void obj_del_line(struct obj *, int, int);
158 void obj_del_surf(struct obj *, int);
160 /*----------------------------------------------------------------------------*/
162 void obj_set_mtrl_name(struct obj *, int, const char *);
163 void obj_set_mtrl_map (struct obj *, int, int, const char *);
164 void obj_set_mtrl_opt (struct obj *, int, int, unsigned int);
165 void obj_set_mtrl_c (struct obj *, int, int, const float *);
166 void obj_set_mtrl_o (struct obj *, int, int, const float *);
167 void obj_set_mtrl_s (struct obj *, int, int, const float *);
169 void obj_set_vert_v(struct obj *, int, const float *);
170 void obj_set_vert_t(struct obj *, int, const float *);
171 void obj_set_vert_n(struct obj *, int, const float *);
172 void obj_set_vert_u(struct obj *, int, const float *);
174 void obj_set_poly(struct obj *, int, int, const int *);
175 void obj_set_line(struct obj *, int, int, const int *);
176 void obj_set_surf(struct obj *, int, int);
178 void obj_set_vert_loc(struct obj *, int, int, int, int);
179 void obj_set_prop_loc(struct obj *, int, int, int, int);
181 /*----------------------------------------------------------------------------*/
183 const char *obj_get_mtrl_name(const struct obj *, int);
185 struct array *obj_get_mtrl_map (const struct obj *, int, int);
187 unsigned int obj_get_mtrl_map (const struct obj *, int, int);
189 unsigned int obj_get_mtrl_opt (const struct obj *, int, int);
190 void obj_get_mtrl_c (const struct obj *, int, int, float *);
191 void obj_get_mtrl_o (const struct obj *, int, int, float *);
192 void obj_get_mtrl_s (const struct obj *, int, int, float *);
194 void obj_get_vert_v(const struct obj *, int, float *);
195 void obj_get_vert_t(const struct obj *, int, float *);
196 void obj_get_vert_n(const struct obj *, int, float *);
198 void obj_get_poly(const struct obj *, int, int, int *);
199 void obj_get_line(const struct obj *, int, int, int *);
200 int obj_get_surf(const struct obj *, int);
202 /*----------------------------------------------------------------------------*/
204 void obj_render_mtrl(const struct obj *, int);
205 void obj_render_surf(const struct obj *, int);
206 void obj_render_file(const struct obj *);
208 /*----------------------------------------------------------------------------*/
211 struct array *obj_load_image(const char *);
213 unsigned int obj_load_image(const char *);
216 void obj_mini(struct obj *);
217 void obj_norm(struct obj *);
218 void obj_proc(struct obj *);
219 void obj_uniq(struct obj *, float, float, int);
220 void obj_sort(struct obj *, int);
221 float obj_acmr(struct obj *, int);
223 void obj_bound(const struct obj *, float *);
224 void obj_write(const struct obj *, const char *, const char *, int);
226 /*======================================================================+=====*/