NGL  6.5
The NCCA Graphics Library
HoudiniGeo.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2009 Jon Macey
3 
4  This program is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 #ifndef __HOUDINI_GEO_H__
18 #define __HOUDINI_GEO_H__
19 // must include types.h first for ngl::Real and GLEW if required
20 #include "Types.h"
23 #include "AbstractMesh.h"
24 #include <map>
25 
26 namespace ngl
27 {
28 
29 //----------------------------------------------------------------------------------------------------------------------
37 //----------------------------------------------------------------------------------------------------------------------
39 {
40  public :
41  //----------------------------------------------------------------------------------------------------------------------
43  //----------------------------------------------------------------------------------------------------------------------
45  //----------------------------------------------------------------------------------------------------------------------
47  //----------------------------------------------------------------------------------------------------------------------
48  int m_size;
49  //----------------------------------------------------------------------------------------------------------------------
52  //----------------------------------------------------------------------------------------------------------------------
54  //----------------------------------------------------------------------------------------------------------------------
56  //----------------------------------------------------------------------------------------------------------------------
58  //----------------------------------------------------------------------------------------------------------------------
60  //----------------------------------------------------------------------------------------------------------------------
62  std::string _name,
63  int _size,
64  std::string _type,
65  int _relIndex
66  ):
67  m_name(_name),
68  m_size(_size),
69  m_type(_type),
70  m_relIndex(_relIndex){;}
71  //----------------------------------------------------------------------------------------------------------------------
73  //----------------------------------------------------------------------------------------------------------------------
74  inline void print(){
75  std::cerr<<m_name<<" "<<m_size<<" "<<m_type<<" "<<m_relIndex<<std::endl;
76  }
77  };
78 //----------------------------------------------------------------------------------------------------------------------
79 
80 
81 //----------------------------------------------------------------------------------------------------------------------
89 //----------------------------------------------------------------------------------------------------------------------
90 
92 {
93 public:
94 
95 
96  //----------------------------------------------------------------------------------------------------------------------
98  //----------------------------------------------------------------------------------------------------------------------
100 
101  //----------------------------------------------------------------------------------------------------------------------
104  //----------------------------------------------------------------------------------------------------------------------
105  HoudiniGeo(
106  const std::string& _fName
107  );
108 
109  //----------------------------------------------------------------------------------------------------------------------
113  //----------------------------------------------------------------------------------------------------------------------
114  HoudiniGeo(
115  const std::string& _fName,
116  const std::string& _texName
117  );
118  //----------------------------------------------------------------------------------------------------------------------
120  //----------------------------------------------------------------------------------------------------------------------
121  void drawDebugPoints();
122 
123 protected :
124  //----------------------------------------------------------------------------------------------------------------------
126  //----------------------------------------------------------------------------------------------------------------------
128  //----------------------------------------------------------------------------------------------------------------------
130  //----------------------------------------------------------------------------------------------------------------------
132  //----------------------------------------------------------------------------------------------------------------------
134  //----------------------------------------------------------------------------------------------------------------------
136  //----------------------------------------------------------------------------------------------------------------------
138  //----------------------------------------------------------------------------------------------------------------------
140  //----------------------------------------------------------------------------------------------------------------------
142  //----------------------------------------------------------------------------------------------------------------------
143  std::map <std::string,HouDictionaryEntry *> m_dictionary;
144  //----------------------------------------------------------------------------------------------------------------------
149  //----------------------------------------------------------------------------------------------------------------------
150  bool loadHeader(
151  std::ifstream& _stream
152  );
153  //----------------------------------------------------------------------------------------------------------------------
164  //----------------------------------------------------------------------------------------------------------------------
165  void loadPointAttribDictionary(
166  std::ifstream& _stream
167  );
168 
169 
170  //----------------------------------------------------------------------------------------------------------------------
173  //----------------------------------------------------------------------------------------------------------------------
174  bool load(
175  const std::string &_fName,
176  bool _calcBB=true
177  );
178  //----------------------------------------------------------------------------------------------------------------------
181  //----------------------------------------------------------------------------------------------------------------------
182  void loadPoints(
183  std::ifstream& _stream
184  );
185 
186 };
187 
188 }// end namespace
189 #endif // HOUDINIGEO_H
190 //----------------------------------------------------------------------------------------------------------------------
191 
main definition of types and namespace
void print()
debug print method
Definition: HoudiniGeo.h:74
std::string m_name
the name of the entry will be used for the lookup
Definition: HoudiniGeo.h:44
#define NGL_DLLEXPORT
Definition: Types.h:65
a series of classes used to define an abstract 3D mesh of Faces, Vertex Normals and TexCords ...
a class to hold the dictionary entries for the houdini geo header this will be put into a map for eas...
Definition: HoudiniGeo.h:38
int m_nVertAttrib
the number of vertex attributes
Definition: HoudiniGeo.h:131
HoudiniGeo()
default constructor
Definition: HoudiniGeo.h:99
implementation files for RibExport class
Definition: AABB.cpp:22
HouDictionaryEntry(std::string _name, int _size, std::string _type, int _relIndex)
ctor for the dictionary entry
Definition: HoudiniGeo.h:61
int m_nPointAttrib
the number of point attributes
Definition: HoudiniGeo.h:127
a class to load in the ASCII houdini .geo files for poly data the spec for the format can be found he...
Definition: HoudiniGeo.h:91
an abstract base mesh used to build specific meshes such as Obj
Definition: AbstractMesh.h:105
std::string m_type
the data type as a string float / string int etc used to determine which lexical cast to used ...
Definition: HoudiniGeo.h:53
int m_normalTokenIndex
normal token index used when parsing the geo file
Definition: HoudiniGeo.h:135
int m_size
this determines how many elements the entry has i.e. 3 = x,y,z etc
Definition: HoudiniGeo.h:48
std::map< std::string, HouDictionaryEntry * > m_dictionary
map used when parsing the Attribute Data
Definition: HoudiniGeo.h:143
int m_relIndex
the relative index into the data stream for this data
Definition: HoudiniGeo.h:57
int m_uvTokenIndex
uv token index used when paring the geo file
Definition: HoudiniGeo.h:139
GLsizei const GLchar *const * string
Definition: glew.h:1847