sky = make_unique<GL::Sky>(content, sun);
sky->set_debug_name("Sky");
- unsigned shadow_size = 8192;
- shadow_seq = make_unique<GL::Sequence>(shadow_size, shadow_size);
+ shadow_seq = make_unique<GL::Sequence>();
shadow_seq->set_debug_name("Shadow sequence");
GL::Sequence::Step *step = &shadow_seq->add_step("shadow", content);
step->set_depth_test(GL::LEQUAL);
- shadow_map = make_unique<GL::ShadowMap>(shadow_size, *sky, sun, *shadow_seq);
+ shadow_map = make_unique<GL::ShadowMap>(8192, *sky, sun, *shadow_seq);
shadow_map->set_debug_name("Shadow map");
shadow_map->set_target(GL::Vector3(0.0f, 0.0f, 0.0f), 20.0f);
seq_bld.set_debug_name("Main sequence");
sequence.reset(seq_bld.build(view));
- unsigned env_size = 256;
- env_seq = make_unique<GL::Sequence>(env_size, env_size);
+ env_seq = make_unique<GL::Sequence>();
env_seq->set_debug_name("Environment sequence");
step = &env_seq->add_step("", *shadow_map);
step->set_lighting(&resources.get<GL::Lighting>("Desert.lightn"));
}
}
+Sequence *SequenceBuilder::build() const
+{
+ RefPtr<Sequence> sequence = new Sequence();
+ build(*sequence);
+ return sequence.release();
+}
+
Sequence *SequenceBuilder::build(unsigned w, unsigned h) const
{
RefPtr<Sequence> sequence = new Sequence(w, h, create_frame_format());
void set_debug_name(const std::string &);
void build(Sequence &) const;
+ Sequence *build() const;
Sequence *build(unsigned, unsigned) const;
Sequence *build(const View &) const;
Sequence *build(const Framebuffer &) const;
namespace Msp {
namespace GL {
+Sequence::Sequence():
+ width(0),
+ height(0),
+ target{0, 0},
+ target_ms(0)
+{ }
+
Sequence::Sequence(unsigned w, unsigned h, const FrameFormat &f):
width(w),
height(h),
- target_format(f)
+ target_format(f),
+ target_ms(0)
{
- if(!target_format.empty())
- {
- FrameFormat postproc_fmt = target_format;
- postproc_fmt.set_samples(1);
- target[0] = new RenderTarget(width, height, postproc_fmt);
- target[1] = new RenderTarget(width, height, postproc_fmt);
-
- if(target_format.get_samples()>1)
- target_ms = new RenderTarget(width, height, target_format);
- else
- target_ms = 0;
- }
- else
- {
- target_ms = 0;
- target[0] = 0;
- target[1] = 0;
- }
+ if(target_format.empty())
+ throw invalid_argument("Sequence::Sequence");
+
+ FrameFormat postproc_fmt = target_format;
+ postproc_fmt.set_samples(1);
+ target[0] = new RenderTarget(width, height, postproc_fmt);
+ target[1] = new RenderTarget(width, height, postproc_fmt);
+
+ if(target_format.get_samples()>1)
+ target_ms = new RenderTarget(width, height, target_format);
}
Sequence::~Sequence()
RenderTarget *target_ms;
public:
- Sequence(unsigned, unsigned, const FrameFormat & = FrameFormat());
+ Sequence();
+ Sequence(unsigned, unsigned, const FrameFormat &);
~Sequence();
- const FrameFormat &get_target_format() { return target_format; }
-
unsigned get_width() const { return width; }
unsigned get_height() const { return height; }
+ const FrameFormat &get_target_format() { return target_format; }
/** Adds a step to the sequence. It's permissible to add the same
Renderable multiple times. */
if(!sequence)
{
- sequence = new GL::Sequence(view.get_width(), view.get_height());
+ sequence = new GL::Sequence();
GL::Sequence::Step &step = sequence->add_step(0, *renderable);
step.set_lighting(&lighting);
step.set_depth_test(GL::LEQUAL);