goat3dgfx

annotate src/object.h @ 20:d9c8cd19c606

fixed the face index loading bug
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 08 Dec 2013 03:00:49 +0200
parents 1873dfd13f2d
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@15 9 namespace goatgfx {
nuclear@15 10
nuclear@0 11 enum DrawMode {
nuclear@0 12 DRAW_DEFAULT,
nuclear@0 13 DRAW_WIREFRAME,
nuclear@0 14 DRAW_VERTICES
nuclear@0 15 };
nuclear@0 16
nuclear@0 17
nuclear@0 18 class Object : public XFormNode {
nuclear@0 19 private:
nuclear@0 20 Mesh *mesh; ///< no ownership, just keeping the pointer around
nuclear@0 21 static DrawMode draw_mode;
nuclear@0 22
nuclear@0 23 bool setup_bones(long msec) const;
nuclear@0 24
nuclear@0 25 public:
nuclear@0 26 Material material;
nuclear@0 27
nuclear@0 28 Object();
nuclear@0 29
nuclear@0 30 /// destroy this object and all the hierarchy of objects hanging below it
nuclear@0 31 void destroy_all();
nuclear@0 32
nuclear@0 33 void set_mesh(Mesh *m);
nuclear@0 34 Mesh *get_mesh();
nuclear@0 35 const Mesh *get_mesh() const;
nuclear@0 36
nuclear@0 37 /// get all the meshes of the subtree rooted in this object @{
nuclear@0 38 std::list<Mesh*> get_all_meshes();
nuclear@0 39 std::list<const Mesh*> get_all_meshes() const;
nuclear@0 40 /// @}
nuclear@0 41
nuclear@0 42 AABox get_aabbox() const;
nuclear@0 43 Sphere get_bsphere() const;
nuclear@0 44
nuclear@0 45 void draw(long msec = 0) const;
nuclear@0 46
nuclear@0 47 bool intersect(const Ray &ray, HitPoint *hit = 0) const;
nuclear@0 48
nuclear@0 49 /// this is mostly for tools, to allow drawing only the wireframe or vertices
nuclear@0 50 static DrawMode set_draw_mode(DrawMode mode);
nuclear@0 51 };
nuclear@0 52
nuclear@15 53 } // namespace goatgfx
nuclear@15 54
nuclear@0 55 #endif // OBJECT_H_