From: Mikko Rasa Date: Wed, 20 Jun 2018 10:40:17 +0000 (+0300) Subject: Make grid texture coordinates relative to the grid origin X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=6a9da72d249e6791709b6788a63802cafb7869dc;p=libs%2Fgl.git Make grid texture coordinates relative to the grid origin Instead of the world origin, which doesn't make much sense. --- diff --git a/source/grid.cpp b/source/grid.cpp index 78a3fecb..3f4d5e2f 100644 --- a/source/grid.cpp +++ b/source/grid.cpp @@ -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); } }