X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Frenderer.h;h=1f198dae7007b00db30d4c699f0832ce06d0cca1;hb=5df9e64424dd157da1410b4498f53a4ac21e6aee;hp=5d8f686e35806a419e4a46167fd75161666ed725;hpb=58e3368ddb21de5c4bc6e208440de369fe4876f1;p=libs%2Fgl.git diff --git a/source/renderer.h b/source/renderer.h index 5d8f686e..1f198dae 100644 --- a/source/renderer.h +++ b/source/renderer.h @@ -89,16 +89,24 @@ private: virtual void update(); }; + enum ChangeMask + { + LEGACY_MATRIX = 1, + MODERN_MATRIX = 2, + MATRIX = LEGACY_MATRIX|MODERN_MATRIX, + LIGHTING = 4, + SHADER_DATA = 8 + }; + MtxStack mtx_stack; - bool mtx_changed; + unsigned char changed; bool matrices_loaded; + unsigned shdata_applied; const Camera *camera; std::vector state_stack; State *state; - bool lighting_changed; ProgramData standard_shdata; std::vector shdata_stack; - bool shdata_changed; const Buffer *element_buffer; std::set excluded; @@ -106,6 +114,11 @@ public: Renderer(const Camera *); ~Renderer(); + /** Resets all internal state and restarts rendering. There must be no + unpopped state in the stack. It is permissible to call begin() multiple + times without an intervening end(). */ + void begin(const Camera *); + MatrixStack &matrix_stack() { return mtx_stack; } const Camera *get_camera() const { return camera; } @@ -143,8 +156,9 @@ public: Renderer. DEPRECATED. */ void escape(); - /** Ends rendering, unbinding all objects and resetting state. There must - be no unpopped state in the stack. */ + /** Unbinds all objects and resets related state. There must be no unpopped + state in the stack. Rendering with the same camera can be restarted without + an explicit begin() call. */ void end(); void exclude(const Renderable &); @@ -155,6 +169,7 @@ public: private: void apply_state(); + void reset_state(); }; } // namespace GL