X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fpipeline.h;h=dd80ef3bb1563d475e1ab9d606444187047b4b6d;hp=4ee594444a5e6c465d50347793c572f6f2e076ff;hb=bec07999d95b76f4b47cffcc564d0cd0afc0435e;hpb=02343325a49437532a6b263b1c5453cc6e51b71b diff --git a/source/pipeline.h b/source/pipeline.h index 4ee59444..dd80ef3b 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 @@ -75,30 +76,38 @@ private: PassList passes; const Camera *camera; std::vector renderables; - std::vector postproc; + std::vector > postproc; unsigned width; unsigned height; bool hdr; + bool alpha; unsigned samples; RenderTarget *target[2]; RenderTarget *target_ms; public: Pipeline(unsigned, unsigned, bool = false); + Pipeline(const View &); + Pipeline(const Framebuffer &); +private: + void init(unsigned, unsigned); +public: ~Pipeline(); /* Sets high dynamic range mode. Requires floating-point texture support. A ColorCurve postprocessor is recommended for full benefit. */ void set_hdr(bool); + /* Enable or disable alpha channel. When enabled, all render targets are + created with an RGBA pixel format instead of RGB. */ + void set_alpha(bool); + void set_multisample(unsigned); - // Deprecated - void set_camera(const Camera *); - Pass &add_pass(const Tag &tag); - void add_renderable(Renderable &); - void add_renderable_for_pass(Renderable &, const Tag &); - void remove_renderable(Renderable &); + unsigned get_width() const { return width; } + unsigned get_height() const { return height; } + bool get_hdr() const { return hdr; } + unsigned get_multisample() const { return samples; } /** Adds a pass to the pipeline. It's permissible to add the same Renderable multiple times. */ @@ -107,10 +116,18 @@ public: /** Adds a postprocessor to the pipeline. */ void add_postprocessor(PostProcessor &); + /** Adds a postprocessor to the pipeline, transferring ownership. The + postprocessor will be deleted together with with pipeline. It is also + deleted if this call throws an exception. */ + void add_postprocessor_owned(PostProcessor *); + +private: + void add_postprocessor(PostProcessor *, bool); + +public: virtual void setup_frame(Renderer &); virtual void finish_frame(); - void render(); virtual void render(Renderer &, const Tag &tag = Tag()) const; private: