Distributed under the LGPL
*/
+#include "camera.h"
#include "effect.h"
#include "except.h"
#include "framebuffer.h"
namespace GL {
Pipeline::Pipeline(unsigned w, unsigned h, bool d):
+ camera(0),
width(w),
height(h),
hdr(d),
delete depth_buf;
}
+void Pipeline::set_camera(const Camera *c)
+{
+ camera = c;
+}
+
PipelinePass &Pipeline::add_pass(const Tag &tag)
{
if(passes.count(tag))
void Pipeline::render_all() const
{
+ if(camera)
+ camera->apply();
+
if(fbo)
{
fbo->bind();
clear(COLOR_BUFFER_BIT|DEPTH_BUFFER_BIT);
}
+
for(vector<Effect *>::const_iterator i=effects.begin(); i!=effects.end(); ++i)
(*i)->prepare();
for(vector<Tag>::const_iterator i=pass_order.begin(); i!=pass_order.end(); ++i)
render(*i);
for(vector<Effect *>::const_iterator i=effects.end(); i--!=effects.begin();)
(*i)->cleanup();
+
if(fbo)
Framebuffer::unbind();
+
// XXX Need two color buffer textures to handle multiple post-processors correctly
for(vector<PostProcessor *>::const_iterator i=postproc.begin(); i!=postproc.end(); ++i)
(*i)->render(*color_buf);