]> git.tdb.fi Git - libs/gl.git/commitdiff
Make grid texture coordinates relative to the grid origin
authorMikko Rasa <tdb@tdb.fi>
Wed, 20 Jun 2018 10:40:17 +0000 (13:40 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 20 Jun 2018 10:40:17 +0000 (13:40 +0300)
Instead of the world origin, which doesn't make much sense.

source/grid.cpp

index 78a3fecb79906b16e1a7a1c4a4978497730cbb52..3f4d5e2fddb0fa11c9ab99f64f906fc3ecbaeece 100644 (file)
@@ -83,14 +83,14 @@ void GridBuilder::build(PrimitiveBuilder &builder) const
 
        for(unsigned j=0; j<=v_div; ++j)
        {
-               Vector3 row = origin+side2*(j*1.0f/v_div);
+               Vector3 row = side2*(j*1.0f/v_div);
                float v = dot(row, binorm)*v_scale;
                for(unsigned i=0; i<=u_div; ++i)
                {
                        Vector3 p = row+side1*(i*1.0f/u_div);
                        float u = dot(p, side1)*u_scale;
                        builder.texcoord(u, v);
-                       builder.vertex(p);
+                       builder.vertex(origin+p);
                }
        }