diff options
Diffstat (limited to 'Renderer.h')
-rw-r--r-- | Renderer.h | 26 |
1 files changed, 18 insertions, 8 deletions
@@ -20,25 +20,35 @@ #ifndef ZOOM_RENDERER_H_ #define ZOOM_RENDERER_H_ -namespace Zoom { +#include "BSPTree.h" -class Triangle; -class BSPTree; +namespace Zoom { class Renderer { public: + Renderer() : lastTexture(0), renderVisitor(this) {} + void render(const BSPTree &tree); + void render(const std::list<BSPTree::TriangleRecord> &triangles); private: - static void renderTriangle(const Triangle &t); + void renderTriangle(const Triangle &t); - struct RenderVisitor { - void operator() (const Triangle &t) const { - renderTriangle(t); + class RenderVisitor { + public: + RenderVisitor(Renderer *renderer0) : renderer(renderer0) {} + + void operator() (const BSPTree::TriangleRecord &t) const { + renderer->renderTriangle(t.triangle); } + + private: + Renderer *renderer; }; - static const RenderVisitor renderVisitor; + unsigned lastTexture; + + const RenderVisitor renderVisitor; }; } |