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