59 #ifndef ACG_OBJ_NODE_HH 60 #define ACG_OBJ_NODE_HH 65 #include "BaseNode.hh" 66 #include "DrawModes.hh" 67 #include "../Math/VectorT.hh" 92 std::string _name=
"<OBJNode>" )
108 void boundingBox(
Vec3d& _bbMin,
Vec3d& _bbMax);
119 Face(
int _i0=-1,
int _i1=-1,
int _i2=-1,
120 int _t0=-1,
int _t1=-1,
int _t2=-1)
121 : i0(_i0), i1(_i1), i2(_i2),
122 t0(_t0), t1(_t1), t2(_t2) {}
123 int i0, i1, i2, t0, t1, t2;
130 size_t n_faces()
const {
return faces_.size(); }
150 vertices_.push_back(_v);
151 return vertices_.size()-1;
158 faces_.push_back(_f);
159 return faces_.size()-1;
167 faces_.push_back(
Face(_i0, _i1, _i2));
168 return faces_.size()-1;
175 assert(_i < n_vertices());
176 return vertices_[_i];
181 assert(_i < n_vertices());
182 return vertices_[_i];
189 assert(_i < n_faces());
195 assert(_i < n_faces());
203 assert(_i < n_normals());
209 assert(_i < n_normals());
215 bool read(
const std::string& _filename);
219 void update_face_normals();
224 void draw_obj()
const;
225 void draw_obj_tex()
const;
227 std::vector<Vec3f> vertices_;
228 std::vector<Vec3f> normals_;
229 std::vector<Vec2f> texCoords_;
230 std::vector<Face> faces_;
238 #endif // ACG_OBJ_NODE_HH
size_t n_faces() const
number of faces
size_t n_vertices() const
number of vertices
const Vec3f & vertex(unsigned int _i) const
get i'th vertex
void clear()
clear the node
size_t add_face(unsigned int _i0, unsigned int _i1, unsigned int _i2)
add triangle
PickTarget
What target to use for picking.
size_t add_vertex(const Vec3f &_v)
add vertex
Face & face(unsigned int _i)
get i'th face
const Face & face(unsigned int _i) const
get i'th face
size_t n_texcoords() const
number of texcoords
virtual ~OBJNode()
destructor
OBJNode(BaseNode *_parent=0, std::string _name="<OBJNode>")
Default constructor.
Namespace providing different geometric functions concerning angles.
Vec3f & normal(unsigned int _i)
get i'th normal
size_t add_face(const Face &_f)
add triangle
const Vec3f & normal(unsigned int _i) const
get i'th normal
Vec3f & vertex(unsigned int _i)
get i'th vertex
size_t n_normals() const
number of normals