]> git.tdb.fi Git - libs/gl.git/commitdiff
Remove the transform function from Renderer
authorMikko Rasa <tdb@tdb.fi>
Fri, 12 Nov 2021 19:30:21 +0000 (21:30 +0200)
committerMikko Rasa <tdb@tdb.fi>
Fri, 12 Nov 2021 19:30:21 +0000 (21:30 +0200)
Renderables are encouraged to set a world-space model matrix directly, as
some scenes and effects won't work properly with incremental matrices.

source/animation/animatedobject.cpp
source/render/objectinstance.cpp
source/render/occludedscene.cpp
source/render/renderer.cpp
source/render/renderer.h

index a551d1a759544c4b1fe33fb655a533e78435209a..f02ff3e323fa023cf4e7d0a9a275d9709d653b01 100644 (file)
@@ -40,7 +40,7 @@ void AnimatedObject::set_uniform(const string &name, const KeyFrame::AnimatedUni
 
 void AnimatedObject::setup_render(Renderer &renderer, Tag) const
 {
-       renderer.transform(matrix);
+       renderer.set_matrix(matrix);
        renderer.add_shader_data(shdata);
 }
 
index bdbdffd17938a0408b190923b4056081bcc7dbd9..235a1ad6723c0033550a84a98976f52c30a0712f 100644 (file)
@@ -18,7 +18,7 @@ void ObjectInstance::render(Renderer &renderer, Tag tag) const
 
 void ObjectInstance::setup_render(Renderer &renderer, Tag) const
 {
-       renderer.transform(matrix);
+       renderer.set_matrix(matrix);
 }
 
 unsigned ObjectInstance::get_level_of_detail(const Renderer &renderer) const
index 0d8a5b857698d17d3a67e91e2367d674424eec05..644e380d15ab10a25917571fd29d61522040a99f 100644 (file)
@@ -143,7 +143,7 @@ void OccludedScene::render(Renderer &renderer, Tag tag) const
                        {
                                QueryPool::Activate activate_query(renderer, queries, i-occluded_cache.begin());
                                Renderer::Push push2(renderer);
-                               renderer.transform(Matrix(*i->renderable->get_matrix())
+                               renderer.set_matrix(Matrix(*i->renderable->get_matrix())
                                        .translate(i->bounding_sphere->get_center())
                                        .scale(i->bounding_sphere->get_radius()));
                                bounding_mesh.draw(renderer);
index d53d71459304540512362bbc6846c637d6244a1f..999ff1a22e32bc3bfa6e72d84a88936f6187661d 100644 (file)
@@ -95,12 +95,6 @@ void Renderer::set_matrix(const Matrix &matrix)
        changed |= MATRIX;
 }
 
-void Renderer::transform(const Matrix &matrix)
-{
-       get_state().model_matrix *= matrix;
-       changed |= MATRIX;
-}
-
 void Renderer::set_framebuffer(const Framebuffer *f)
 {
        get_state().framebuffer = f;
index 4c24068e03cb7a4e792c020575c997623423d346..575dbe67ee8af1e9adf758c3be0c7ca0caea3045 100644 (file)
@@ -137,9 +137,6 @@ public:
        /** Replaces the Renderer's model matrix. */
        void set_matrix(const Matrix &);
 
-       /** Applies a transform to the Renderer's model matrix. */
-       void transform(const Matrix &);
-
        /** Returns the current model matrix. */
        const Matrix &get_matrix() const { return get_state().model_matrix; }