return lods[i].technique.get();
}
-void Object::render(const Tag &tag) const
-{
- const RenderPass *pass = get_pass(tag, 0);
- if(!pass)
- return;
-
- Bind bind_shader(pass->get_shader_program());
- if(pass->get_shader_data())
- pass->get_shader_data()->apply();
- Bind bind_material(pass->get_material());
- Bind bind_texturing(pass->get_texturing());
-
- lods.front().mesh->draw();
-}
-
void Object::render(Renderer &renderer, const Tag &tag) const
{
const RenderPass *pass = get_pass(tag, 0);
virtual const Geometry::BoundingSphere<float, 3> *get_bounding_sphere() const { return &bounding_sphere; }
- virtual void render(const Tag &tag = Tag()) const;
-
virtual void render(Renderer &, const Tag & = Tag()) const;
/** Renders an instance of the object. The instance's hook functions are
i->renderable->finish_frame();
}
-void Pipeline::render(const Tag &tag) const
+void Pipeline::render() const
{
- if(tag.id)
- return;
-
Renderer renderer(camera);
setup_frame();
- render(renderer, tag);
+ render(renderer);
finish_frame();
}
virtual void setup_frame() const;
virtual void finish_frame() const;
- virtual void render(const Tag &tag = Tag()) const;
+ void render() const;
virtual void render(Renderer &, const Tag &tag = Tag()) const;
private:
+++ /dev/null
-#include "error.h"
-#include "renderable.h"
-#include "renderer.h"
-
-namespace Msp {
-namespace GL {
-
-void Renderable::render(const Tag &) const
-{
- throw invalid_operation("Renderable::render");
-}
-
-} // namespace Msp
-} // namespace GL
class Renderer;
/**
-Base class for renderable objects. All Renderables must support rendering with
-a Renderer, and may optionally provide support for standalone rendering.
+Base class for renderable objects. Rendering is performed with the help of a
+Renderer object.
The render methods take a Tag to identify a render pass. It is most commonly
used together with Techniques and Pipelines to implement multipass rendering.
/** Called when a complete frame has been rendered. */
virtual void finish_frame() const { }
- /** Renders the Renderable without a renderer. This can be convenient in
- some simple cases, but most renderables don't need to implement this
- method. */
- virtual void render(const Tag & = Tag()) const;
-
/** Renders the Renderable. Implementors should take care to return the
renderer to the state it was in, for example by using Renderer::Push. */
virtual void render(Renderer &, const Tag & = Tag()) const = 0;
delete *i;
}
-void Scene::render(const Tag &tag) const
-{
- Renderer renderer(0);
- render(renderer, tag);
-}
-
bool Scene::setup_frustum(const Renderer &renderer) const
{
const Camera *camera = renderer.get_camera();
virtual void add(const Renderable &) = 0;
virtual void remove(const Renderable &) = 0;
- using Renderable::render;
- virtual void render(const Tag & = Tag()) const;
-
protected:
bool setup_frustum(const Renderer &) const;
bool frustum_cull(const Renderable &) const;