3 This file is part of libmspgl
4 Copyright © 2007-2008, 2010-2011 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
8 #ifndef MSP_GL_RENDERPASS_H_
9 #define MSP_GL_RENDERPASS_H_
11 #include <msp/core/refptr.h>
12 #include <msp/datafile/objectloader.h>
26 Encapsulates the data that determines the appearance of a rendered surface.
27 This includes shader and data for it, material and texturing.
29 XXX Does not delete inline texture from datafiles properly
34 class Loader: public DataFile::CollectionObjectLoader<RenderPass>
38 Loader(RenderPass &, Collection &);
42 void material_inline();
43 void material(const std::string &);
44 void texunit(unsigned);
45 void texunit_named(unsigned, const std::string &);
50 struct TextureLoader: public DataFile::CollectionObjectLoader<Texturing>
58 TextureLoader(Texturing &, unsigned, Collection *);
60 virtual void finish();
63 void texture(const std::string &);
69 RefPtr<const Material> material;
71 std::map<std::string, unsigned> tex_names;
73 RenderPass &operator=(const RenderPass &);
76 RenderPass(const RenderPass &);
79 const Program *get_shader_program() const { return shprog; }
80 const ProgramData *get_shader_data() const { return shdata; }
81 void set_material(const Material *);
82 const Material *get_material() const { return material.get(); }
83 void set_texture(unsigned, const Texture *);
84 const Texturing *get_texturing() const { return texturing; }
85 int get_texture_index(const std::string &) const;