cd_wavefront.cpp
Go to the documentation of this file.
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <assert.h>
5 #include <ctype.h>
6 
7 #pragma warning(disable:4996)
8 
9 #include "cd_wavefront.h"
10 
11 
12 using namespace ConvexDecomposition;
13 
70 #include <vector>
71 
72 namespace ConvexDecomposition
73 {
74 
75 typedef std::vector< int > IntVector;
76 typedef std::vector< double > FloatVector;
77 
78 #if defined(__APPLE__) || defined(__CELLOS_LV2__)
79 #define stricmp(a, b) strcasecmp((a), (b))
80 #endif
81 
82 /*******************************************************************/
83 /******************** InParser.h ********************************/
84 /*******************************************************************/
86 {
87 public:
88  virtual int ParseLine(int lineno,int argc,const char **argv) =0; // return TRUE to continue parsing, return FALSE to abort parsing process
89 };
90 
92 {
93  ST_DATA, // is data
94  ST_HARD, // is a hard separator
95  ST_SOFT, // is a soft separator
96  ST_EOS // is a comment symbol, and everything past this character should be ignored
97 };
98 
100 {
101 public:
103  {
104  Init();
105  }
106 
107  InPlaceParser(char *data,int len)
108  {
109  Init();
110  SetSourceData(data,len);
111  }
112 
113  InPlaceParser(const char *fname)
114  {
115  Init();
116  SetFile(fname);
117  }
118 
119  ~InPlaceParser(void);
120 
121  void Init(void)
122  {
123  mQuoteChar = 34;
124  mData = 0;
125  mLen = 0;
126  mMyAlloc = false;
127  for (int i=0; i<256; i++)
128  {
129  mHard[i] = ST_DATA;
130  mHardString[i*2] = i;
131  mHardString[i*2+1] = 0;
132  }
133  mHard[0] = ST_EOS;
134  mHard[32] = ST_SOFT;
135  mHard[9] = ST_SOFT;
136  mHard[13] = ST_SOFT;
137  mHard[10] = ST_SOFT;
138  }
139 
140  void SetFile(const char *fname); // use this file as source data to parse.
141 
142  void SetSourceData(char *data,int len)
143  {
144  mData = data;
145  mLen = len;
146  mMyAlloc = false;
147  };
148 
149  int Parse(InPlaceParserInterface *callback); // returns true if entire file was parsed, false if it aborted for some reason
150 
151  int ProcessLine(int lineno,char *line,InPlaceParserInterface *callback);
152 
153  const char ** GetArglist(char *source,int &count); // convert source string into an arg list, this is a destructive parse.
154 
155  void SetHardSeparator(char c) // add a hard separator
156  {
157  mHard[c] = ST_HARD;
158  }
159 
160  void SetHard(char c) // add a hard separator
161  {
162  mHard[c] = ST_HARD;
163  }
164 
165 
166  void SetCommentSymbol(char c) // comment character, treated as 'end of string'
167  {
168  mHard[c] = ST_EOS;
169  }
170 
171  void ClearHardSeparator(char c)
172  {
173  mHard[c] = ST_DATA;
174  }
175 
176 
177  void DefaultSymbols(void); // set up default symbols for hard seperator and comment symbol of the '#' character.
178 
179  bool EOS(char c)
180  {
181  if ( mHard[c] == ST_EOS )
182  {
183  return true;
184  }
185  return false;
186  }
187 
188  void SetQuoteChar(char c)
189  {
190  mQuoteChar = c;
191  }
192 
193 private:
194 
195 
196  inline char * AddHard(int &argc,const char **argv,char *foo);
197  inline bool IsHard(char c);
198  inline char * SkipSpaces(char *foo);
199  inline bool IsWhiteSpace(char c);
200  inline bool IsNonSeparator(char c); // non seperator,neither hard nor soft
201 
202  bool mMyAlloc; // whether or not *I* allocated the buffer and am responsible for deleting it.
203  char *mData; // ascii data to parse.
204  int mLen; // length of data
206  char mHardString[256*2];
208 };
209 
210 /*******************************************************************/
211 /******************** InParser.cpp ********************************/
212 /*******************************************************************/
213 void InPlaceParser::SetFile(const char *fname)
214 {
215  if ( mMyAlloc )
216  {
217  free(mData);
218  }
219  mData = 0;
220  mLen = 0;
221  mMyAlloc = false;
222 
223 
224  FILE *fph = fopen(fname,"rb");
225  if ( fph )
226  {
227  fseek(fph,0L,SEEK_END);
228  mLen = ftell(fph);
229  fseek(fph,0L,SEEK_SET);
230  if ( mLen )
231  {
232  mData = (char *) malloc(sizeof(char)*(mLen+1));
233  int ok = fread(mData, mLen, 1, fph);
234  if ( !ok )
235  {
236  free(mData);
237  mData = 0;
238  }
239  else
240  {
241  mData[mLen] = 0; // zero byte terminate end of file marker.
242  mMyAlloc = true;
243  }
244  }
245  fclose(fph);
246  }
247 }
248 
250 {
251  if ( mMyAlloc )
252  {
253  free(mData);
254  }
255 }
256 
257 #define MAXARGS 512
258 
260 {
261  return mHard[c] == ST_HARD;
262 }
263 
264 char * InPlaceParser::AddHard(int &argc,const char **argv,char *foo)
265 {
266  while ( IsHard(*foo) )
267  {
268  const char *hard = &mHardString[*foo*2];
269  if ( argc < MAXARGS )
270  {
271  argv[argc++] = hard;
272  }
273  foo++;
274  }
275  return foo;
276 }
277 
279 {
280  return mHard[c] == ST_SOFT;
281 }
282 
283 char * InPlaceParser::SkipSpaces(char *foo)
284 {
285  while ( !EOS(*foo) && IsWhiteSpace(*foo) ) foo++;
286  return foo;
287 }
288 
290 {
291  if ( !IsHard(c) && !IsWhiteSpace(c) && c != 0 ) return true;
292  return false;
293 }
294 
295 
296 int InPlaceParser::ProcessLine(int lineno,char *line,InPlaceParserInterface *callback)
297 {
298  int ret = 0;
299 
300  const char *argv[MAXARGS];
301  int argc = 0;
302 
303  char *foo = line;
304 
305  while ( !EOS(*foo) && argc < MAXARGS )
306  {
307 
308  foo = SkipSpaces(foo); // skip any leading spaces
309 
310  if ( EOS(*foo) ) break;
311 
312  if ( *foo == mQuoteChar ) // if it is an open quote
313  {
314  foo++;
315  if ( argc < MAXARGS )
316  {
317  argv[argc++] = foo;
318  }
319  while ( !EOS(*foo) && *foo != mQuoteChar ) foo++;
320  if ( !EOS(*foo) )
321  {
322  *foo = 0; // replace close quote with zero byte EOS
323  foo++;
324  }
325  }
326  else
327  {
328 
329  foo = AddHard(argc,argv,foo); // add any hard separators, skip any spaces
330 
331  if ( IsNonSeparator(*foo) ) // add non-hard argument.
332  {
333  bool quote = false;
334  if ( *foo == mQuoteChar )
335  {
336  foo++;
337  quote = true;
338  }
339 
340  if ( argc < MAXARGS )
341  {
342  argv[argc++] = foo;
343  }
344 
345  if ( quote )
346  {
347  while (*foo && *foo != mQuoteChar ) foo++;
348  if ( *foo ) *foo = 32;
349  }
350 
351  // continue..until we hit an eos ..
352  while ( !EOS(*foo) ) // until we hit EOS
353  {
354  if ( IsWhiteSpace(*foo) ) // if we hit a space, stomp a zero byte, and exit
355  {
356  *foo = 0;
357  foo++;
358  break;
359  }
360  else if ( IsHard(*foo) ) // if we hit a hard separator, stomp a zero byte and store the hard separator argument
361  {
362  const char *hard = &mHardString[*foo*2];
363  *foo = 0;
364  if ( argc < MAXARGS )
365  {
366  argv[argc++] = hard;
367  }
368  foo++;
369  break;
370  }
371  foo++;
372  } // end of while loop...
373  }
374  }
375  }
376 
377  if ( argc )
378  {
379  ret = callback->ParseLine(lineno, argc, argv );
380  }
381 
382  return ret;
383 }
384 
385 int InPlaceParser::Parse(InPlaceParserInterface *callback) // returns true if entire file was parsed, false if it aborted for some reason
386 {
387  assert( callback );
388  if ( !mData ) return 0;
389 
390  int ret = 0;
391 
392  int lineno = 0;
393 
394  char *foo = mData;
395  char *begin = foo;
396 
397 
398  while ( *foo )
399  {
400  if ( *foo == 10 || *foo == 13 )
401  {
402  lineno++;
403  *foo = 0;
404 
405  if ( *begin ) // if there is any data to parse at all...
406  {
407  int v = ProcessLine(lineno,begin,callback);
408  if ( v ) ret = v;
409  }
410 
411  foo++;
412  if ( *foo == 10 ) foo++; // skip line feed, if it is in the carraige-return line-feed format...
413  begin = foo;
414  }
415  else
416  {
417  foo++;
418  }
419  }
420 
421  lineno++; // lasst line.
422 
423  int v = ProcessLine(lineno,begin,callback);
424  if ( v ) ret = v;
425  return ret;
426 }
427 
428 
430 {
431  SetHardSeparator(',');
432  SetHardSeparator('(');
433  SetHardSeparator(')');
434  SetHardSeparator('=');
435  SetHardSeparator('[');
436  SetHardSeparator(']');
437  SetHardSeparator('{');
438  SetHardSeparator('}');
439  SetCommentSymbol('#');
440 }
441 
442 
443 const char ** InPlaceParser::GetArglist(char *line,int &count) // convert source string into an arg list, this is a destructive parse.
444 {
445  const char **ret = 0;
446 
447  static const char *argv[MAXARGS];
448  int argc = 0;
449 
450  char *foo = line;
451 
452  while ( !EOS(*foo) && argc < MAXARGS )
453  {
454 
455  foo = SkipSpaces(foo); // skip any leading spaces
456 
457  if ( EOS(*foo) ) break;
458 
459  if ( *foo == mQuoteChar ) // if it is an open quote
460  {
461  foo++;
462  if ( argc < MAXARGS )
463  {
464  argv[argc++] = foo;
465  }
466  while ( !EOS(*foo) && *foo != mQuoteChar ) foo++;
467  if ( !EOS(*foo) )
468  {
469  *foo = 0; // replace close quote with zero byte EOS
470  foo++;
471  }
472  }
473  else
474  {
475 
476  foo = AddHard(argc,argv,foo); // add any hard separators, skip any spaces
477 
478  if ( IsNonSeparator(*foo) ) // add non-hard argument.
479  {
480  bool quote = false;
481  if ( *foo == mQuoteChar )
482  {
483  foo++;
484  quote = true;
485  }
486 
487  if ( argc < MAXARGS )
488  {
489  argv[argc++] = foo;
490  }
491 
492  if ( quote )
493  {
494  while (*foo && *foo != mQuoteChar ) foo++;
495  if ( *foo ) *foo = 32;
496  }
497 
498  // continue..until we hit an eos ..
499  while ( !EOS(*foo) ) // until we hit EOS
500  {
501  if ( IsWhiteSpace(*foo) ) // if we hit a space, stomp a zero byte, and exit
502  {
503  *foo = 0;
504  foo++;
505  break;
506  }
507  else if ( IsHard(*foo) ) // if we hit a hard separator, stomp a zero byte and store the hard separator argument
508  {
509  const char *hard = &mHardString[*foo*2];
510  *foo = 0;
511  if ( argc < MAXARGS )
512  {
513  argv[argc++] = hard;
514  }
515  foo++;
516  break;
517  }
518  foo++;
519  } // end of while loop...
520  }
521  }
522  }
523 
524  count = argc;
525  if ( argc )
526  {
527  ret = argv;
528  }
529 
530  return ret;
531 }
532 
533 /*******************************************************************/
534 /******************** Geometry.h ********************************/
535 /*******************************************************************/
536 
538 {
539 public:
540  double mPos[3];
541  double mNormal[3];
542  double mTexel[2];
543 };
544 
545 
547 {
548 public:
549 
550  virtual void NodeTriangle(const GeometryVertex *v1,const GeometryVertex *v2,const GeometryVertex *v3)
551  {
552  }
553 
554 };
555 
556 
557 /*******************************************************************/
558 /******************** Obj.h ********************************/
559 /*******************************************************************/
560 
561 
563 {
564 public:
565  int LoadMesh(const char *fname,GeometryInterface *callback);
566  int ParseLine(int lineno,int argc,const char **argv); // return TRUE to continue parsing, return FALSE to abort parsing process
567 private:
568 
569  void GetVertex(GeometryVertex &v,const char *face) const;
570 
574 
576  friend class WavefrontObj;
577 };
578 
579 
580 /*******************************************************************/
581 /******************** Obj.cpp ********************************/
582 /*******************************************************************/
583 
584 int OBJ::LoadMesh(const char *fname,GeometryInterface *iface)
585 {
586  int ret = 0;
587 
588  mVerts.clear();
589  mTexels.clear();
590  mNormals.clear();
591 
592  mCallback = iface;
593 
594  InPlaceParser ipp(fname);
595 
596  ipp.Parse(this);
597 
598 
599  return ret;
600 }
601 
602 static const char * GetArg(const char **argv,int i,int argc)
603 {
604  const char * ret = 0;
605  if ( i < argc ) ret = argv[i];
606  return ret;
607 }
608 
609 void OBJ::GetVertex(GeometryVertex &v,const char *face) const
610 {
611  v.mPos[0] = 0;
612  v.mPos[1] = 0;
613  v.mPos[2] = 0;
614 
615  v.mTexel[0] = 0;
616  v.mTexel[1] = 0;
617 
618  v.mNormal[0] = 0;
619  v.mNormal[1] = 1;
620  v.mNormal[2] = 0;
621 
622  int index = atoi( face )-1;
623 
624  const char *texel = strstr(face,"/");
625 
626  if ( texel )
627  {
628  int tindex = atoi( texel+1) - 1;
629 
630  if ( tindex >=0 && tindex < (int)(mTexels.size()/2) )
631  {
632  const double *t = &mTexels[tindex*2];
633 
634  v.mTexel[0] = t[0];
635  v.mTexel[1] = t[1];
636 
637  }
638 
639  const char *normal = strstr(texel+1,"/");
640  if ( normal )
641  {
642  int nindex = atoi( normal+1 ) - 1;
643 
644  if (nindex >= 0 && nindex < (int)(mNormals.size()/3) )
645  {
646  const double *n = &mNormals[nindex*3];
647 
648  v.mNormal[0] = n[0];
649  v.mNormal[1] = n[1];
650  v.mNormal[2] = n[2];
651  }
652  }
653  }
654 
655  if ( index >= 0 && index < (int)(mVerts.size()/3) )
656  {
657 
658  const double *p = &mVerts[index*3];
659 
660  v.mPos[0] = p[0];
661  v.mPos[1] = p[1];
662  v.mPos[2] = p[2];
663  }
664 
665 }
666 
667 int OBJ::ParseLine(int lineno,int argc,const char **argv) // return TRUE to continue parsing, return FALSE to abort parsing process
668 {
669  int ret = 0;
670 
671  if ( argc >= 1 )
672  {
673  const char *foo = argv[0];
674  if ( *foo != '#' )
675  {
676  if ( strcmp(argv[0],"v") == 0 && argc == 4 )
677  {
678  double vx = (double) atof( argv[1] );
679  double vy = (double) atof( argv[2] );
680  double vz = (double) atof( argv[3] );
681  mVerts.push_back(vx);
682  mVerts.push_back(vy);
683  mVerts.push_back(vz);
684  }
685  else if ( strcmp(argv[0],"vt") == 0 && argc == 3 )
686  {
687  double tx = (double) atof( argv[1] );
688  double ty = (double) atof( argv[2] );
689  mTexels.push_back(tx);
690  mTexels.push_back(ty);
691  }
692  else if ( strcmp(argv[0],"vn") == 0 && argc == 4 )
693  {
694  double normalx = (double) atof(argv[1]);
695  double normaly = (double) atof(argv[2]);
696  double normalz = (double) atof(argv[3]);
697  mNormals.push_back(normalx);
698  mNormals.push_back(normaly);
699  mNormals.push_back(normalz);
700  }
701  else if ( strcmp(argv[0],"f") == 0 && argc >= 4 )
702  {
703  GeometryVertex v[32];
704 
705  int vcount = argc-1;
706 
707  for (int i=1; i<argc; i++)
708  {
709  GetVertex(v[i-1],argv[i] );
710  }
711 
712  // need to generate a normal!
713 #if 0 // not currently implemented
714  if ( mNormals.empty() )
715  {
716  Vector3d<double> p1( v[0].mPos );
717  Vector3d<double> p2( v[1].mPos );
718  Vector3d<double> p3( v[2].mPos );
719 
721  n.ComputeNormal(p3,p2,p1);
722 
723  for (int i=0; i<vcount; i++)
724  {
725  v[i].mNormal[0] = n.x;
726  v[i].mNormal[1] = n.y;
727  v[i].mNormal[2] = n.z;
728  }
729 
730  }
731 #endif
732 
733  mCallback->NodeTriangle(&v[0],&v[1],&v[2]);
734 
735  if ( vcount >=3 ) // do the fan
736  {
737  for (int i=2; i<(vcount-1); i++)
738  {
739  mCallback->NodeTriangle(&v[0],&v[i],&v[i+1]);
740  }
741  }
742 
743  }
744  }
745  }
746 
747  return ret;
748 }
749 
750 
751 
752 
754 {
755 public:
756 
757  int GetIndex(const double *p)
758  {
759 
760  int vcount = mVertices.size()/3;
761 
762  if(vcount>0)
763  {
764  //New MS STL library checks indices in debug build, so zero causes an assert if it is empty.
765  const double *v = &mVertices[0];
766 
767  for (int i=0; i<vcount; i++)
768  {
769  if ( v[0] == p[0] && v[1] == p[1] && v[2] == p[2] ) return i;
770  v+=3;
771  }
772  }
773 
774  mVertices.push_back( p[0] );
775  mVertices.push_back( p[1] );
776  mVertices.push_back( p[2] );
777 
778  return vcount;
779  }
780 
781  virtual void NodeTriangle(const GeometryVertex *v1,const GeometryVertex *v2,const GeometryVertex *v3)
782  {
783  mIndices.push_back( GetIndex(v1->mPos) );
784  mIndices.push_back( GetIndex(v2->mPos) );
785  mIndices.push_back( GetIndex(v3->mPos) );
786  }
787 
788  const FloatVector& GetVertices(void) const { return mVertices; };
789  const IntVector& GetIndices(void) const { return mIndices; };
790 
791 private:
794 };
795 
796 
798 {
799  mVertexCount = 0;
800  mTriCount = 0;
801  mIndices = 0;
802  mVertices = 0;
803 }
804 
806 {
807  delete mIndices;
808  delete mVertices;
809 }
810 
811 unsigned int WavefrontObj::loadObj(const char *fname) // load a wavefront obj returns number of triangles that were loaded. Data is persists until the class is destructed.
812 {
813 
814  unsigned int ret = 0;
815 
816  delete mVertices;
817  mVertices = 0;
818  delete mIndices;
819  mIndices = 0;
820  mVertexCount = 0;
821  mTriCount = 0;
822 
823 
824  BuildMesh bm;
825 
826  OBJ obj;
827 
828  obj.LoadMesh(fname,&bm);
829 
830 
831  const FloatVector &vlist = bm.GetVertices();
832  const IntVector &indices = bm.GetIndices();
833  if ( vlist.size() )
834  {
835  mVertexCount = vlist.size()/3;
836  mVertices = new double[mVertexCount*3];
837  memcpy( mVertices, &vlist[0], sizeof(double)*mVertexCount*3 );
838  mTriCount = indices.size()/3;
839  mIndices = new int[mTriCount*3*sizeof(int)];
840  memcpy(mIndices, &indices[0], sizeof(int)*mTriCount*3);
841  ret = mTriCount;
842  }
843  else if( obj.mVerts.size() > 0 ) {
844  // take consecutive vertices
845  mVertexCount = obj.mVerts.size()/3;
846  mVertices = new double[mVertexCount*3];
847  memcpy( mVertices, &obj.mVerts[0], sizeof(double)*mVertexCount*3 );
849  mIndices = new int[mTriCount*3*sizeof(int)];
850  for(int i = 0; i < mVertexCount; ++i)
851  mIndices[i] = i;
852  ret = mTriCount;
853  }
854 
855  return ret;
856 }
857 
858 };
ConvexDecomposition::Vector3d< double >
ConvexDecomposition::WavefrontObj::mIndices
int * mIndices
Definition: cd_wavefront.h:76
ConvexDecomposition::OBJ::LoadMesh
int LoadMesh(const char *fname, GeometryInterface *callback)
Definition: cd_wavefront.cpp:584
ConvexDecomposition::WavefrontObj::loadObj
unsigned int loadObj(const char *fname)
Definition: cd_wavefront.cpp:811
ConvexDecomposition::Vector3d::y
Type y
Definition: cd_vector.h:897
MAXARGS
#define MAXARGS
Definition: cd_wavefront.cpp:257
ConvexDecomposition::BuildMesh::mIndices
IntVector mIndices
Definition: cd_wavefront.cpp:793
ConvexDecomposition::InPlaceParser::mMyAlloc
bool mMyAlloc
Definition: cd_wavefront.cpp:202
ConvexDecomposition::InPlaceParser::Init
void Init(void)
Definition: cd_wavefront.cpp:121
ConvexDecomposition::BuildMesh::NodeTriangle
virtual void NodeTriangle(const GeometryVertex *v1, const GeometryVertex *v2, const GeometryVertex *v3)
Definition: cd_wavefront.cpp:781
ConvexDecomposition::ST_DATA
@ ST_DATA
Definition: cd_wavefront.cpp:93
ConvexDecomposition::InPlaceParser::SetSourceData
void SetSourceData(char *data, int len)
Definition: cd_wavefront.cpp:142
ConvexDecomposition::Vector3d::ComputeNormal
double ComputeNormal(const Vector3d< double > &A, const Vector3d< double > &B, const Vector3d< double > &C)
Definition: cd_vector.h:206
ConvexDecomposition::InPlaceParser::EOS
bool EOS(char c)
Definition: cd_wavefront.cpp:179
ConvexDecomposition::InPlaceParser::mData
char * mData
Definition: cd_wavefront.cpp:203
ConvexDecomposition::GeometryVertex::mTexel
double mTexel[2]
Definition: cd_wavefront.cpp:542
ConvexDecomposition::InPlaceParser::IsNonSeparator
bool IsNonSeparator(char c)
Definition: cd_wavefront.cpp:289
ConvexDecomposition::InPlaceParser::SetHard
void SetHard(char c)
Definition: cd_wavefront.cpp:160
ConvexDecomposition::InPlaceParser::Parse
int Parse(InPlaceParserInterface *callback)
Definition: cd_wavefront.cpp:385
ConvexDecomposition::Vector3d::z
Type z
Definition: cd_vector.h:898
ConvexDecomposition::InPlaceParserInterface
Definition: cd_wavefront.cpp:85
ConvexDecomposition::InPlaceParser::InPlaceParser
InPlaceParser(char *data, int len)
Definition: cd_wavefront.cpp:107
ConvexDecomposition::InPlaceParserInterface::ParseLine
virtual int ParseLine(int lineno, int argc, const char **argv)=0
ConvexDecomposition::WavefrontObj
Definition: cd_wavefront.h:65
ConvexDecomposition::SeparatorType
SeparatorType
Definition: cd_wavefront.cpp:91
ConvexDecomposition::OBJ::mCallback
GeometryInterface * mCallback
Definition: cd_wavefront.cpp:575
ConvexDecomposition::WavefrontObj::~WavefrontObj
~WavefrontObj(void)
Definition: cd_wavefront.cpp:805
ConvexDecomposition::OBJ::ParseLine
int ParseLine(int lineno, int argc, const char **argv)
Definition: cd_wavefront.cpp:667
ConvexDecomposition::IntVector
std::vector< int > IntVector
Definition: cd_wavefront.cpp:75
ConvexDecomposition::GetArg
static const char * GetArg(const char **argv, int i, int argc)
Definition: cd_wavefront.cpp:602
cd_wavefront.h
ConvexDecomposition::InPlaceParser::~InPlaceParser
~InPlaceParser(void)
Definition: cd_wavefront.cpp:249
ConvexDecomposition
Definition: bestfit.cpp:75
ConvexDecomposition::InPlaceParser::InPlaceParser
InPlaceParser(void)
Definition: cd_wavefront.cpp:102
ConvexDecomposition::InPlaceParser::IsHard
bool IsHard(char c)
Definition: cd_wavefront.cpp:259
ConvexDecomposition::InPlaceParser::ProcessLine
int ProcessLine(int lineno, char *line, InPlaceParserInterface *callback)
Definition: cd_wavefront.cpp:296
ConvexDecomposition::Vector3d::x
Type x
Definition: cd_vector.h:896
ConvexDecomposition::OBJ::mVerts
FloatVector mVerts
Definition: cd_wavefront.cpp:571
ConvexDecomposition::InPlaceParser::mLen
int mLen
Definition: cd_wavefront.cpp:204
ConvexDecomposition::InPlaceParser::IsWhiteSpace
bool IsWhiteSpace(char c)
Definition: cd_wavefront.cpp:278
ConvexDecomposition::OBJ
Definition: cd_wavefront.cpp:562
ConvexDecomposition::InPlaceParser::mHardString
char mHardString[256 *2]
Definition: cd_wavefront.cpp:206
ConvexDecomposition::GeometryVertex::mNormal
double mNormal[3]
Definition: cd_wavefront.cpp:541
ConvexDecomposition::InPlaceParser::DefaultSymbols
void DefaultSymbols(void)
Definition: cd_wavefront.cpp:429
ConvexDecomposition::WavefrontObj::mVertexCount
int mVertexCount
Definition: cd_wavefront.h:74
ConvexDecomposition::InPlaceParser::AddHard
char * AddHard(int &argc, const char **argv, char *foo)
Definition: cd_wavefront.cpp:264
ConvexDecomposition::BuildMesh
Definition: cd_wavefront.cpp:753
ConvexDecomposition::GeometryVertex::mPos
double mPos[3]
Definition: cd_wavefront.cpp:540
ConvexDecomposition::InPlaceParser::SetQuoteChar
void SetQuoteChar(char c)
Definition: cd_wavefront.cpp:188
ConvexDecomposition::InPlaceParser::SetFile
void SetFile(const char *fname)
Definition: cd_wavefront.cpp:213
ConvexDecomposition::InPlaceParser::mHard
SeparatorType mHard[256]
Definition: cd_wavefront.cpp:205
ConvexDecomposition::BuildMesh::mVertices
FloatVector mVertices
Definition: cd_wavefront.cpp:789
ConvexDecomposition::InPlaceParser
Definition: cd_wavefront.cpp:99
ConvexDecomposition::GeometryVertex
Definition: cd_wavefront.cpp:537
ConvexDecomposition::ST_SOFT
@ ST_SOFT
Definition: cd_wavefront.cpp:95
ConvexDecomposition::InPlaceParser::SkipSpaces
char * SkipSpaces(char *foo)
Definition: cd_wavefront.cpp:283
ConvexDecomposition::ST_EOS
@ ST_EOS
Definition: cd_wavefront.cpp:96
ConvexDecomposition::WavefrontObj::WavefrontObj
WavefrontObj(void)
Definition: cd_wavefront.cpp:797
ConvexDecomposition::GeometryInterface
Definition: cd_wavefront.cpp:546
ConvexDecomposition::BuildMesh::GetIndex
int GetIndex(const double *p)
Definition: cd_wavefront.cpp:757
ConvexDecomposition::InPlaceParser::InPlaceParser
InPlaceParser(const char *fname)
Definition: cd_wavefront.cpp:113
ConvexDecomposition::BuildMesh::GetIndices
const IntVector & GetIndices(void) const
Definition: cd_wavefront.cpp:789
ConvexDecomposition::WavefrontObj::mVertices
double * mVertices
Definition: cd_wavefront.h:77
ConvexDecomposition::OBJ::mTexels
FloatVector mTexels
Definition: cd_wavefront.cpp:572
ConvexDecomposition::OBJ::mNormals
FloatVector mNormals
Definition: cd_wavefront.cpp:573
ConvexDecomposition::InPlaceParser::ClearHardSeparator
void ClearHardSeparator(char c)
Definition: cd_wavefront.cpp:171
ConvexDecomposition::ST_HARD
@ ST_HARD
Definition: cd_wavefront.cpp:94
ConvexDecomposition::OBJ::GetVertex
void GetVertex(GeometryVertex &v, const char *face) const
Definition: cd_wavefront.cpp:609
ConvexDecomposition::FloatVector
std::vector< double > FloatVector
Definition: cd_wavefront.cpp:76
ConvexDecomposition::InPlaceParser::SetHardSeparator
void SetHardSeparator(char c)
Definition: cd_wavefront.cpp:155
ConvexDecomposition::InPlaceParser::mQuoteChar
char mQuoteChar
Definition: cd_wavefront.cpp:207
ConvexDecomposition::InPlaceParser::SetCommentSymbol
void SetCommentSymbol(char c)
Definition: cd_wavefront.cpp:166
ConvexDecomposition::GeometryInterface::NodeTriangle
virtual void NodeTriangle(const GeometryVertex *v1, const GeometryVertex *v2, const GeometryVertex *v3)
Definition: cd_wavefront.cpp:550
ConvexDecomposition::BuildMesh::GetVertices
const FloatVector & GetVertices(void) const
Definition: cd_wavefront.cpp:788
ConvexDecomposition::InPlaceParser::GetArglist
const char ** GetArglist(char *source, int &count)
Definition: cd_wavefront.cpp:443
ConvexDecomposition::WavefrontObj::mTriCount
int mTriCount
Definition: cd_wavefront.h:75


convex_decomposition
Author(s): John W. Ratcliff
autogenerated on Wed Mar 2 2022 00:04:59