18 #include <boost/lexical_cast.hpp> 35 fileIn.open(_fName.c_str());
36 if (!fileIn.is_open())
38 std::cout <<
"File : "<<_fName<<
" Not founds "<<std::endl;
87 std::ifstream& _stream
95 getline(_stream,lineBuffer,
'\n');
97 boost::char_separator<char> sep(
" \t\r\n");
99 if(*tokens.begin() !=
"PGEOMETRY")
101 std::cerr<<
"Not a valid Houdini geo file first line should be PGEOMETRY version"<<std::endl;
105 getline(_stream,lineBuffer,
'\n');
106 tokenizer pointPrimTokens(lineBuffer,sep);
111 tokenizer::iterator firstWord = pointPrimTokens.begin();
114 m_nVerts=boost::lexical_cast<
int>(*firstWord);
121 m_nFaces =boost::lexical_cast<
int>(*firstWord);
127 getline(_stream,lineBuffer,
'\n');
132 getline(_stream,lineBuffer,
'\n');
136 std::cerr<<lineBuffer<<std::endl;
137 firstWord = attribTokens.begin();
147 std::cerr<<
"Finished Reading Header"<<std::endl;
152 std::ifstream& _stream
176 boost::char_separator<char> sep(
" \t\r\n()");
177 tokenizer::iterator firstWord;
178 tokenizer::iterator lastWord;
181 for (
unsigned int i=0; i<
m_nVerts; ++i)
183 getline(_stream,lineBuffer,
'\n');
186 firstWord=pointTokens.begin();
187 lastWord=pointTokens.end();
189 float x=boost::lexical_cast<
float>(*firstWord++);
190 float y=boost::lexical_cast<
float>(*firstWord++);
191 float z=boost::lexical_cast<
float>(*firstWord++);
192 float w=boost::lexical_cast<
float>(*firstWord++);
198 std::vector <float>
values;
199 while(firstWord !=lastWord)
201 values.push_back(boost::lexical_cast<float>(*firstWord++));
215 std::ifstream& _stream
219 std::cerr<<
"Loading Attrib Dictionary num attribs"<<
m_nPointAttrib<<std::endl;
220 getline(_stream,lineBuffer,
'\n');
222 if(lineBuffer !=
"PointAttrib")
224 std::cerr<<
"file not in correct format line should read PointAttrib\n";
228 boost::char_separator<char> sep(
" \t\r\n");
229 tokenizer::iterator firstWord;
230 tokenizer::iterator sizeToken;
235 getline(_stream,lineBuffer,
'\n');
236 std::cerr<<
"Found "<<lineBuffer<<std::endl;
241 sizeToken=attribTokens.begin();
243 int size=boost::lexical_cast<
int>(*sizeToken);
248 std::cerr<<
"relIndex "<<relIndex<<std::endl;
249 firstWord=attribTokens.begin();
252 if(*firstWord ==
"N")
260 else if(*firstWord ==
"uv")
275 #warning add new code to do this void loadPoints(std::ifstream &_stream)
a method to load the points from the geo file
bool load(const std::string &_fName, bool _calcBB=true)
the main loader for the geo we will have other methods called from this
a class to hold the dictionary entries for the houdini geo header this will be put into a map for eas...
GLint GLint GLint GLint GLint GLint y
std::vector< Vec3 > m_verts
Pointer to the Vertex list.
int m_nVertAttrib
the number of vertex attributes
HoudiniGeo()
default constructor
void loadPointAttribDictionary(std::ifstream &_stream)
method to load the attribute dictionary from the geo file. At present we are only worried about Norma...
implementation files for RibExport class
boost::tokenizer< boost::char_separator< char > > tokenizer
GLint GLsizei const GLuint64 * values
void drawDebugPoints()
simple debug drawing of points will be removed once class finished
bool m_loaded
flag to indicate if anything loaded for dtor
int m_nPointAttrib
the number of point attributes
GLubyte GLubyte GLubyte GLubyte w
unsigned int m_nVerts
The number of vertices in the object.
inherited from AbstractMesh to load houdini geometry
int m_normalTokenIndex
normal token index used when parsing the geo file
bool loadHeader(std::ifstream &_stream)
method to check the header and see if we have a valid geo file it also reads in the ammount of Points...
unsigned int m_nFaces
the number of faces in the object
std::map< std::string, HouDictionaryEntry * > m_dictionary
map used when parsing the Attribute Data
GLint GLint GLint GLint GLint x
void loadTexture(const std::string &_fname) noexcept
load int a texture and set it as the active texture of the Obj
bool m_vbo
flag to indicate if a VBO has been created
void calcDimensions() noexcept
a method to set the BBox and center
int m_uvTokenIndex
uv token index used when paring the geo file
GLsizei const GLchar *const * string
std::vector< Face > m_face
Pointer to the Face list.