X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fpipeline.h;h=d39bce5af9689523532412d05f3cff0eac75ec81;hb=ab83db6f1e31d44ced585119a57fd10896e469cb;hp=011a96bba5e37d6ca1bd056bfe1cede1c047cb03;hpb=40a0024a6466298d064697ed022465c7d3e9168e;p=libs%2Fgl.git diff --git a/source/pipeline.h b/source/pipeline.h index 011a96bb..d39bce5a 100644 --- a/source/pipeline.h +++ b/source/pipeline.h @@ -3,7 +3,10 @@ #include #include +#include "framebuffer.h" #include "renderable.h" +#include "renderbuffer.h" +#include "texture2d.h" namespace Msp { namespace GL { @@ -11,11 +14,8 @@ namespace GL { class Blend; class Camera; class DepthTest; -class Framebuffer; class Lighting; class PostProcessor; -class Renderbuffer; -class Texture2D; class Pipeline: public Renderable { @@ -23,12 +23,15 @@ public: class Pass { private: + Tag tag; const Lighting *lighting; const DepthTest *depth_test; const Blend *blend; public: - Pass(); + Pass(const Tag &); + + const Tag &get_tag() const { return tag; } void set_lighting(const Lighting *); void set_depth_test(const DepthTest *); @@ -47,10 +50,27 @@ private: Slot(const Renderable *); }; - typedef std::map PassMap; + struct RenderTarget + { + Framebuffer fbo; + Texture2D color; + Texture2D depth; + + RenderTarget(unsigned, unsigned, PixelFormat); + }; + + struct MultisampleTarget + { + Framebuffer fbo; + Renderbuffer color; + Renderbuffer depth; + + MultisampleTarget(unsigned, unsigned, unsigned, PixelFormat); + }; + + typedef std::list PassList; - PassMap passes; - std::vector pass_order; + PassList passes; const Camera *camera; std::vector renderables; std::vector postproc; @@ -58,12 +78,8 @@ private: unsigned height; bool hdr; unsigned samples; - Framebuffer *fbo; - Texture2D *color_buf; - Texture2D *depth_buf; - Framebuffer *fbo_ms; - Renderbuffer *color_buf_ms; - Renderbuffer *depth_buf_ms; + RenderTarget *target[2]; + MultisampleTarget *target_ms; public: Pipeline(unsigned, unsigned, bool = false); @@ -74,19 +90,17 @@ public: void set_camera(const Camera *); Pass &add_pass(const Tag &tag); - Pass &get_pass(const Tag &tag); - const Pass &get_pass(const Tag &tag) const; void add_renderable(const Renderable &); 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; virtual void render(Renderer &, const Tag &tag = Tag()) const; - void render_all() const; private: - void create_fbos(); + void create_targets(bool); }; } // namespace GL