]> git.tdb.fi Git - libs/gl.git/blobdiff - source/render/renderable.h
Check the flat qualifier from the correct member
[libs/gl.git] / source / render / renderable.h
index 80fe172eb7435b44f147d4324294b6c72b5d5fd2..dcb7edd59cc474e97996cd056a3162fe415596aa 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef MSP_GL_RENDERABLE_H_
 #define MSP_GL_RENDERABLE_H_
 
-#include <string>
-#include <msp/core/inttypes.h>
 #include <msp/geometry/boundingsphere.h>
 #include "tag.h"
 
@@ -13,29 +11,26 @@ class Matrix;
 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() { }
-
-       /** Returns a key used for grouping Renderables in an InstanceScene.  The
-       returned value is treated as opaque. */
-       virtual IntPtr get_instance_key() const { return 0; }
+       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
@@ -53,9 +48,9 @@ public:
        /** 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 &, const Tag & = Tag()) const = 0;
+       virtual void render(Renderer &, Tag = Tag()) const = 0;
 };
 
 } // namespace Msp