conworlds

annotate src/object.h @ 16:7a2041ddb7e7

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