]> git.tdb.fi Git - libs/gl.git/blobdiff - source/render/renderer.h
Use persistent tags for the model matrix uniforms in Renderer
[libs/gl.git] / source / render / renderer.h
index 79bd5cd913931a7eeca01f0e79e358b6965fd329..99c8c5002b242da1d18c694d77996ff8ded0607c 100644 (file)
@@ -105,6 +105,7 @@ private:
        {
                PIPELINE_KEY = 1,
                MATRIX = 2,
+               CAMERA = 4,
                SHADER_DATA = 16
        };
 
@@ -119,6 +120,9 @@ private:
        PipelineState *last_pipeline = 0;
        Commands commands;
 
+       static const Tag world_obj_matrix_tag;
+       static const Tag world_obj_normal_matrix_tag;
+
 public:
        Renderer();
 
@@ -144,6 +148,14 @@ private:
 
 public:
        void set_pipeline_key(std::uintptr_t);
+       void set_pipeline_key(const void *p) { set_pipeline_key(reinterpret_cast<uintptr_t>(p)); }
+
+       template<typename T>
+       void set_pipeline_key(std::uintptr_t k, T d)
+       { set_pipeline_key(k^(static_cast<uintptr_t>(d)<<((sizeof(std::uintptr_t)-sizeof(T))*std::numeric_limits<char>::digits))); }
+
+       template<typename T>
+       void set_pipeline_key(const void *p, T d) { set_pipeline_key(reinterpret_cast<uintptr_t>(p), d); }
 
        /** Sets the camera to render from.  The model matrix is reset to identity. */
        void set_camera(const Camera &);