class DepthTest;
class Lighting;
class PostProcessor;
+class View;
/**
Top-level content class. Typically a Pipeline is used as the content
const DepthTest *depth_test;
const Blend *blend;
const Clipping *clipping;
- const Renderable *renderable;
+ Renderable *renderable;
public:
- Pass(const Tag &, const Renderable *);
+ Pass(const Tag &, Renderable *);
const Tag &get_tag() const { return tag; }
const DepthTest *get_depth_test() const { return depth_test; }
const Blend *get_blend() const { return blend; }
const Clipping *get_clipping() const { return clipping; }
- const Renderable *get_renderable() const { return renderable; }
+ Renderable *get_renderable() const { return renderable; }
};
private:
struct Slot
{
- const Renderable *renderable;
+ Renderable *renderable;
std::set<Tag> passes;
- Slot(const Renderable *);
+ Slot(Renderable *);
};
typedef std::list<Pass> PassList;
PassList passes;
const Camera *camera;
std::vector<Slot> renderables;
- std::vector<PostProcessor *> postproc;
+ std::vector<RefPtr<PostProcessor> > postproc;
unsigned width;
unsigned height;
bool hdr;
public:
Pipeline(unsigned, unsigned, bool = false);
+ Pipeline(const View &);
+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);
+
void set_multisample(unsigned);
+ unsigned get_width() const { return width; }
+ unsigned get_height() const { return height; }
+ bool get_hdr() const { return hdr; }
+ unsigned get_multisample() const { return samples; }
+
// Deprecated
void set_camera(const Camera *);
Pass &add_pass(const Tag &tag);
- void add_renderable(const Renderable &);
- void add_renderable_for_pass(const Renderable &, const Tag &);
- void remove_renderable(const Renderable &);
+ void add_renderable(Renderable &);
+ void add_renderable_for_pass(Renderable &, const Tag &);
+ void remove_renderable(Renderable &);
/** Adds a pass to the pipeline. It's permissible to add the same
Renderable multiple times. */
- Pass &add_pass(const Tag &, const Renderable &);
+ Pass &add_pass(const Tag &, Renderable &);
/** Adds a postprocessor to the pipeline. */
void add_postprocessor(PostProcessor &);
- virtual void setup_frame() const;
- virtual void finish_frame() const;
+ /** 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();
- virtual void render(const Tag &tag = Tag()) const;
+ void render();
virtual void render(Renderer &, const Tag &tag = Tag()) const;
private: