RenderPass::~RenderPass()
{
- delete shdata;
delete texturing;
}
+void RenderPass::set_shader_program(const Program *prog, const ProgramData *data)
+{
+ shprog = prog;
+ shdata = data;
+ shdata.keep();
+}
+
void RenderPass::set_material(const Material *mat)
{
material = mat;
{
if(!obj.shprog)
throw invalid_operation("RenderPass::Loader::uniforms");
- if(!obj.shdata)
- obj.shdata = new ProgramData;
- load_sub(*obj.shdata);
+ RefPtr<ProgramData> shd = new ProgramData;
+ load_sub(*shd);
+ obj.shdata = shd;
}
void texture2d();
};
- Program *shprog;
- ProgramData *shdata;
+ const Program *shprog;
+ RefPtr<const ProgramData> shdata;
RefPtr<const Material> material;
Texturing *texturing;
std::map<std::string, unsigned> tex_names;
RenderPass(const RenderPass &);
~RenderPass();
+ void set_shader_program(const Program *, const ProgramData *);
const Program *get_shader_program() const { return shprog; }
- const ProgramData *get_shader_data() const { return shdata; }
+ const ProgramData *get_shader_data() const { return shdata.get(); }
void set_material(const Material *);
const Material *get_material() const { return material.get(); }
void set_texture(unsigned, const Texture *);