1 #ifndef MSP_GL_OBJETCINSTANCE_H_
2 #define MSP_GL_OBJETCINSTANCE_H_
5 #include "renderable.h"
14 Represents a single instance of an Object. A derived class can overload the
15 hook functions to specify a model matrix and other instance-specific parameters
16 for the rendered objects.
18 ObjectInstances can benefit from being put in an InstanceScene, which will
19 render all instances of the same object consecutively.
21 class ObjectInstance: public Renderable
27 ObjectInstance(const Object &);
29 const Object &get_object() const { return object; }
30 virtual long get_instance_key() const { return reinterpret_cast<long>(&object); }
32 virtual void render(const Tag &tag = Tag()) const;
33 virtual void render(Renderer &, const Tag & = Tag()) const;
35 /** Hook function, called from Object just before rendering the mesh.
36 Renderer state will have been pushed before this is called. */
37 virtual void setup_render(Renderer &, const Tag &) const { }
39 /** Hook function, called from Object right after rendering the mesh. Since
40 Object takes care of pushing Renderer state, this rarely needs to do
42 virtual void finish_render(Renderer &, const Tag &) const { }
44 virtual unsigned get_level_of_detail(const Renderer &) const { return 0; }