#include <msp/core/maputils.h>
#include "blend.h"
#include "camera.h"
-#include "effect.h"
#include "framebuffer.h"
#include "lighting.h"
#include "pipeline.h"
delete fbo;
delete color_buf;
delete depth_buf;
+ delete fbo_ms;
+ delete color_buf_ms;
+ delete depth_buf_ms;
}
void Pipeline::set_hdr(bool h)
camera = c;
}
-PipelinePass &Pipeline::add_pass(const Tag &tag)
+Pipeline::Pass &Pipeline::add_pass(const Tag &tag)
{
- PipelinePass &pass = insert_unique(passes, tag, PipelinePass())->second;
+ Pass &pass = insert_unique(passes, tag, Pass())->second;
pass_order.push_back(tag);
return pass;
}
-PipelinePass &Pipeline::get_pass(const Tag &tag)
+Pipeline::Pass &Pipeline::get_pass(const Tag &tag)
{
return get_item(passes, tag);
}
-const PipelinePass &Pipeline::get_pass(const Tag &tag) const
+const Pipeline::Pass &Pipeline::get_pass(const Tag &tag) const
{
return get_item(passes, tag);
}
}
}
-void Pipeline::add_effect(Effect &e)
-{
- effects.push_back(&e);
-}
-
void Pipeline::add_postprocessor(PostProcessor &pp)
{
postproc.push_back(&pp);
void Pipeline::render(Renderer &renderer, const Tag &tag) const
{
- const PipelinePass &pass = get_pass(tag);
+ const Pass &pass = get_pass(tag);
- Bind bind_depth_test(pass.depth_test);
- Bind bind_blend(pass.blend);
- Bind bind_lighting(pass.lighting);
-
- for(vector<Effect *>::const_iterator i=pass.effects.begin(); i!=pass.effects.end(); ++i)
- (*i)->prepare();
+ Bind bind_depth_test(pass.get_depth_test());
+ Bind bind_blend(pass.get_blend());
+ Bind bind_lighting(pass.get_lighting());
for(vector<Slot>::const_iterator i=renderables.begin(); i!=renderables.end(); ++i)
if(i->passes.empty() || i->passes.count(tag))
i->renderable->render(renderer, tag);
-
- for(vector<Effect *>::const_iterator i=pass.effects.end(); i!=pass.effects.begin();)
- (*--i)->cleanup();
}
void Pipeline::render_all() const
f->clear(COLOR_BUFFER_BIT|DEPTH_BUFFER_BIT);
}
- for(vector<Effect *>::const_iterator i=effects.begin(); i!=effects.end(); ++i)
- (*i)->prepare();
-
Renderer renderer(camera);
for(vector<Tag>::const_iterator i=pass_order.begin(); i!=pass_order.end(); ++i)
render(renderer, *i);
- for(vector<Effect *>::const_iterator i=effects.end(); i!=effects.begin();)
- (*--i)->cleanup();
-
if(fbo)
{
if(fbo_ms)
}
+Pipeline::Pass::Pass():
+ lighting(0),
+ depth_test(0),
+ blend(0)
+{ }
+
+void Pipeline::Pass::set_lighting(const Lighting *l)
+{
+ lighting = l;
+}
+
+void Pipeline::Pass::set_depth_test(const DepthTest *d)
+{
+ depth_test = d;
+}
+
+void Pipeline::Pass::set_blend(const Blend *b)
+{
+ blend = b;
+}
+
+
Pipeline::Slot::Slot(const Renderable *r):
renderable(r)
{ }