From: Mikko Rasa Date: Tue, 19 Dec 2017 16:09:07 +0000 (+0200) Subject: Add a constructor to Pipeline which takes the size from a View X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=commitdiff_plain;h=6109322ffc5dec1a777807fcbefacafe94d1d5eb Add a constructor to Pipeline which takes the size from a View --- diff --git a/source/pipeline.cpp b/source/pipeline.cpp index 29c42324..9e2976ab 100644 --- a/source/pipeline.cpp +++ b/source/pipeline.cpp @@ -9,20 +9,32 @@ #include "renderer.h" #include "tests.h" #include "texture2d.h" +#include "view.h" using namespace std; namespace Msp { namespace GL { -Pipeline::Pipeline(unsigned w, unsigned h, bool d): - camera(0), - width(w), - height(h), - hdr(d), - samples(0), - target_ms(0) +Pipeline::Pipeline(unsigned w, unsigned h, bool d) { + init(w, h); + hdr = d; +} + +Pipeline::Pipeline(const View &view) +{ + init(view.get_width(), view.get_height()); +} + +void Pipeline::init(unsigned w, unsigned h) +{ + camera = 0; + width = w; + height = h; + hdr = false; + samples = 0; + target_ms = 0; target[0] = 0; target[1] = 0; } diff --git a/source/pipeline.h b/source/pipeline.h index 4ee59444..35d10a41 100644 --- a/source/pipeline.h +++ b/source/pipeline.h @@ -18,6 +18,7 @@ class Clipping; class DepthTest; class Lighting; class PostProcessor; +class View; /** Top-level content class. Typically a Pipeline is used as the content @@ -85,6 +86,10 @@ private: public: Pipeline(unsigned, unsigned, bool = false); + Pipeline(const View &); +private: + void init(unsigned, unsigned); +public: ~Pipeline(); /* Sets high dynamic range mode. Requires floating-point texture support.