]> git.tdb.fi Git - libs/gl.git/commitdiff
Use matrix column accessors rather than multiplication
authorMikko Rasa <tdb@tdb.fi>
Tue, 14 Nov 2017 08:47:32 +0000 (10:47 +0200)
committerMikko Rasa <tdb@tdb.fi>
Tue, 14 Nov 2017 08:47:32 +0000 (10:47 +0200)
source/environmentmap.cpp
source/scene.cpp

index 9ca4d45253580134e59a060a7936a9f04c6fbbf2..94ae5150a7aee552a12bf2519c44e8733e59cae0 100644 (file)
@@ -47,7 +47,7 @@ void EnvironmentMap::setup_frame(Renderer &renderer)
        Renderer::Exclude exclude1(renderer, renderable);
        Renderer::Exclude exclude2(renderer, *this);
 
-       camera.set_position(*matrix*Vector3());
+       camera.set_position(matrix->column(3).slice<3>(0));
 
        BindRestore bind_fbo(fbo[0]);
        for(unsigned i=0; i<6; ++i)
index 3933599ba5c63f13307d1c755ba0cd9323842a1b..9d301fbfb0801ab3d1ea95b5104d88f81b94d902 100644 (file)
@@ -60,7 +60,7 @@ bool Scene::frustum_cull(const Renderable &renderable) const
                return false;
 
        Vector4 center = culling_matrix*(*matrix*compose(bsphere->get_center(), 1.0f));
-       Vector4 x_axis = *matrix*Vector4(bsphere->get_radius(), 0.0f, 0.0f, 0.0f);
+       Vector3 x_axis = (matrix->column(0)*bsphere->get_radius()).slice<3>(0);
        float radius_sq = inner_product(x_axis, x_axis);
 
        for(unsigned i=0; i<6; ++i)