-/* $Id$
-
-This file is part of libmspgl
-Copyright © 2007-2008, 2010 Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
-#ifndef MSP_GL_RENDERPASS_H_
-#define MSP_GL_RENDERPASS_H_
-
-#include <msp/datafile/objectloader.h>
-
-namespace Msp {
-namespace GL {
-
-class Material;
-class Program;
-class ProgramData;
-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
-{
-public:
- class Loader: public DataFile::CollectionObjectLoader<RenderPass>
- {
- 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 uniforms();
- };
-
-private:
- struct TextureSlot
- {
- class Loader: public DataFile::ObjectLoader<TextureSlot>
- {
- public:
- Loader(TextureSlot &);
- };
-
- const Texture *texture;
- std::string name;
-
- TextureSlot(const Texture *);
- };
-
- Program *shprog;
- ProgramData *shdata;
- bool own_material;
- const Material *material;
- std::vector<TextureSlot> textures;
-
- static const RenderPass *current;
-
- RenderPass &operator=(const RenderPass &);
-public:
- RenderPass();
- RenderPass(const RenderPass &);
- ~RenderPass();
-
- void set_material(const Material *);
- unsigned get_texture_index(const std::string &) const;
- void set_texture(const std::string &, const Texture *);
-
- void bind() const;
-
- static void unbind();
-};
-
-} // namespace GL
-} // namespace Msp
-
-#endif