X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fobject.h;h=42541eaf28004807d1e088f32f1281c1788b7800;hb=b8b06a0ff96763ba7e188d9fcacbd8c0e3dcd515;hp=0b808983099e08ffba4caf01da9ad943b3966f0f;hpb=c6aea1bc1586ffef132e6fffdf99343cb56617db;p=libs%2Fgl.git diff --git a/source/object.h b/source/object.h index 0b808983..42541eaf 100644 --- a/source/object.h +++ b/source/object.h @@ -33,10 +33,11 @@ See also class ObjectInstance. class Object: public Renderable { private: - std::vector meshes; - std::vector textures; + std::vector meshes; + std::vector textures; + const Texture *main_texture; std::map passes; - Material *material; + const Material *material; ObjectPass *normal_pass; public: @@ -53,16 +54,17 @@ 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 &); }; @@ -90,12 +92,24 @@ public: Each instance's hook functions will be called before and after drawing the mesh. */ - void render(const std::list &, const Tag &tag=Tag()) const; + template + 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; + + template + 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