1 #ifndef MSP_GL_RENDERPASS_H_
2 #define MSP_GL_RENDERPASS_H_
4 #include <msp/core/refptr.h>
5 #include <msp/datafile/objectloader.h>
18 Encapsulates the data that determines the appearance of a rendered surface.
19 This includes shader and data for it, material and texturing.
21 XXX Does not delete inline texture from datafiles properly
26 class Loader: public DataFile::CollectionObjectLoader<RenderPass>
30 Loader(RenderPass &, Collection &);
35 void material_inline();
36 void material(const std::string &);
37 void shader(const std::string &);
38 void texunit(unsigned);
39 void texunit_auto(const std::string &);
40 void texunit_named(unsigned, const std::string &);
42 void uniform_slot(const std::string &);
43 void uniform_slot2(const std::string &, const std::string &);
47 struct TextureLoader: public DataFile::CollectionObjectLoader<Texturing>
54 TextureLoader(Texturing &, unsigned, Collection *);
56 virtual void finish();
58 void texture(const std::string &);
62 const Program *shprog;
63 RefPtr<ProgramData> shdata;
64 std::map<std::string, std::string> uniform_slots;
65 RefPtr<const Material> material;
66 std::string material_slot;
68 std::map<std::string, unsigned> tex_names;
73 RenderPass(const RenderPass &);
74 RenderPass &operator=(const RenderPass &);
78 void finalize_material();
79 void ensure_private_shader_data();
82 void set_shader_program(const Program *, const ProgramData *);
83 const Program *get_shader_program() const { return shprog; }
84 const ProgramData *get_shader_data() const { return shdata.get(); }
85 const std::string &get_slotted_uniform_name(const std::string &) const;
86 void set_material(const Material *);
87 const Material *get_material() const { return material.get(); }
88 const std::string &get_material_slot_name() const { return material_slot; }
89 void set_texture(unsigned, const Texture *);
90 const Texturing *get_texturing() const { return texturing; }
91 int get_texture_index(const std::string &) const;
92 void set_back_faces(bool);
93 bool get_back_faces() const { return back_faces; }
95 void apply(Renderer &) const;