From e687c76db88bf06e75b288b688c4c69da7ef91b2 Mon Sep 17 00:00:00 2001 From: Nikola Milentijevic Date: Tue, 17 Mar 2015 19:40:09 +0100 Subject: [PATCH] Fix MeshDrawer::stream Direction vector is computed as stop - start, but the position in the loop is computed from stop as base, instead of from start; this is changed to start as the base (and then offset must be added). Multiplication of non-normalized direction vector with its length yields square of the expected current step inside the loop; this is changed to use the normalized direction vector. --- panda/src/grutil/meshDrawer.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/panda/src/grutil/meshDrawer.cxx b/panda/src/grutil/meshDrawer.cxx index e270a43786..631a6a8e79 100644 --- a/panda/src/grutil/meshDrawer.cxx +++ b/panda/src/grutil/meshDrawer.cxx @@ -369,8 +369,9 @@ void MeshDrawer::stream(const LVector3 &start, const LVector3 &stop, const LVect LVector3 relative_pos = stop; LVector3 vec = stop - start; PN_stdfloat distance = vec.length(); + vec.normalize(); for(int i = 0; i < number; i++) { - relative_pos = stop + vec * ((i-offset)*(distance/PN_stdfloat(number))); + relative_pos = start + vec * ((i+offset)*(distance/PN_stdfloat(number))); billboard(relative_pos,frame,size,_color); } }