53 #ifndef ACG_OBJ_NODE_HH 54 #define ACG_OBJ_NODE_HH 59 #include "BaseNode.hh" 60 #include "DrawModes.hh" 61 #include "../Math/VectorT.hh" 86 const std::string& _name=
"<OBJNode>" )
102 void boundingBox(
Vec3d& _bbMin,
Vec3d& _bbMax);
113 Face(
int _i0=-1,
int _i1=-1,
int _i2=-1,
114 int _t0=-1,
int _t1=-1,
int _t2=-1)
115 : i0(_i0), i1(_i1), i2(_i2),
116 t0(_t0), t1(_t1), t2(_t2) {}
117 int i0, i1, i2, t0, t1, t2;
124 size_t n_faces()
const {
return faces_.size(); }
144 vertices_.push_back(_v);
145 return vertices_.size()-1;
152 faces_.push_back(_f);
153 return faces_.size()-1;
161 faces_.push_back(
Face(_i0, _i1, _i2));
162 return faces_.size()-1;
169 assert(_i < n_vertices());
170 return vertices_[_i];
175 assert(_i < n_vertices());
176 return vertices_[_i];
183 assert(_i < n_faces());
189 assert(_i < n_faces());
197 assert(_i < n_normals());
203 assert(_i < n_normals());
209 bool read(
const std::string& _filename);
213 void update_face_normals();
218 void draw_obj()
const;
219 void draw_obj_tex()
const;
221 std::vector<Vec3f> vertices_;
222 std::vector<Vec3f> normals_;
223 std::vector<Vec2f> texCoords_;
224 std::vector<Face> faces_;
232 #endif // ACG_OBJ_NODE_HH Vec3f & vertex(unsigned int _i)
get i'th vertex
Namespace providing different geometric functions concerning angles.
size_t n_faces() const
number of faces
const Vec3f & normal(unsigned int _i) const
get i'th normal
Face & face(unsigned int _i)
get i'th face
size_t n_normals() const
number of normals
virtual ~OBJNode()
destructor
Vec3f & normal(unsigned int _i)
get i'th normal
size_t add_face(unsigned int _i0, unsigned int _i1, unsigned int _i2)
add triangle
const Face & face(unsigned int _i) const
get i'th face
size_t n_vertices() const
number of vertices
void clear()
clear the node
PickTarget
What target to use for picking.
size_t add_vertex(const Vec3f &_v)
add vertex
size_t n_texcoords() const
number of texcoords
const Vec3f & vertex(unsigned int _i) const
get i'th vertex
OBJNode(BaseNode *_parent=0, const std::string &_name="<OBJNode>")
Default constructor.
size_t add_face(const Face &_f)
add triangle