X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fpipeline.h;h=c14245fa9d83b81c637c4fc530223db9477ea3a0;hb=5eb4e7ebd0dc36bc0d9817dedcc152f3bd581f70;hp=5da9a7b32141035b891191c027ff146b108fd824;hpb=b617c5d7b5283ad260a77f01e42e6170cabbc03d;p=libs%2Fgl.git diff --git a/source/pipeline.h b/source/pipeline.h index 5da9a7b3..c14245fa 100644 --- a/source/pipeline.h +++ b/source/pipeline.h @@ -1,61 +1,92 @@ -/* $Id$ - -This file is part of libmspgl -Copyright © 2009 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #ifndef MSP_GL_PIPELINE_H_ #define MSP_GL_PIPELINE_H_ #include -#include "pipelinepass.h" +#include #include "renderable.h" namespace Msp { namespace GL { +class Blend; class Camera; -class Effect; +class DepthTest; class Framebuffer; +class Lighting; class PostProcessor; class Renderbuffer; class Texture2D; class Pipeline: public Renderable { +public: + class Pass + { + private: + Tag tag; + const Lighting *lighting; + const DepthTest *depth_test; + const Blend *blend; + + public: + Pass(const Tag &); + + const Tag &get_tag() const { return tag; } + + void set_lighting(const Lighting *); + void set_depth_test(const DepthTest *); + void set_blend(const Blend *); + const Lighting *get_lighting() const { return lighting; } + const DepthTest *get_depth_test() const { return depth_test; } + const Blend *get_blend() const { return blend; } + }; + private: - typedef std::map PassMap; + struct Slot + { + const Renderable *renderable; + std::set passes; + + Slot(const Renderable *); + }; + + typedef std::list PassList; - PassMap passes; - std::vector pass_order; + PassList passes; const Camera *camera; - std::vector renderables; - std::vector effects; + std::vector renderables; std::vector postproc; unsigned width; unsigned height; bool hdr; + unsigned samples; Framebuffer *fbo; Texture2D *color_buf; - Renderbuffer *depth_buf; + Texture2D *depth_buf; + Framebuffer *fbo_ms; + Renderbuffer *color_buf_ms; + Renderbuffer *depth_buf_ms; public: - Pipeline(unsigned, unsigned, bool); + Pipeline(unsigned, unsigned, bool = false); ~Pipeline(); + void set_hdr(bool); + void set_multisample(unsigned); void set_camera(const Camera *); - PipelinePass &add_pass(const Tag &tag); - PipelinePass &get_pass(const Tag &tag); - const PipelinePass &get_pass(const Tag &tag) const; + Pass &add_pass(const Tag &tag); void add_renderable(const Renderable &); - void add_effect(Effect &); + void add_renderable_for_pass(const Renderable &, const Tag &); + void remove_renderable(const Renderable &); void add_postprocessor(PostProcessor &); virtual void render(const Tag &tag = Tag()) const; - void render_all() const; + virtual void render(Renderer &, const Tag &tag = Tag()) const; + +private: + void create_fbos(); }; } // namespace GL