vrshoot

view src/object.h @ 0:b2f14e535253

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 01 Feb 2014 19:58:19 +0200
parents
children
line source
1 #ifndef OBJECT_H_
2 #define OBJECT_H_
4 #include <list>
5 #include "xform_node.h"
6 #include "mesh.h"
7 #include "material.h"
9 enum DrawMode {
10 DRAW_DEFAULT,
11 DRAW_WIREFRAME,
12 DRAW_VERTICES
13 };
16 class Object : public XFormNode {
17 private:
18 Mesh *mesh; ///< no ownership, just keeping the pointer around
19 static DrawMode draw_mode;
21 bool setup_bones(long msec) const;
23 public:
24 Material material;
26 Object();
28 /// destroy this object and all the hierarchy of objects hanging below it
29 void destroy_all();
31 void set_mesh(Mesh *m);
32 Mesh *get_mesh();
33 const Mesh *get_mesh() const;
35 /// get all the meshes of the subtree rooted in this object @{
36 std::list<Mesh*> get_all_meshes();
37 std::list<const Mesh*> get_all_meshes() const;
38 /// @}
40 /// counts the polygons of the mesh of this object and all it's descendants
41 long count_polys() const;
43 AABox get_aabbox() const;
44 Sphere get_bsphere() const;
46 void apply_xform(long msec = 0);
48 void draw(long msec = 0) const;
50 bool intersect(const Ray &ray, HitPoint *hit = 0) const;
52 /// this is mostly for tools, to allow drawing only the wireframe or vertices
53 static DrawMode set_draw_mode(DrawMode mode);
54 };
56 #endif // OBJECT_H_