BRL-CAD
obj_parser.h
Go to the documentation of this file.
1 /* O B J _ P A R S E R . H
2  * BRL-CAD
3  *
4  * Copyright (c) 1995-2014 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 /** @file obj_parser.h
21  *
22  * Interface to Wavefront OBJ Parser.
23  *
24  */
25 #ifndef LIBGCV_WFOBJ_OBJ_PARSER_H
26 #define LIBGCV_WFOBJ_OBJ_PARSER_H
27 
28 #include "common.h"
29 #include <sys/types.h>
30 #include <stdio.h>
31 
33 
34 /**
35  * A structure containing a wavefront obj parser.
36  * This is a C wrapper for objParser.
37  */
38 typedef struct {
39  void *p;
40 } obj_parser_t;
41 
42 /**
43  * A structure containing the contents of a parsed wavefront obj file.
44  * This is a C wrapper for objFileContents.
45  */
46 typedef struct {
47  void *p;
49 
50 /**
51  * A structure with the attributes describing a polygonal element
52  *
53  * groupset_index
54  * An index into a set of group sets this element belongs to.
55  * See obj_groups and obj_groupsets
56  *
57  * object_index
58  * An index into a set of object labels that this element belongs to
59  * See obj_objects
60  *
61  * material_index
62  * An index into a set of materials that describes this element
63  * See obj_materials
64  *
65  * materiallibset_index
66  * An index into a set of material library sets this element uses
67  * See obj_materiallibs and obj_materiallibsets
68  *
69  * texmap_index
70  * An index into a set of texture maps that describes this element
71  * See obj_texmaps
72  *
73  * texmaplibset_index
74  * An index into a set of texture map library sets this element uses
75  * See obj_texmaplibs and obj_texmaplibsets
76  *
77  * shadow_obj_index
78  * An index into a set of shadow objects that this element uses
79  * See obj_shadow_objs
80  *
81  * trace_obj_index
82  * An index into a set of trace objects that this element uses
83  * See obj_trace_objs
84  *
85  * smooth_group
86  * A smoothing group id for this element
87  * N.B. unspecified in signess or default in wavefront obj spec,
88  * here unsigned and 0
89  *
90  * bevel
91  * Whether this element bevel flag is off (zero) or on (non-zero), as per
92  * wavefront spec, default is off
93  *
94  * c_interp
95  * Whether color interpolation is off (zero) or on (non-zero), as per
96  * wavefront spec, default is off
97  *
98  * d_interp
99  * Whether dissolve interpolation is off (zero) or on (non-zero), as per
100  * wavefront spec, default is off
101  *
102  * lod
103  * The level of detail this element should be displayed as. This is a value
104  * between 0 (all elements) and 100. As per wavefront spec, default is 0.
105  */
106 typedef struct {
108  size_t object_index;
111  size_t texmap_index;
115  unsigned int smooth_group;
116  unsigned char bevel;
117  unsigned char c_interp;
118  unsigned char d_interp;
119  unsigned char lod;
121 
122 /**
123  * Allocate a obj_parser_t object.
124  *
125  * You must eventually call obj_parser_destroy.
126  *
127  * Return values:
128  * 0 - success
129  * ENOMEM - out of memory
130  */
131 int obj_parser_create(obj_parser_t *parser);
132 
133 /**
134  * Destroy the obj_parser_t object.
135  */
136 void obj_parser_destroy(obj_parser_t parser);
137 
138 /**
139  * Parse the obj file 'filename' with 'parser', create and place results into
140  * 'contents'.
141  *
142  * If the filename begins with the '/' character, then the file is
143  * understood to be an absolute path starting at the root directory. If the
144  * filename does not begin with a '/' character, the file is understood to
145  * be relative to the current working directory. In either case any additional
146  * relative file inclusion mechanism will be relative to the directory that
147  * holds the input file.
148  *
149  * After a successful call to obj_parse_file, you must eventually
150  * call obj_contents_destroy.
151  *
152  * If unable to successfully parse 'filename' a negative value will be
153  * returned and the reason can be obtained by obj_parse_error.
154  *
155  * Warnings or information about non-implemented features will return success
156  * and be reported via obj_parse_error.
157  *
158  * Return values:
159  * 0 - success
160  * ENOMEM - out of memory
161  * Any error code returned by fopen
162  * <0 - failure, see obj_parse_error
163  */
164 int obj_parse(const char *filename, obj_parser_t parser,
165  obj_contents_t *contents);
166 
167 /**
168  * Parse the obj file stream pointed to by 'stream' with 'parser', create and
169  * place results into 'contents'.
170  *
171  * Operational semantics with respect to 'stream' will mimic 'fread' and
172  * shall not close 'stream' under any circumstance.
173  *
174  * From IEEE Std 1003.1-2001:
175  * The file position indicator for the stream (if defined) shall be advanced
176  * by the number of bytes successfully read. If an error occurs, the
177  * resulting value of the file position indicator for the stream is
178  * unspecified. If a partial element is read, its value is unspecified.
179  *
180  * Any additional relative file inclusion mechanism will be relative to the
181  * current working directory.
182  *
183  * After a successful call to obj_parse_file, you must eventually
184  * call obj_contents_destroy.
185  *
186  * If unable to successfully parse the stream pointed to by 'stream' a
187  * negative value will be returned and the reason can be obtained by
188  * obj_parse_error.
189  *
190  * Warnings or information about non-implemented features will return success
191  * and be reported via obj_parse_error.
192  *
193  * Return values:
194  * 0 - success
195  * ENOMEM - out of memory
196  * Any error code returned by fopen
197  * <0 - failure, see obj_parse_error
198  */
199 int obj_fparse(FILE *stream, obj_parser_t parser, obj_contents_t *contents);
200 
201 /**
202  * Return the reason the last attempt to parse a file failed or warnings
203  * generated during the parse.
204  *
205  * Return:
206  * 0 - The previous parse attempt succeeded and no warnings generated.
207  * !0 - A null terminated string containing information about the last parse
208  */
209 const char * obj_parse_error(obj_parser_t parser);
210 
211 /**
212  * Destroy the obj_contents_t object.
213  *
214  * Return values:
215  * 0 - success
216  */
218 
219 /**
220  * Obtain a list of all vertices contained in 'contents'.
221  *
222  * Copy a pointer to a multidimensional array of vertices contained in
223  * 'contents' to the location pointed to by val_arr and return its length.
224  *
225  * The vertices are contained in an array of type const float[][4] and must
226  * not be modified by the caller. The format of the second dimension is:
227  * {x y z w} where w is 1.0 by default.
228  *
229  * Return value:
230  * The length of the vertex list
231  */
232 size_t obj_vertices(obj_contents_t contents, const float (*val_arr[])[4]);
233 
234 /**
235  * Obtain a list of all texture vertices contained in 'contents'.
236  *
237  * Copy a pointer to a multidimensional array of texture vertices contained in
238  * 'contents' to the location pointed to by val_arr and return its length.
239  *
240  * The vertices are contained in an array of type const float[][3] and must
241  * not be modified by the caller. The format of the second dimension is:
242  * {u v w} where v and w 0 by default.
243  *
244  * Return value:
245  * The length of the texture vertex list
246  */
247 size_t obj_texture_coord(obj_contents_t contents, const float (*val_arr[])[3]);
248 
249 /**
250  * Obtain a list of all normals contained in 'contents'.
251  *
252  * Copy a pointer to a multidimensional array of normals contained in
253  * 'contents' to the location pointed to by val_arr and return its length.
254  *
255  * The normals are contained in an array of type const float[][3] and must
256  * not be modified by the caller. The format of the second dimension is:
257  * {i j j}.
258  *
259  * Return value:
260  * The length of the normal list
261  */
262 size_t obj_normals(obj_contents_t contents, const float (*val_arr[])[3]);
263 
264 /**
265  * Obtain a unique set of all group names contained in 'contents'
266  *
267  * Copy a pointer to a null terminated character sequence array of group names
268  * contained in 'contents' to the location pointed to by val_arr and return
269  * its length.
270  *
271  * Group names are guaranteed to be a unique set.
272  *
273  * If an element has not been explicitly tagged as being part of a particular
274  * group, per the wavefront obj spec, the element is placed in the "default"
275  * group.
276  *
277  * Return value:
278  * The length of the group name list.
279  */
280 size_t obj_groups(obj_contents_t contents, const char * const (*val_arr[]));
281 
282 /**
283  * Return the number of group sets contained in 'contents'
284  *
285  * Return value:
286  * The number of group sets
287  */
288 size_t obj_num_groupsets(obj_contents_t contents);
289 
290 /**
291  * Obtain the 'n'th group set contained in 'contents'
292  *
293  * Copy a pointer to an index set of group indices for the 'n'th set
294  * contained in 'contents' to the location pointed to by val_arr and return
295  * its length.
296  *
297  * Group sets are guaranteed to be a unique set.
298  *
299  * When an element references a groupset index of 'n', calling obj_groupset
300  * with the 'n'th set will obtain a unique set of indices that can be used
301  * to obtain the group name.
302  *
303  * Return value:
304  * The length of the group set.
305  */
306 size_t obj_groupset(obj_contents_t contents, size_t n,
307  const size_t (*index_arr[]));
308 
309 /**
310  * Obtain a unique set of all object names contained in 'contents'
311  *
312  * Copy a pointer to a null terminated character sequence array of object
313  * names contained in 'contents' to the location pointed to by val_arr and
314  * return its length.
315  *
316  * Object names are guaranteed to be a unique set.
317  *
318  * The wavefront obj spec does not specify the default behavior for elements
319  * not explicitly being defined as being a part of an object. Therefore,
320  * for this implementation, if an element has not been explicitly tagged as
321  * being part of a particular object, the element shall have the "" object
322  * tag.
323  *
324  * N.B. As it is impossible as per the wavefront obj spec to set a particular
325  * object name to the empty string, the "" tag is unique to elements that
326  * have not had the object explicitly set.
327  *
328  * Return value:
329  * The length of the object name list.
330  */
331 size_t obj_objects(obj_contents_t contents, const char * const (*val_arr[]));
332 
333 /**
334  * Obtain a unique set of all material names contained in 'contents'
335  *
336  * Copy a pointer to a null terminated character sequence array of material
337  * names contained in 'contents' to the location pointed to by val_arr and
338  * return its length.
339  *
340  * Material names are guaranteed to be a unique set.
341  *
342  * The wavefront obj spec does not specify the default behavior for elements
343  * not explicitly being defined as having a material trait. Therefore,
344  * for this implementation, if an element has not been explicitly tagged as
345  * having a material trait, the element shall have the "" material trait tag.
346  *
347  * N.B. As it is impossible as per the wavefront obj spec to set a particular
348  * material name to the empty string, the "" tag is unique to elements that
349  * have not had the material trait explicitly set.
350  *
351  * Return value:
352  * The length of the material name list.
353  */
354 size_t obj_materials(obj_contents_t contents, const char * const (*val_arr[]));
355 
356 /**
357  * Obtain a unique set of all material library names contained in 'contents'
358  *
359  * Copy a pointer to a null terminated character sequence array of material
360  * library names contained in 'contents' to the location pointed to by val_arr
361  * and return its length.
362  *
363  * Material library names are guaranteed to be a unique set.
364  *
365  * The wavefront obj spec does not specify the default behavior for elements
366  * not explicitly being defined as using a material library. Therefore,
367  * for this implementation, if an element has not been explicitly tagged as
368  * using a material library, the element shall have the "" material library
369  * tag.
370  *
371  * N.B. As it is impossible as per the wavefront obj spec to set a particular
372  * material library to the empty string, the "" tag is unique to elements that
373  * have not had the material library explicitly set.
374  *
375  * Return value:
376  * The length of the material library name list.
377  */
378 size_t obj_materiallibs(obj_contents_t contents,
379  const char * const (*val_arr[]));
380 
381 /**
382  * Return the number of material library sets contained in 'contents'
383  *
384  * Return value:
385  * The number of material library sets
386  */
387 size_t obj_num_materiallibsets(obj_contents_t contents);
388 
389 /**
390  * Obtain the 'n'th material library set contained in 'contents'
391  *
392  * Copy a pointer to an index set of material library indices for the 'n'th
393  * set contained in 'contents' to the location pointed to by val_arr and
394  * return its length.
395  *
396  * Material library sets are guaranteed to be a unique set.
397  *
398  * When an element references a materiallibset index of 'n', calling
399  * obj_materiallibset with the 'n'th set will obtain a unique set of indices
400  * that can be used to obtain the material library name.
401  *
402  * Return value:
403  * The length of the material library set.
404  */
405 size_t obj_materiallibset(obj_contents_t contents, size_t n,
406  const size_t (*index_arr[]));
407 
408 /**
409  * Obtain a unique set of all texture map names contained in 'contents'
410  *
411  * Copy a pointer to a null terminated character sequence array of texture map
412  * names contained in 'contents' to the location pointed to by val_arr and
413  * return its length.
414  *
415  * Texture map names are guaranteed to be a unique set.
416  *
417  * The wavefront obj spec does not specify the default behavior for elements
418  * not explicitly being defined as having a texture map. Therefore,
419  * for this implementation, if an element has not been explicitly tagged as
420  * having a texture map, the element shall have the "" texture map tag.
421  *
422  * N.B. As it is impossible as per the wavefront obj spec to set a particular
423  * texture map name to the empty string, the "" tag is unique to elements that
424  * have not had a texture map explicitly set.
425  *
426  * Return value:
427  * The length of the texture map list.
428  */
429 size_t obj_texmaps(obj_contents_t contents, const char * const (*val_arr[]));
430 
431 /**
432  * Obtain a unique set of all texture map library names contained in
433  * 'contents'
434  *
435  * Copy a pointer to a null terminated character sequence array of texture map
436  * library names contained in 'contents' to the location pointed to by val_arr
437  * and return its length.
438  *
439  * Texture map library names are guaranteed to be a unique set.
440  *
441  * The wavefront obj spec does not specify the default behavior for elements
442  * not explicitly being defined as using a texture map library. Therefore,
443  * for this implementation, if an element has not been explicitly tagged as
444  * using a texture map library, the element shall have the "" material library
445  * tag.
446  *
447  * N.B. As it is impossible as per the wavefront obj spec to set a particular
448  * texture map library to the empty string, the "" tag is unique to elements
449  * that have not had the texture mao library explicitly set.
450  *
451  * Return value:
452  * The length of the texture map library name list.
453  */
454 size_t obj_texmaplibs(obj_contents_t contents,
455  const char * const (*val_arr[]));
456 
457 /**
458  * Return the number of texture map library sets contained in 'contents'
459  *
460  * Return value:
461  * The number of texture map library sets
462  */
463 size_t obj_num_texmaplibsets(obj_contents_t contents);
464 
465 /**
466  * Obtain the 'n'th texture map library set contained in 'contents'
467  *
468  * Copy a pointer to an index set of texture map library indices for the 'n'th
469  * set contained in 'contents' to the location pointed to by val_arr and
470  * return its length.
471  *
472  * Texture map library sets are guaranteed to be a unique set.
473  *
474  * When an element references a texmaplibset index of 'n', calling
475  * obj_textmaplibset with the 'n'th set will obtain a unique set of indices
476  * that can be used to obtain the texture map library name.
477  *
478  * Return value:
479  * The length of the texture map library set.
480  */
481 size_t obj_texmaplibset(obj_contents_t contents, size_t set,
482  const size_t (*index_arr[]));
483 
484 /**
485  * Obtain a unique set of all shadow object names contained in 'contents'
486  *
487  * Copy a pointer to a null terminated character sequence array of shadow
488  * object names contained in 'contents' to the location pointed to by val_arr
489  * and return its length.
490  *
491  * Shadow object names are guaranteed to be a unique set.
492  *
493  * The wavefront obj spec does not specify the default behavior for elements
494  * not explicitly being defined as having a shadow object. Therefore,
495  * for this implementation, if an element has not been explicitly tagged as
496  * having a shadow object, the element shall have the "" shadow object tag.
497  *
498  * N.B. As it is impossible as per the wavefront obj spec to set a particular
499  * shadow object name to the empty string, the "" tag is unique to elements
500  * that have not had the shadow object explicitly set.
501  *
502  * Return value:
503  * The length of the shadow object name list.
504  */
505 size_t obj_shadow_objs(obj_contents_t contents,
506  const char * const (*val_arr[]));
507 
508 /**
509  * Obtain a unique set of all trace object names contained in 'contents'
510  *
511  * Copy a pointer to a null terminated character sequence array of trace
512  * object names contained in 'contents' to the location pointed to by val_arr
513  * and return its length.
514  *
515  * Trace object names are guaranteed to be a unique set.
516  *
517  * The wavefront obj spec does not specify the default behavior for elements
518  * not explicitly being defined as having a trace object. Therefore,
519  * for this implementation, if an element has not been explicitly tagged as
520  * having a trace object, the element shall have the "" trace object tag.
521  *
522  * N.B. As it is impossible as per the wavefront obj spec to set a particular
523  * trace object name to the empty string, the "" tag is unique to elements
524  * that have not had the trace object explicitly set.
525  *
526  * Return value:
527  * The length of the trace object name list.
528  */
529 size_t obj_trace_objs(obj_contents_t contents,
530  const char * const (*val_arr[]));
531 
532 /**
533  * Obtain a list of polygonal attributes in 'contents'
534  *
535  * Copy a pointer to a const obj_polygonal_attributes_t array of polygonal
536  * attributes contained in 'contents' to the location pointed to by attr_arr
537  * and return its length.
538  *
539  * Polygonal attributes are guaranteed to be a unique set.
540  *
541  * The ith index corresponds to to ith index of attindex obtained via one of
542  * the obj_polygonal_*_faces functions. The member value of the ith element
543  * obtained via this function is the index into the '*_list' array obtained
544  * via corresponding the obj_* function.
545  *
546  * Return value
547  * The length of the polygonal attributes list
548  */
550  const obj_polygonal_attributes_t (*attr_list[]));
551 
552 /**
553  * Obtain the list of polygonal attributes for all polygonal points
554  * in 'contents'
555  *
556  * Copy a pointer to an index array to the location pointed to by attindex_arr
557  * and return the list length.
558  *
559  * The value of the ith element in 'attindex_arr' is the index into the
560  * 'attr_list' obtained from obj_polygonal_attributes describing the
561  * polygonal attributes for the ith point.
562  *
563  * Return value
564  * The total number of polygonal points
565  */
566 size_t obj_polygonal_v_points(obj_contents_t contents,
567  const size_t (*attindex_arr[]));
568 
569 /**
570  * Obtain the vertex indices for the 'n'th polygonal point only identified by
571  * vertices in 'contents'
572  *
573  * Copy a pointer to the 'n'th vertex index array to the location pointed to
574  * by 'index_arr' and return the length of the array. The index array
575  * contains the vertices that make up the 'n'th point.
576  *
577  * Return value
578  * The number of vertices that make up the 'n'th polygonal point
579  */
580 size_t obj_polygonal_v_point_vertices(obj_contents_t contents, size_t n,
581  const size_t (*index_arr[]));
582 
583 /**
584  * Obtain the list of polygonal attributes for all polygonal lines only
585  * identified by vertices in 'contents'
586  *
587  * Copy a pointer to an index array to the location pointed to by attindex_arr
588  * and return the list length.
589  *
590  * The value of the ith element in 'attindex_arr' is the index into the
591  * 'attr_list' obtained from obj_polygonal_attributes describing the
592  * polygonal attributes for the ith line.
593  *
594  * Return value
595  * The total number of polygonal lines only identified by vertices
596  */
597 size_t obj_polygonal_v_lines(obj_contents_t contents,
598  const size_t (*attindex_arr[]));
599 
600 /**
601  * Obtain the vertex indices for the 'n'th polygonal line only identified by
602  * vertices in 'contents'
603  *
604  * Copy a pointer to the 'n'th vertex index array to the location pointed to
605  * by 'index_arr' and return the length of the array. The index array
606  * contains the vertices that make up the 'n'th line.
607  *
608  * Return value
609  * The number of vertices that make up the 'n'th polygonal line
610  */
611 size_t obj_polygonal_v_line_vertices(obj_contents_t contents, size_t n,
612  const size_t (*index_arr[]));
613 
614 /**
615  * Obtain the list of polygonal attributes for all textured polygonal lines
616  * in 'contents'
617  *
618  * Copy a pointer to an index array to the location pointed to by attindex_arr
619  * and return the list length.
620  *
621  * The value of the ith element in 'attindex_arr' is the index into the
622  * 'attr_list' obtained from obj_polygonal_attributes describing the
623  * polygonal attributes for the ith line.
624  *
625  * Return value
626  * The total number of textured polygonal line
627  */
628 size_t obj_polygonal_tv_lines(obj_contents_t contents,
629  const size_t (*attindex_arr[]));
630 
631 /**
632  * Obtain the textured coordinate and vertex indices for the 'n'th textured
633  * polygonal line in 'contents'
634  *
635  * Copy a pointer to the 'n'th multidimensional index array to the location
636  * pointed to by 'index_arr' and return the length of the array.
637  *
638  * The line indices are contained in an array of type const size_t[][2] and
639  * must not be modified by the caller. The format of the second dimension is:
640  * {vertex_index, texture_coordinate_index}
641  *
642  * Return value
643  * The number of vertices that make up the 'n'th polygonal line
644  */
645 size_t obj_polygonal_tv_line_vertices(obj_contents_t contents, size_t face,
646  const size_t (*index_arr[])[2]);
647 
648 /**
649  * Obtain the list of polygonal attributes for all polygonal faces only
650  * identified by vertices in 'contents'
651  *
652  * Copy a pointer to an index array to the location pointed to by attindex_arr
653  * and return the list length.
654  *
655  * The value of the ith element in 'attindex_arr' is the index into the
656  * 'attr_list' obtained from obj_polygonal_attributes describing the
657  * polygonal attributes for the ith face.
658  *
659  * Return value
660  * The total number of polygonal faces only identified by vertices
661  */
662 size_t obj_polygonal_v_faces(obj_contents_t contents,
663  const size_t (*attindex_arr[]));
664 
665 /**
666  * Obtain the vertex indices for the 'n'th polygonal face only identified by
667  * vertices in 'contents'
668  *
669  * Copy a pointer to the 'n'th vertex index array to the location pointed to
670  * by 'index_arr' and return the length of the array. The index array
671  * contains the vertices that make up the 'n'th face.
672  *
673  * Return value
674  * The number of vertices that make up the 'n'th polygonal face
675  */
676 size_t obj_polygonal_v_face_vertices(obj_contents_t contents, size_t n,
677  const size_t (*index_arr[]));
678 
679 /**
680  * Obtain the list of polygonal attributes for all textured polygonal faces
681  * in 'contents'
682  *
683  * Copy a pointer to an index array to the location pointed to by attindex_arr
684  * and return the list length.
685  *
686  * The value of the ith element in 'attindex_arr' is the index into the
687  * 'attr_list' obtained from obj_polygonal_attributes describing the
688  * polygonal attributes for the ith face.
689  *
690  * Return value
691  * The total number of textured polygonal faces
692  */
693 size_t obj_polygonal_tv_faces(obj_contents_t contents,
694  const size_t (*attindex_arr[]));
695 
696 /**
697  * Obtain the textured coordinate and vertex indices for the 'n'th textured
698  * polygonal face in 'contents'
699  *
700  * Copy a pointer to the 'n'th multidimensional index array to the location
701  * pointed to by 'index_arr' and return the length of the array.
702  *
703  * The face indices are contained in an array of type const size_t[][2] and
704  * must not be modified by the caller. The format of the second dimension is:
705  * {vertex_index, texture_coordinate_index}
706  *
707  * Return value
708  * The number of vertices that make up the 'n'th polygonal face
709  */
710 size_t obj_polygonal_tv_face_vertices(obj_contents_t contents, size_t face,
711  const size_t (*index_arr[])[2]);
712 
713 /**
714  * Obtain the list of polygonal attributes for all oriented polygonal faces
715  * in 'contents'
716  *
717  * Copy a pointer to an index array to the location pointed to by attindex_arr
718  * and return the list length.
719  *
720  * The value of the ith element in 'attindex_arr' is the index into the
721  * 'attr_list' obtained from obj_polygonal_attributes describing the
722  * polygonal attributes for the ith face.
723  *
724  * Return value
725  * The total number of oriented polygonal faces
726  */
727 size_t obj_polygonal_nv_faces(obj_contents_t contents,
728  const size_t (*attindex_arr[]));
729 
730 /**
731  * Obtain the normal and vertex indices for the 'n'th oriented polygonal face
732  * in 'contents'
733  *
734  * Copy a pointer to the 'n'th multidimensional index array to the location
735  * pointed to by 'index_arr' and return the length of the array.
736  *
737  * The face indices are contained in an array of type const size_t[][2] and
738  * must not be modified by the caller. The format of the second dimension is:
739  * {vertex_index, normal_index}
740  *
741  * Return value
742  * The number of vertices that make up the 'n'th polygonal face
743  */
744 size_t obj_polygonal_nv_face_vertices(obj_contents_t contents, size_t face,
745  const size_t (*index_arr[])[2]);
746 
747 /**
748  * Obtain the list of polygonal attributes for all textured and oriented
749  * polygonal faces in 'contents'
750  *
751  * Copy a pointer to an index array to the location pointed to by attindex_arr
752  * and return the list length.
753  *
754  * The value of the ith element in 'attindex_arr' is the index into the
755  * 'attr_list' obtained from obj_polygonal_attributes describing the
756  * polygonal attributes for the ith face.
757  *
758  * Return value
759  * The total number of textured oriented polygonal faces
760  */
762  const size_t (*attindex_arr[]));
763 
764 /**
765  * Obtain the texture coordinate, normal and vertex indices for the 'n'th
766  * textured and oriented polygonal face in 'contents'
767  *
768  * Copy a pointer to the 'n'th multidimensional index array to the location
769  * pointed to by 'index_arr' and return the length of the array.
770  *
771  * The face indices are contained in an array of type const size_t[][3] and
772  * must not be modified by the caller. The format of the second dimension is:
773  * {vertex_index, texture_coordinate_index, normal_index}
774  *
775  * Return value
776  * The number of vertices that make up the 'n'th polygonal face
777  */
778 size_t obj_polygonal_tnv_face_vertices(obj_contents_t contents, size_t face,
779  const size_t (*index_arr[])[3]);
780 
782 
783 #endif
784 
785 /*
786  * Local Variables:
787  * tab-width: 8
788  * mode: C
789  * indent-tabs-mode: t
790  * c-file-style: "stroustrup"
791  * End:
792  * ex: shiftwidth=4 tabstop=8
793  */
size_t obj_polygonal_v_points(obj_contents_t contents, const size_t(*attindex_arr[]))
Definition: obj_parser.cpp:674
char filename[MAXLENGTH]
Definition: human.c:105
size_t obj_polygonal_tv_faces(obj_contents_t contents, const size_t(*attindex_arr[]))
Definition: obj_parser.cpp:839
size_t obj_polygonal_nv_faces(obj_contents_t contents, const size_t(*attindex_arr[]))
Definition: obj_parser.cpp:881
void * p
Definition: obj_parser.h:39
size_t obj_materiallibset(obj_contents_t contents, size_t n, const size_t(*index_arr[]))
Definition: obj_parser.cpp:524
size_t obj_polygonal_v_line_vertices(obj_contents_t contents, size_t n, const size_t(*index_arr[]))
Definition: obj_parser.cpp:734
Header file for the BRL-CAD common definitions.
const char * obj_parse_error(obj_parser_t parser)
Definition: obj_parser.cpp:306
size_t obj_materiallibs(obj_contents_t contents, const char *const (*val_arr[]))
Definition: obj_parser.cpp:489
size_t obj_groupset(obj_contents_t contents, size_t n, const size_t(*index_arr[]))
Definition: obj_parser.cpp:431
size_t obj_texmaplibset(obj_contents_t contents, size_t set, const size_t(*index_arr[]))
Definition: obj_parser.cpp:596
#define __BEGIN_DECLS
Definition: common.h:73
size_t obj_num_texmaplibsets(obj_contents_t contents)
Definition: obj_parser.cpp:581
void obj_parser_destroy(obj_parser_t parser)
Definition: obj_parser.cpp:178
size_t obj_texmaps(obj_contents_t contents, const char *const (*val_arr[]))
Definition: obj_parser.cpp:543
size_t obj_shadow_objs(obj_contents_t contents, const char *const (*val_arr[]))
Definition: obj_parser.cpp:616
size_t obj_polygonal_tv_lines(obj_contents_t contents, const size_t(*attindex_arr[]))
Definition: obj_parser.cpp:754
size_t obj_polygonal_tv_line_vertices(obj_contents_t contents, size_t face, const size_t(*index_arr[])[2])
Definition: obj_parser.cpp:774
size_t obj_texture_coord(obj_contents_t contents, const float(*val_arr[])[3])
Definition: obj_parser.cpp:357
size_t obj_polygonal_v_point_vertices(obj_contents_t contents, size_t n, const size_t(*index_arr[]))
Definition: obj_parser.cpp:694
size_t obj_polygonal_v_lines(obj_contents_t contents, const size_t(*attindex_arr[]))
Definition: obj_parser.cpp:714
size_t obj_polygonal_nv_face_vertices(obj_contents_t contents, size_t face, const size_t(*index_arr[])[2])
Definition: obj_parser.cpp:901
size_t obj_groups(obj_contents_t contents, const char *const (*val_arr[]))
Definition: obj_parser.cpp:397
size_t obj_polygonal_tnv_face_vertices(obj_contents_t contents, size_t face, const size_t(*index_arr[])[3])
Definition: obj_parser.cpp:942
size_t obj_num_materiallibsets(obj_contents_t contents)
Definition: obj_parser.cpp:509
int obj_contents_destroy(obj_contents_t contents)
Definition: obj_parser.cpp:324
size_t obj_num_groupsets(obj_contents_t contents)
Definition: obj_parser.cpp:416
size_t obj_materials(obj_contents_t contents, const char *const (*val_arr[]))
Definition: obj_parser.cpp:470
int obj_fparse(FILE *stream, obj_parser_t parser, obj_contents_t *contents)
Definition: obj_parser.cpp:250
size_t obj_objects(obj_contents_t contents, const char *const (*val_arr[]))
Definition: obj_parser.cpp:451
size_t obj_polygonal_v_face_vertices(obj_contents_t contents, size_t n, const size_t(*index_arr[]))
Definition: obj_parser.cpp:815
size_t obj_polygonal_tv_face_vertices(obj_contents_t contents, size_t face, const size_t(*index_arr[])[2])
Definition: obj_parser.cpp:859
size_t obj_trace_objs(obj_contents_t contents, const char *const (*val_arr[]))
Definition: obj_parser.cpp:635
size_t obj_vertices(obj_contents_t contents, const float(*val_arr[])[4])
Definition: obj_parser.cpp:337
size_t obj_polygonal_tnv_faces(obj_contents_t contents, const size_t(*attindex_arr[]))
Definition: obj_parser.cpp:922
int obj_parser_create(obj_parser_t *parser)
Definition: obj_parser.cpp:162
#define __END_DECLS
Definition: common.h:74
size_t obj_polygonal_v_faces(obj_contents_t contents, const size_t(*attindex_arr[]))
Definition: obj_parser.cpp:795
int obj_parse(const char *filename, obj_parser_t parser, obj_contents_t *contents)
Definition: obj_parser.cpp:189
size_t obj_texmaplibs(obj_contents_t contents, const char *const (*val_arr[]))
Definition: obj_parser.cpp:562
size_t obj_polygonal_attributes(obj_contents_t contents, const obj_polygonal_attributes_t(*attr_list[]))
Definition: obj_parser.cpp:654
size_t obj_normals(obj_contents_t contents, const float(*val_arr[])[3])
Definition: obj_parser.cpp:377