From: Mikko Rasa Date: Sat, 23 Jun 2018 09:12:26 +0000 (+0300) Subject: Additional overloads for creating pipelines X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=eacacdda1dc40bb655a3df14b59260ce06329fb6;p=libs%2Fgl.git Additional overloads for creating pipelines --- diff --git a/source/pipeline.cpp b/source/pipeline.cpp index 27cc3e3c..53b51d79 100644 --- a/source/pipeline.cpp +++ b/source/pipeline.cpp @@ -27,6 +27,11 @@ Pipeline::Pipeline(const View &view) init(view.get_width(), view.get_height()); } +Pipeline::Pipeline(const Framebuffer &fbo) +{ + init(fbo.get_width(), fbo.get_height()); +} + void Pipeline::init(unsigned w, unsigned h) { camera = 0; diff --git a/source/pipeline.h b/source/pipeline.h index 9ac03efb..0d38aaec 100644 --- a/source/pipeline.h +++ b/source/pipeline.h @@ -87,6 +87,7 @@ private: public: Pipeline(unsigned, unsigned, bool = false); Pipeline(const View &); + Pipeline(const Framebuffer &); private: void init(unsigned, unsigned); public: diff --git a/source/pipelinebuilder.cpp b/source/pipelinebuilder.cpp index cbf181fe..70593299 100644 --- a/source/pipelinebuilder.cpp +++ b/source/pipelinebuilder.cpp @@ -54,6 +54,13 @@ void PipelineBuilder::build(Pipeline &pipeline) const } } +Pipeline *PipelineBuilder::build(unsigned w, unsigned h) const +{ + RefPtr pipeline = new Pipeline(w, h); + build(*pipeline); + return pipeline.release(); +} + Pipeline *PipelineBuilder::build(const View &view) const { RefPtr pipeline = new Pipeline(view); @@ -61,5 +68,12 @@ Pipeline *PipelineBuilder::build(const View &view) const return pipeline.release(); } +Pipeline *PipelineBuilder::build(const Framebuffer &fbo) const +{ + RefPtr pipeline = new Pipeline(fbo); + build(*pipeline); + return pipeline.release(); +} + } // namespace GL } // namespace Msp diff --git a/source/pipelinebuilder.h b/source/pipelinebuilder.h index 5ad420e3..6a40dbe7 100644 --- a/source/pipelinebuilder.h +++ b/source/pipelinebuilder.h @@ -7,6 +7,7 @@ namespace Msp { namespace GL { +class Framebuffer; class Pipeline; class PipelineTemplate; class Renderable; @@ -24,7 +25,9 @@ public: void set_renderable(const std::string &, Renderable &); void build(Pipeline &) const; + Pipeline *build(unsigned, unsigned) const; Pipeline *build(const View &) const; + Pipeline *build(const Framebuffer &) const; }; } // namespace GL