summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
31ae3e3)
Also require a frame format when a size is specified. Sequences used as
content renderables of effects commonly have no postprocessors, in which
case internal render targets are not needed either and the size is not
meaningful.
sky = make_unique<GL::Sky>(content, sun);
sky->set_debug_name("Sky");
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_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);
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));
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"));
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());
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;
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;
Sequence *build(unsigned, unsigned) const;
Sequence *build(const View &) const;
Sequence *build(const Framebuffer &) const;
namespace Msp {
namespace GL {
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),
Sequence::Sequence(unsigned w, unsigned h, const FrameFormat &f):
width(w),
height(h),
+ 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);
RenderTarget *target_ms;
public:
RenderTarget *target_ms;
public:
- Sequence(unsigned, unsigned, const FrameFormat & = FrameFormat());
+ Sequence();
+ Sequence(unsigned, unsigned, const FrameFormat &);
- const FrameFormat &get_target_format() { return target_format; }
-
unsigned get_width() const { return width; }
unsigned get_height() const { return height; }
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. */
/** Adds a step to the sequence. It's permissible to add the same
Renderable multiple times. */
- 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);
GL::Sequence::Step &step = sequence->add_step(0, *renderable);
step.set_lighting(&lighting);
step.set_depth_test(GL::LEQUAL);