NGL  6.5
The NCCA Graphics Library
NCCAPointBake.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 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 NCCAPOINTBAKE_H_
18 #define NCCAPOINTBAKE_H_
19 //----------------------------------------------------------------------------------------------------------------------
22 //----------------------------------------------------------------------------------------------------------------------
23 // must include types.h first for Real and GLEW if required
24 #include "Obj.h"
25 #include "Types.h"
26 #include "Vec4.h"
27 #include <vector>
28 #include <string>
29 
30 namespace ngl
31 {
32 //----------------------------------------------------------------------------------------------------------------------
36 
53 //----------------------------------------------------------------------------------------------------------------------
57 
59 {
60 friend class AbstractMesh;
61 public :
62  //----------------------------------------------------------------------------------------------------------------------
64  //----------------------------------------------------------------------------------------------------------------------
65  NCCAPointBake() noexcept;
66  //----------------------------------------------------------------------------------------------------------------------
68  //----------------------------------------------------------------------------------------------------------------------
69  ~NCCAPointBake() noexcept;
70  //----------------------------------------------------------------------------------------------------------------------
73  //----------------------------------------------------------------------------------------------------------------------
74  NCCAPointBake( const std::string &_fileName ) noexcept;
75  //----------------------------------------------------------------------------------------------------------------------
78  //----------------------------------------------------------------------------------------------------------------------
79  void setFrame(const unsigned int frame ) noexcept;
80  //----------------------------------------------------------------------------------------------------------------------
83  //----------------------------------------------------------------------------------------------------------------------
84  bool loadPointBake( const std::string &_fileName) noexcept;
85 
86  //----------------------------------------------------------------------------------------------------------------------
89  //----------------------------------------------------------------------------------------------------------------------
90  bool loadBinaryPointBake(const std::string &_fileName) noexcept;
91  //----------------------------------------------------------------------------------------------------------------------
94  //----------------------------------------------------------------------------------------------------------------------
95  bool saveBinaryPointBake( const std::string &_fileName) noexcept;
96  //----------------------------------------------------------------------------------------------------------------------
102  //----------------------------------------------------------------------------------------------------------------------
103  bool attachMesh(AbstractMesh *_mesh) noexcept;
104  //----------------------------------------------------------------------------------------------------------------------
107  //----------------------------------------------------------------------------------------------------------------------
108  void setMeshToFrame( const unsigned int _frame) noexcept;
109  //----------------------------------------------------------------------------------------------------------------------
112  //----------------------------------------------------------------------------------------------------------------------
113  unsigned int getNumFrames() const noexcept{return m_numFrames-1;}
114  //----------------------------------------------------------------------------------------------------------------------
117  //----------------------------------------------------------------------------------------------------------------------
118  unsigned int getNumVerts() const noexcept{return m_nVerts;}
119  //----------------------------------------------------------------------------------------------------------------------
122  //----------------------------------------------------------------------------------------------------------------------
123  std::vector < std::vector<Vec3> > & getRawDataPointer() noexcept{return m_data;}
124  //----------------------------------------------------------------------------------------------------------------------
128  //----------------------------------------------------------------------------------------------------------------------
129  std::vector<Vec3> & getRawDataPointerAtFrame(unsigned int _f) noexcept;
130 
131 
132 protected :
133  //----------------------------------------------------------------------------------------------------------------------
136  //----------------------------------------------------------------------------------------------------------------------
137  void reorderVerts() noexcept;
138  //----------------------------------------------------------------------------------------------------------------------
140  //----------------------------------------------------------------------------------------------------------------------
141  unsigned int m_numFrames;
142  //----------------------------------------------------------------------------------------------------------------------
144  //----------------------------------------------------------------------------------------------------------------------
145  unsigned int m_currFrame;
146  //----------------------------------------------------------------------------------------------------------------------
149  //----------------------------------------------------------------------------------------------------------------------
150  std::vector < std::vector<Vec3> > m_data;
151  //----------------------------------------------------------------------------------------------------------------------
153  //----------------------------------------------------------------------------------------------------------------------
154  unsigned int m_nVerts;
155  //----------------------------------------------------------------------------------------------------------------------
157  //----------------------------------------------------------------------------------------------------------------------
159  //----------------------------------------------------------------------------------------------------------------------
161  //----------------------------------------------------------------------------------------------------------------------
162  unsigned int m_startFrame;
163  //----------------------------------------------------------------------------------------------------------------------
165  //----------------------------------------------------------------------------------------------------------------------
166  unsigned int m_endFrame;
167  //----------------------------------------------------------------------------------------------------------------------
169  //----------------------------------------------------------------------------------------------------------------------
171  //----------------------------------------------------------------------------------------------------------------------
173  //----------------------------------------------------------------------------------------------------------------------
174  bool m_binFile;
175 }; // end class
176 
177 } // end namespace ngl
178 
179 
180 #endif // end include guard
181 
182 //----------------------------------------------------------------------------------------------------------------------
183 
main definition of types and namespace
#define NGL_DLLEXPORT
Definition: Types.h:65
unsigned int m_startFrame
the start frame
std::vector< std::vector< Vec3 > > m_data
The actual data of the clip stored per vertex in sequence v0 - vn and then per frame frame index is a...
unsigned int getNumVerts() const noexcept
return the number of verts loaded from the PointBake file
std::vector< std::vector< Vec3 > > & getRawDataPointer() noexcept
get a Raw data pointer to the un-sorted PointBake data
Definition: format.h:316
unsigned int m_nVerts
Number of verts in the actual clip.
bool m_binFile
flag to indicate if we have a binary or xml based file loaded
implementation files for RibExport class
Definition: AABB.cpp:22
encapsulates a 4d Homogenous Point / Vector object
an abstract base mesh used to build specific meshes such as Obj
Definition: AbstractMesh.h:105
unsigned int m_numFrames
the number of frames in the clip file
basic obj loader inherits from AbstractMesh
std::string m_meshName
the name of the mesh
AbstractMesh * m_mesh
pointer to mesh attatched to data
unsigned int m_currFrame
Current active frame when animating.
unsigned int m_endFrame
the end frame
Class to load and manipulate NCCAPointBake data, this will replace the Houdini Clip files as they are...
Definition: NCCAPointBake.h:58
GLsizei const GLchar *const * string
Definition: glew.h:1847