1 #ifndef MSP_GL_RENDERPASS_H_
2 #define MSP_GL_RENDERPASS_H_
4 #include <msp/core/refptr.h>
5 #include <msp/datafile/objectloader.h>
20 Encapsulates the data that determines the appearance of a rendered surface.
21 This includes shader and data for it, material and texturing.
23 XXX Does not delete inline texture from datafiles properly
28 class Loader: public DataFile::CollectionObjectLoader<RenderPass>
32 Loader(RenderPass &, Collection &);
36 void material_inline();
37 void material(const std::string &);
38 void texunit(unsigned);
39 void texunit_named(unsigned, const std::string &);
44 struct TextureLoader: public DataFile::CollectionObjectLoader<Texturing>
52 TextureLoader(Texturing &, unsigned, Collection *);
54 virtual void finish();
57 void texture(const std::string &);
61 const Program *shprog;
62 RefPtr<const ProgramData> shdata;
63 RefPtr<const Material> material;
65 std::map<std::string, unsigned> tex_names;
68 RenderPass &operator=(const RenderPass &);
71 RenderPass(const RenderPass &);
74 void set_shader_program(const Program *, const ProgramData *);
75 const Program *get_shader_program() const { return shprog; }
76 const ProgramData *get_shader_data() const { return shdata.get(); }
77 void set_material(const Material *);
78 const Material *get_material() const { return material.get(); }
79 void set_texture(unsigned, const Texture *);
80 const Texturing *get_texturing() const { return texturing; }
81 int get_texture_index(const std::string &) const;
82 void set_back_faces(bool);
83 bool get_back_faces() const { return back_faces; }
85 void apply(Renderer &) const;