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::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);
+ 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))
}
+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)
{ }
#include <map>
#include <set>
-#include "pipelinepass.h"
#include "renderable.h"
namespace Msp {
namespace GL {
+class Blend;
class Camera;
+class DepthTest;
class Framebuffer;
+class Lighting;
class PostProcessor;
class Renderbuffer;
class Texture2D;
class Pipeline: public Renderable
{
+public:
+ class Pass
+ {
+ private:
+ const Lighting *lighting;
+ const DepthTest *depth_test;
+ const Blend *blend;
+
+ public:
+ Pass();
+
+ 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:
struct Slot
{
Slot(const Renderable *);
};
- typedef std::map<Tag, PipelinePass> PassMap;
+ typedef std::map<Tag, Pass> PassMap;
PassMap passes;
std::vector<Tag> pass_order;
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);
+ 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 &);
+++ /dev/null
-#include "pipelinepass.h"
-
-namespace Msp {
-namespace GL {
-
-PipelinePass::PipelinePass():
- lighting(0),
- depth_test(0),
- blend(0)
-{ }
-
-} // namespace GL
-} // namespace Msp
+++ /dev/null
-#ifndef MSP_GL_PIPELINEPASS_H_
-#define MSP_GL_PIPELINEPASS_H_
-
-namespace Msp {
-namespace GL {
-
-class Blend;
-class DepthTest;
-class Lighting;
-
-struct PipelinePass
-{
- const Lighting *lighting;
- const DepthTest *depth_test;
- const Blend *blend;
-
- PipelinePass();
-};
-
-} // namespace GL
-} // namespace Msp
-
-#endif