Additional overloads for creating pipelines
authorMikko Rasa <tdb@tdb.fi>
Sat, 23 Jun 2018 09:12:26 +0000 (12:12 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 23 Jun 2018 09:12:26 +0000 (12:12 +0300)
source/pipeline.cpp
source/pipeline.h
source/pipelinebuilder.cpp
source/pipelinebuilder.h

index 27cc3e3c63cc9d274e3573c7da915b21b846899d..53b51d7924bc91cfeb6b8c4e84ef6cf24134061a 100644 (file)
@@ -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;
index 9ac03efbb9989d4b2d462d689346f348ab299615..0d38aaec40181ca402b896c1bf5a4530cb266fb7 100644 (file)
@@ -87,6 +87,7 @@ private:
 public:
        Pipeline(unsigned, unsigned, bool = false);
        Pipeline(const View &);
+       Pipeline(const Framebuffer &);
 private:
        void init(unsigned, unsigned);
 public:
index cbf181fe6e81ee3588ed341f48f7537ac7d55ebd..705932994479c4f06b5cdc24b83bc5ae4b0cddd0 100644 (file)
@@ -54,6 +54,13 @@ void PipelineBuilder::build(Pipeline &pipeline) const
        }
 }
 
+Pipeline *PipelineBuilder::build(unsigned w, unsigned h) const
+{
+       RefPtr<Pipeline> pipeline = new Pipeline(w, h);
+       build(*pipeline);
+       return pipeline.release();
+}
+
 Pipeline *PipelineBuilder::build(const View &view) const
 {
        RefPtr<Pipeline> 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> pipeline = new Pipeline(fbo);
+       build(*pipeline);
+       return pipeline.release();
+}
+
 } // namespace GL
 } // namespace Msp
index 5ad420e3f92e1c9c5ec84fa116b4f5a51bfe8759..6a40dbe77de61343f61c4d27fd8861059b8a7339 100644 (file)
@@ -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