- template<typename Iter>
- void render(const ObjectPass &pass, Iter begin, Iter end) const
- {
- setup_render(pass);
- for(Iter i=begin; i!=end; ++i)
- render_instance(pass, **i);
- finish_render(pass);
- }
+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 Matrix *get_matrix() const { return &identity_matrix; }
+ virtual const Geometry::BoundingSphere<float, 3> *get_bounding_sphere() const { return &bounding_sphere; }
+
+ 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;