class Object: public Renderable
{
private:
- std::vector<Mesh *> meshes;
- std::vector<Texture *> textures;
+ std::vector<const Mesh *> meshes;
+ std::vector<const Texture *> textures;
+ const Texture *main_texture;
std::map<unsigned, ObjectPass> passes;
- Material *material;
+ const Material *material;
ObjectPass *normal_pass;
public:
public:
Loader(Object &, Collection &);
- ~Loader();
Object &get_object() const { return obj; }
Collection &get_collection() const { return coll; }
private:
+ virtual void finish();
void lod_mesh(unsigned, const std::string &);
void material_inline();
void mesh(const std::string &);
void pass(const std::string &);
void shader(const std::string &);
+ void shader_texture(const std::string &);
void texture(const std::string &);
};
Each instance's hook functions will be called before and after drawing the
mesh.
*/
- void render(const std::list<const ObjectInstance *> &, const Tag &tag=Tag()) const;
+ template<typename Iter>
+ void render(Iter begin, Iter end, const Tag &tag=Tag()) const
+ { render(get_pass(tag), begin, end); }
private:
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;
+
+ 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);
+ }
+
+ void render_instance(const ObjectPass &, const ObjectInstance &) const;
};
} // namespace GL