- void setup_render(const ObjectPass &) const;
- void finish_render(const ObjectPass &) const;
- void render(const ObjectPass &, const ObjectInstance *) const;
- void render(const ObjectPass &, const std::list<const ObjectInstance *> &) const;
+ LevelOfDetail &get_lod(unsigned, const char *);
+
+public:
+ /** Sets the mesh for the highest level of detail (index 0). */
+ void set_mesh(const Mesh *m) { set_mesh(0, m); }
+
+ /** Sets the mesh for a given level of detail. Previous LoDs must have been
+ defined. */
+ void set_mesh(unsigned, const Mesh *);
+
+private:
+ void update_bounding_sphere();
+public:
+ const Mesh *get_mesh(unsigned = 0) const;
+
+ /** Sets the technique for the highest level of detail (index 0). */
+ void set_technique(const Technique *t) { set_technique(0, t); }
+
+ /** Sets the technique for a given level of detail. Previous LoDs must have
+ been defined. */
+ void set_technique(unsigned, const Technique *);
+
+ const Technique *get_technique(unsigned = 0) const;
+ unsigned get_n_lods() const { return lods.size(); }
+
+ virtual const Geometry::BoundingSphere<float, 3> *get_bounding_sphere() const { return &bounding_sphere; }
+
+ virtual void render(const Tag &tag = Tag()) const;
+
+ virtual void render(Renderer &, const Tag & = Tag()) const;
+
+ /** Renders an instance of the object. The instance's hook functions are
+ called before and after drawing the mesh. */
+ virtual void render(Renderer &, const ObjectInstance &, const Tag & = Tag()) const;
+
+protected:
+ virtual void setup_render(Renderer &, const Tag &) const { }
+ virtual void finish_render(Renderer &, const Tag &) const { }
+
+private:
+ const RenderPass *get_pass(const Tag &, unsigned) const;
+
+ virtual void resource_loaded(Resource &);
+ virtual void resource_removed(Resource &);