if scene.background_set:
content = resources[scene.name+".wrapper.scene"]
+ seq_res.statements.append(Statement("clear"))
+
ss = Statement("step", "", "content")
ss.sub.append(Statement("depth_test", Token("LEQUAL")))
ss.sub.append(seq_res.create_reference_statement("lighting", resources[scene.name+".lightn"]))
sky->set_debug_name("Sky");
shadow_seq = make_unique<GL::Sequence>();
+ shadow_seq->set_clear_enabled(true);
shadow_seq->set_debug_name("Shadow sequence");
GL::Sequence::Step *step = &shadow_seq->add_step("shadow", content);
step->set_depth_test(GL::LEQUAL);
sequence.reset(seq_bld.build(view));
env_seq = make_unique<GL::Sequence>();
+ env_seq->set_clear_enabled(true);
env_seq->set_debug_name("Environment sequence");
step = &env_seq->add_step("", *shadow_map);
step->set_lighting(&resources.get<GL::Lighting>("Desert.lightn"));
sequence.set_debug_name(debug_name);
#endif
+ sequence.set_clear_enabled(tmpl.is_clear_enabled());
+
for(const SequenceTemplate::Step &s: tmpl.get_steps())
{
Renderable *renderable = get_item(renderables, s.slot_name);
hdr(false),
alpha(false),
required_multisample(0),
- max_multisample(0)
+ max_multisample(0),
+ clear_enabled(false)
{ }
SequenceTemplate::~SequenceTemplate()
{
add("hdr", &SequenceTemplate::hdr);
add("alpha", &SequenceTemplate::alpha);
+ add("clear", &Loader::clear);
add("multisample", &Loader::multisample);
add("multisample", &Loader::multisample_range);
add("postprocessor", &Loader::postprocessor);
obj.postprocessors.push_back(get_postprocessor_template());
}
+void SequenceTemplate::Loader::clear()
+{
+ obj.clear_enabled = true;
+}
+
void SequenceTemplate::Loader::multisample(unsigned samples)
{
obj.required_multisample = samples;
Loader(SequenceTemplate &, Collection &);
virtual void postprocessor_loaded();
+ void clear();
void multisample(unsigned);
void multisample_range(unsigned, unsigned);
void postprocessor(const std::string &);
unsigned max_multisample;
std::vector<Step> steps;
std::vector<PostProcessor> postprocessors;
+ bool clear_enabled;
public:
SequenceTemplate();
unsigned get_maximum_multisample() const { return max_multisample; }
const std::vector<Step> &get_steps() const { return steps; }
const std::vector<PostProcessor> &get_postprocessors() const { return postprocessors; }
+ bool is_clear_enabled() const { return clear_enabled; }
template<typename T>
static void register_postprocessor(const std::string &);
{
faces[i].camera.set_position(center);
renderer.set_framebuffer(&faces[i].fbo);
- renderer.clear();
renderer.set_camera(faces[i].camera);
renderer.render(environment);
}
Renderer::Push push(renderer);
renderer.set_framebuffer(&fbo);
- renderer.clear(DEPTH_BUFFER_BIT);
renderer.set_camera(shadow_camera);
renderer.set_depth_test(&depth_test);
width(0),
height(0),
target{0, 0},
- target_ms(0)
+ target_ms(0),
+ clear_enabled(false)
{ }
Sequence::Sequence(unsigned w, unsigned h, const FrameFormat &f):
width(w),
height(h),
target_format(f),
- target_ms(0)
+ target_ms(0),
+ clear_enabled(false)
{
if(target_format.empty())
throw invalid_argument("Sequence::Sequence");
delete target_ms;
}
+void Sequence::set_clear_enabled(bool c)
+{
+ clear_enabled = c;
+}
+
Sequence::Step &Sequence::add_step(Tag tag, Renderable &r)
{
steps.push_back(Step(tag, &r));
const Framebuffer *out_fbo = renderer.get_framebuffer();
if(target[0])
- {
renderer.set_framebuffer(&(target_ms ? target_ms : target[0])->get_framebuffer());
+
+ if(clear_enabled)
renderer.clear();
- }
for(const Step &s: steps)
{
FrameFormat target_format;
RenderTarget *target[2];
RenderTarget *target_ms;
+ bool clear_enabled;
public:
Sequence();
unsigned get_height() const { return height; }
const FrameFormat &get_target_format() { return target_format; }
+ void set_clear_enabled(bool);
+
/** Adds a step to the sequence. It's permissible to add the same
Renderable multiple times. */
Step &add_step(Tag, Renderable &);
{
Renderer::Push _push(renderer);
renderer.set_framebuffer(&target);
- renderer.clear();
if(content)
{
if(camera)