1 #ifndef MSP_GL_OBJECT_H_
2 #define MSP_GL_OBJECT_H_
6 #include "renderable.h"
7 #include "renderpass.h"
19 Combines a Mesh with a Technique to give it an appearance. The Technique will
20 define which render passes the Object supports.
22 In many cases, it's desirable to include multiple copies of an Object in a
23 Scene, with different model matrices. ObjectInstances can be used to alter the
24 rendering of an object on a per-instance basis.
26 class Object: public Renderable
29 class Loader: public DataFile::CollectionObjectLoader<Object>
33 Loader(Object &, Collection &);
36 virtual void finish();
39 void mesh_inline_lod(unsigned);
40 void mesh(const std::string &);
41 void mesh_lod(unsigned, const std::string &);
42 void technique_inline();
43 void technique(const std::string &);
47 std::vector<RefPtr<const Mesh> > meshes;
48 RefPtr<const Technique> technique;
49 Geometry::BoundingSphere<float, 3> bounding_sphere;
53 Object(const Mesh *, const Technique *);
56 void set_mesh(const Mesh *m) { set_mesh(0, m); }
57 void set_mesh(unsigned, const Mesh *);
59 void update_bounding_sphere();
61 const Mesh *get_mesh(unsigned = 0) const;
62 void set_technique(const Technique *);
63 const Technique *get_technique() const { return technique.get(); }
65 virtual const Geometry::BoundingSphere<float, 3> *get_bounding_sphere() const { return &bounding_sphere; }
67 virtual void render(const Tag &tag = Tag()) const;
69 virtual void render(Renderer &, const Tag & = Tag()) const;
71 /** Renders an instance of the object. The instance's hook functions are
72 called before and after drawing the mesh. */
73 virtual void render(Renderer &, const ObjectInstance &, const Tag & = Tag()) const;
76 virtual void setup_render(Renderer &, const Tag &) const { }
77 virtual void finish_render(Renderer &, const Tag &) const { }
80 const RenderPass *get_pass(const Tag &) const;