goat3dgfx

view src/object.h @ 33:253542d715f4

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