Use a base Geometry
class:
class Geometry {
public:
virtual ~Geometry() { }
virtual void Render() = 0;
};
and have each of your Geometry-type classes derive from this base class and implement their specific rendering functionality by overriding Render
.
Then, Renderer::RenderGeometry
does not need to be a function template; it can simply take a pointer to the base Geometry
class and call the virtual function Render
.
James McNellis
2010-08-03 00:01:32