conworlds

view src/object.h @ 13:283cdfa7dda2

added a crapload of code from goat3dgfx
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 24 Aug 2014 09:41:24 +0300
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 AABox get_aabbox() const;
41 Sphere get_bsphere() const;
43 void draw(long msec = 0) const;
45 bool intersect(const Ray &ray, HitPoint *hit = 0) const;
47 /// this is mostly for tools, to allow drawing only the wireframe or vertices
48 static DrawMode set_draw_mode(DrawMode mode);
49 };
51 #endif // OBJECT_H_