RenderPass::RenderPass(const RenderPass &other):
shprog(other.shprog),
- shdata(other.shdata ? new ProgramData(*other.shdata) : 0),
+ shdata(other.shdata),
uniform_slots(other.uniform_slots),
material(other.material),
texturing(other.texturing ? new Texturing(*other.texturing) : 0),
RenderPass &RenderPass::operator=(const RenderPass &other)
{
shprog = other.shprog;
- shdata = other.shdata ? new ProgramData(*other.shdata) : 0;
+ shdata = other.shdata;
uniform_slots = other.uniform_slots;
material = other.material;
texturing = other.texturing ? new Texturing(*other.texturing) : 0;
RenderPass::~RenderPass()
{
delete texturing;
- delete shdata;
}
void RenderPass::set_shader_program(const Program *prog, const ProgramData *data)
{
shprog = prog;
- delete shdata;
shdata = new ProgramData(*data);
}
{
renderer.set_texturing(texturing);
renderer.set_material(material.get());
- renderer.set_shader_program(shprog, shdata);
+ renderer.set_shader_program(shprog, shdata.get());
renderer.set_reverse_winding(back_faces);
}
};
const Program *shprog;
- ProgramData *shdata;
+ RefPtr<ProgramData> shdata;
std::map<std::string, std::string> uniform_slots;
RefPtr<const Material> material;
std::string material_slot;
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(); }
const std::string &get_slotted_uniform_name(const std::string &) const;
void set_material(const Material *);
const Material *get_material() const { return material.get(); }