class Renderer;
/**
-Base class for renderable objects. Rendering is performed with the help of a
-Renderer object.
+Base class for things which can be rendered. Rendering is performed with the
+help of the Renderer class.
-The render method takes a Tag to identify a render pass. It can be used with
-a Technique to select alternative rendering methods, such as simplified shaders
-for a depth-only shadow pass.
+The tag parameter of render() can be used to choose between different render
+methods, such as simplified shaders for a depth-only shadow pass. Typically
+tags are defined using a Sequence.
-The setup_frame and finish_frame methods provide a mechanism for performing
+The setup_frame() and finish_frame() functions can be overridden to perform
once-per-frame operations. This is most useful for effects, which may need to
-do auxiliary rendering. With complex rendering hierarchies, these methods may
-be called multiple times for one frame, but it's guaranteed that no rendering
-will occur before a setup_frame call or after a finish_frame call.
+prepare textures or other data before actual rendering happens. With complex
+rendering graphs, these functions may be called multiple times for one frame,
+but it's guaranteed that no render() calls will occur before a setup_frame()
+call or after a finish_frame() call.
*/
class Renderable
{
protected:
- Renderable() { }
+ Renderable() = default;
public:
- virtual ~Renderable() { }
+ virtual ~Renderable() = default;
/** Returns the model matrix of the Renderable. Null is returned if no such
matrix exists. The matrix should be in world space for some effects to work
/** Called when a complete frame has been rendered. */
virtual void finish_frame() { }
- /** Renders the Renderable. Implementors should take care to return the
+ /** Renders the Renderable. Subclasses should take care to return the
renderer to the state it was in, for example by using Renderer::Push. */
virtual void render(Renderer &, Tag = Tag()) const = 0;
};