goat3dgfx

annotate src/object.h @ 13:25bf39105c82

lalal
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 27 Nov 2013 08:08:59 +0200
parents
children 7d6b667821cf
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 AABox get_aabbox() const;
nuclear@0 41 Sphere get_bsphere() const;
nuclear@0 42
nuclear@0 43 void draw(long msec = 0) const;
nuclear@0 44
nuclear@0 45 bool intersect(const Ray &ray, HitPoint *hit = 0) const;
nuclear@0 46
nuclear@0 47 /// this is mostly for tools, to allow drawing only the wireframe or vertices
nuclear@0 48 static DrawMode set_draw_mode(DrawMode mode);
nuclear@0 49 };
nuclear@0 50
nuclear@0 51 #endif // OBJECT_H_