1 #ifndef MSP_GL_RENDERPASS_H_
2 #define MSP_GL_RENDERPASS_H_
4 #include <msp/core/refptr.h>
5 #include <msp/datafile/objectloader.h>
19 Encapsulates the data that determines the appearance of a rendered surface.
20 This includes shader and data for it, material and texturing.
25 class Loader: public DataFile::CollectionObjectLoader<RenderPass>
29 Loader(RenderPass &, Collection &);
34 static std::string get_shader_name(const std::string &);
36 void material_inline();
37 void material(const std::string &);
38 void shader(const std::string &);
39 void texture(const std::string &);
40 void texunit(unsigned);
41 void texunit_named(unsigned, const std::string &);
43 void uniform_slot(const std::string &);
44 void uniform_slot2(const std::string &, const std::string &);
50 class Loader: public DataFile::CollectionObjectLoader<TextureSlot>
53 std::string auto_slot_name;
56 Loader(TextureSlot &, const std::string &, Collection *);
63 std::string slot_name;
64 const Texture *texture;
65 const Sampler *sampler;
67 TextureSlot(Tag t): tag(t), texture(0), sampler(0) { }
70 RefPtr<const Program> shprog;
71 bool shprog_from_material;
72 RefPtr<ProgramData> shdata;
73 std::map<Tag, Tag> uniform_slots;
74 RefPtr<const Material> material;
75 std::string material_slot;
76 std::vector<TextureSlot> textures;
83 void finalize_material(DataFile::Collection *);
84 void maybe_create_material_shader(DataFile::Collection *);
85 void ensure_private_shader_data();
88 void set_shader_program(const Program *, const ProgramData *);
89 const Program *get_shader_program() const { return shprog.get(); }
90 const ProgramData *get_shader_data() const { return shdata.get(); }
91 Tag get_slotted_uniform_tag(Tag) const;
92 void set_material(const Material *, DataFile::Collection * = 0);
93 const Material *get_material() const { return material.get(); }
94 const std::string &get_material_slot_name() const { return material_slot; }
95 void set_texture(Tag, const Texture *, const Sampler * = 0);
96 Tag get_texture_tag(const std::string &) const;
97 DEPRECATED void set_texture(unsigned, const Texture *, const Sampler * = 0);
98 DEPRECATED const Texturing *get_texturing() const { return 0; }
99 DEPRECATED int get_texture_index(const std::string &) const;
100 void set_back_faces(bool);
101 bool get_back_faces() const { return back_faces; }
103 void apply(Renderer &) const;