X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Frenderpass.h;h=10960b3f37cb1b082d0cf26d20404514297982b8;hb=656b4577fccfb02bea747871e5ab10148f002443;hp=223f57dc410c9dedd5264cd554a0004cefb53a4d;hpb=97015ec7bddd26aa746f5227e4109b7d32438cca;p=libs%2Fgl.git diff --git a/source/renderpass.h b/source/renderpass.h index 223f57dc..10960b3f 100644 --- a/source/renderpass.h +++ b/source/renderpass.h @@ -8,7 +8,9 @@ Distributed under the LGPL #ifndef MSP_GL_RENDERPASS_H_ #define MSP_GL_RENDERPASS_H_ +#include #include +#include "bindable.h" namespace Msp { namespace GL { @@ -22,45 +24,50 @@ class Texture; Encapsulates the data that determines the appearance of a rendered surface. This includes shader and data for it, material and textures. */ -class RenderPass +class RenderPass: public Bindable { public: class Loader: public DataFile::CollectionObjectLoader { public: + Loader(RenderPass &); Loader(RenderPass &, Collection &); private: + void init(); virtual void finish(); void material(); - void shader(const std::string &); - void texture(const std::string &); + void material(const std::string &); + void texunit(unsigned); void uniforms(); }; private: struct TextureSlot { - class Loader: public DataFile::ObjectLoader + class Loader: public DataFile::CollectionObjectLoader { public: Loader(TextureSlot &); + Loader(TextureSlot &, Collection &); + + private: + void init(); + void texture(const std::string &); + void texture2d(); }; - const Texture *texture; - std::string name; + unsigned index; + RefPtr texture; - TextureSlot(const Texture *); + TextureSlot(unsigned); }; Program *shprog; ProgramData *shdata; - bool own_material; - const Material *material; + RefPtr material; std::vector textures; - static const RenderPass *current; - RenderPass &operator=(const RenderPass &); public: RenderPass(); @@ -68,8 +75,7 @@ public: ~RenderPass(); void set_material(const Material *); - unsigned get_texture_index(const std::string &) const; - void set_texture(const std::string &, const Texture *); + void set_texture(unsigned, const Texture *); void bind() const;