From 77d2b33af8401a8aacadfc6e5beeaf9d58df8fda Mon Sep 17 00:00:00 2001 From: tmj-fstate Date: Thu, 11 Oct 2018 17:25:35 +0200 Subject: [PATCH] path uv mapping fix --- Segment.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Segment.cpp b/Segment.cpp index 0bc1c272..92a3a9ca 100644 --- a/Segment.cpp +++ b/Segment.cpp @@ -393,7 +393,7 @@ bool TSegment::RenderLoft( gfx::vertex_array &Output, Math3D::vector3 const &Ori float m1, jmm1, m2, jmm2; // pozycje względne na odcinku 0...1 (ale nie parametr Beziera) step = fStep; - tv1 = 0.0; // Ra: to by można było wyliczać dla odcinka, wyglądało by lepiej + tv1 = 1.0; // Ra: to by można było wyliczać dla odcinka, wyglądało by lepiej s = fStep * iSkip; // iSkip - ile odcinków z początku pominąć int i = iSkip; // domyślnie 0 t = fTsBuffer[ i ]; // tabela wattości t dla segmentów @@ -431,7 +431,7 @@ bool TSegment::RenderLoft( gfx::vertex_array &Output, Math3D::vector3 const &Ori while( tv1 < 0.0 ) { tv1 += 1.0; } - tv2 = tv1 + step / texturelength; // mapowanie na końcu segmentu + tv2 = tv1 - step / texturelength; // mapowanie na końcu segmentu t = fTsBuffer[ i ]; // szybsze od GetTFromS(s); pos2 = glm::dvec3{ FastGetPoint( t ) - Origin }; @@ -455,7 +455,7 @@ bool TSegment::RenderLoft( gfx::vertex_array &Output, Math3D::vector3 const &Ori Output.emplace_back( pt, glm::normalize( norm ), - glm::vec2 { 1.f - ( jmm1 * ShapePoints[ j ].texture.x + m1 * ShapePoints[ j + iNumShapePoints ].texture.x ) / texturescale, tv1 } ); + glm::vec2 { ( jmm1 * ShapePoints[ j ].texture.x + m1 * ShapePoints[ j + iNumShapePoints ].texture.x ) / texturescale, tv1 } ); } if( p ) // jeśli jest wskaźnik do tablicy if( *p ) @@ -475,7 +475,7 @@ bool TSegment::RenderLoft( gfx::vertex_array &Output, Math3D::vector3 const &Ori Output.emplace_back( pt, glm::normalize( norm ), - glm::vec2 { 1.f - ( jmm2 * ShapePoints[ j ].texture.x + m2 * ShapePoints[ j + iNumShapePoints ].texture.x ) / texturescale, tv2 } ); + glm::vec2 { ( jmm2 * ShapePoints[ j ].texture.x + m2 * ShapePoints[ j + iNumShapePoints ].texture.x ) / texturescale, tv2 } ); } if( p ) // jeśli jest wskaźnik do tablicy if( *p ) @@ -499,7 +499,7 @@ bool TSegment::RenderLoft( gfx::vertex_array &Output, Math3D::vector3 const &Ori Output.emplace_back( pt, glm::normalize( norm ), - glm::vec2 { 1.f - ShapePoints[ j ].texture.x / texturescale, tv1 } ); + glm::vec2 { ShapePoints[ j ].texture.x / texturescale, tv1 } ); pt = parallel2 * ShapePoints[ j ].position.x + pos2; pt.y += ShapePoints[ j ].position.y; @@ -510,7 +510,7 @@ bool TSegment::RenderLoft( gfx::vertex_array &Output, Math3D::vector3 const &Ori Output.emplace_back( pt, glm::normalize( norm ), - glm::vec2 { 1.f - ShapePoints[ j ].texture.x / texturescale, tv2 } ); + glm::vec2 { ShapePoints[ j ].texture.x / texturescale, tv2 } ); } } }