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 class ObjectInstance: public PlacedRenderable
19 class Loader: public DataFile::ObjectLoader<ObjectInstance>
22 Loader(ObjectInstance &);
32 ObjectInstance(const Object &);
34 const Object &get_object() const { return object; }
35 virtual IntPtr get_instance_key() const { return reinterpret_cast<IntPtr>(&object); }
37 virtual const Geometry::BoundingSphere<float, 3> *get_bounding_sphere() const { return object.get_bounding_sphere(); }
39 virtual void render(Renderer &, const Tag & = Tag()) const;
41 /** Hook function, called from Object just before rendering the mesh.
42 Renderer state will have been pushed before this is called. */
43 virtual void setup_render(Renderer &, const Tag &) const;
45 /** Hook function, called from Object right after rendering the mesh. Since
46 Object takes care of pushing Renderer state, this rarely needs to do
48 virtual void finish_render(Renderer &, const Tag &) const { }
50 virtual unsigned get_level_of_detail(const Renderer &) const;