1 #ifndef MSP_GL_OBJETCINSTANCE_H_
2 #define MSP_GL_OBJETCINSTANCE_H_
12 Represents a single instance of an Object. A model matrix is provided through
13 the Placeable base class.
15 The state used to render the object can be customized by overriding the
16 setup_render() and finish_render() functions.
18 class ObjectInstance: public PlacedRenderable
21 class Loader: public DataFile::ObjectLoader<ObjectInstance>
24 Loader(ObjectInstance &);
34 ObjectInstance(const Object &);
36 const Object &get_object() const { return object; }
38 virtual const Geometry::BoundingSphere<float, 3> *get_bounding_sphere() const { return object.get_bounding_sphere(); }
40 virtual void render(Renderer &, Tag = Tag()) const;
42 /** Hook function, called from Object just before rendering the mesh.
43 Renderer state will have been pushed before this is called. */
44 virtual void setup_render(Renderer &, Tag) const;
46 /** Hook function, called from Object right after rendering the mesh. Since
47 Object takes care of pushing Renderer state, this rarely needs to do
49 virtual void finish_render(Renderer &, Tag) const { }
51 /** Returns the level of detail to render this instance with. This function
52 should apply LoD bias from the Renderer if desired. */
53 virtual unsigned get_level_of_detail(const Renderer &) const;