1 #ifndef MSP_GL_OBJETCINSTANCE_H_
2 #define MSP_GL_OBJETCINSTANCE_H_
12 Represents a single instance of an Object. Thanks to being derived from
13 Placeable in can be positioned without additional effort. Other instance
14 parameters can be set by overriding the hook functions.
16 ObjectInstances can benefit from being put in an InstanceScene, which will
17 render all instances of the same object consecutively.
19 class ObjectInstance: public PlacedRenderable
22 class Loader: public DataFile::ObjectLoader<ObjectInstance>
25 Loader(ObjectInstance &);
35 ObjectInstance(const Object &);
37 const Object &get_object() const { return object; }
38 virtual IntPtr get_instance_key() const { return reinterpret_cast<IntPtr>(&object); }
40 virtual const Geometry::BoundingSphere<float, 3> *get_bounding_sphere() const { return object.get_bounding_sphere(); }
42 virtual void render(Renderer &, const Tag & = Tag()) const;
44 /** Hook function, called from Object just before rendering the mesh.
45 Renderer state will have been pushed before this is called. */
46 virtual void setup_render(Renderer &, const Tag &) const;
48 /** Hook function, called from Object right after rendering the mesh. Since
49 Object takes care of pushing Renderer state, this rarely needs to do
51 virtual void finish_render(Renderer &, const Tag &) const { }
53 virtual unsigned get_level_of_detail(const Renderer &) const;