From: Mikko Rasa Date: Fri, 24 Sep 2021 21:41:51 +0000 (+0300) Subject: Remove the View and Framebuffer constructors from Sequence X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=31ae3e3c4a28ac2ec97cc3efaa25adbf1511aadc;p=libs%2Fgl.git Remove the View and Framebuffer constructors from Sequence They had no other purpose than to take the size from the other object, and that fits better in SequenceBuilder. --- diff --git a/source/builders/sequencebuilder.cpp b/source/builders/sequencebuilder.cpp index 8fd4b956..300ba238 100644 --- a/source/builders/sequencebuilder.cpp +++ b/source/builders/sequencebuilder.cpp @@ -6,6 +6,7 @@ #include "sequence.h" #include "sequencebuilder.h" #include "sequencetemplate.h" +#include "view.h" using namespace std; @@ -95,14 +96,14 @@ Sequence *SequenceBuilder::build(unsigned w, unsigned h) const Sequence *SequenceBuilder::build(const View &view) const { - RefPtr sequence = new Sequence(view, create_frame_format()); + RefPtr sequence = new Sequence(view.get_width(), view.get_height(), create_frame_format()); build(*sequence); return sequence.release(); } Sequence *SequenceBuilder::build(const Framebuffer &fbo) const { - RefPtr sequence = new Sequence(fbo, create_frame_format()); + RefPtr sequence = new Sequence(fbo.get_width(), fbo.get_height(), create_frame_format()); build(*sequence); return sequence.release(); } diff --git a/source/render/sequence.cpp b/source/render/sequence.cpp index e953b4d6..d5b3ae94 100644 --- a/source/render/sequence.cpp +++ b/source/render/sequence.cpp @@ -7,34 +7,17 @@ #include "renderer.h" #include "sequence.h" #include "texture2d.h" -#include "view.h" using namespace std; namespace Msp { namespace GL { -Sequence::Sequence(unsigned w, unsigned h, const FrameFormat &f) +Sequence::Sequence(unsigned w, unsigned h, const FrameFormat &f): + width(w), + height(h), + target_format(f) { - init(w, h, f); -} - -Sequence::Sequence(const View &view, const FrameFormat &f) -{ - init(view.get_width(), view.get_height(), f); -} - -Sequence::Sequence(const Framebuffer &fbo, const FrameFormat &f) -{ - init(fbo.get_width(), fbo.get_height(), f); -} - -void Sequence::init(unsigned w, unsigned h, const FrameFormat &f) -{ - width = w; - height = h; - target_format = f; - if(!target_format.empty()) { FrameFormat postproc_fmt = target_format; diff --git a/source/render/sequence.h b/source/render/sequence.h index 00211b00..0bc65cb7 100644 --- a/source/render/sequence.h +++ b/source/render/sequence.h @@ -19,7 +19,6 @@ class Camera; class Clipping; class Lighting; class PostProcessor; -class View; /** Top-level content class. Typically a Sequence is used as the content @@ -86,11 +85,6 @@ private: public: Sequence(unsigned, unsigned, const FrameFormat & = FrameFormat()); - Sequence(const View &, const FrameFormat & = FrameFormat()); - Sequence(const Framebuffer &, const FrameFormat & = FrameFormat()); -private: - void init(unsigned, unsigned, const FrameFormat &); -public: ~Sequence(); const FrameFormat &get_target_format() { return target_format; } diff --git a/tools/viewer.cpp b/tools/viewer.cpp index 2c950e18..20c11c31 100644 --- a/tools/viewer.cpp +++ b/tools/viewer.cpp @@ -234,7 +234,7 @@ Viewer::Viewer(int argc, char **argv): if(!sequence) { - sequence = new GL::Sequence(view); + sequence = new GL::Sequence(view.get_width(), view.get_height()); GL::Sequence::Step &step = sequence->add_step(0, *renderable); step.set_lighting(&lighting); step.set_depth_test(GL::LEQUAL);