From 02bd968f518f8468f329e3dcdba5a4861ad9d48f Mon Sep 17 00:00:00 2001 From: tmj-fstate Date: Sat, 9 Nov 2019 13:11:22 +0100 Subject: [PATCH] maintenance: minor code tweaks --- PyInt.cpp | 3 ++- Segment.cpp | 4 +++- Texture.cpp | 3 ++- geometrybank.cpp | 8 ++++++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/PyInt.cpp b/PyInt.cpp index ef19721f..179798a6 100644 --- a/PyInt.cpp +++ b/PyInt.cpp @@ -43,7 +43,8 @@ void render_task::run() { PyInt_AsLong( outputwidth ), PyInt_AsLong( outputheight ), 0, GL_RGB, GL_UNSIGNED_BYTE, reinterpret_cast( PyString_AsString( output ) ) ); // setup texture parameters - if( GL_EXT_texture_filter_anisotropic ) { + if( ( Global.AnisotropicFiltering >= 0 ) + && ( GL_EXT_texture_filter_anisotropic != 0 ) ) { // anisotropic filtering ::glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, Global.AnisotropicFiltering ); } diff --git a/Segment.cpp b/Segment.cpp index 1b232110..d7425875 100644 --- a/Segment.cpp +++ b/Segment.cpp @@ -433,10 +433,12 @@ bool TSegment::RenderLoft( gfx::vertex_array &Output, Math3D::vector3 const &Ori m2 = 1.f; jmm2 = 0.f; } - +/* while( tv1 < 0.0 ) { tv1 += 1.0; } +*/ + tv1 = clamp_circular( tv1, 1.0f ); tv2 = tv1 - step / texturelength; // mapowanie na końcu segmentu t = fTsBuffer[ i ]; // szybsze od GetTFromS(s); diff --git a/Texture.cpp b/Texture.cpp index 34d33c34..f04d5617 100644 --- a/Texture.cpp +++ b/Texture.cpp @@ -1020,7 +1020,8 @@ opengl_texture::set_filtering() const { ::glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); ::glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR ); - if( GL_EXT_texture_filter_anisotropic ) { + if( ( Global.AnisotropicFiltering >= 0 ) + && ( GL_EXT_texture_filter_anisotropic != 0 ) ) { // anisotropic filtering ::glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, Global.AnisotropicFiltering ); } diff --git a/geometrybank.cpp b/geometrybank.cpp index b0b656f6..3cc68cbd 100644 --- a/geometrybank.cpp +++ b/geometrybank.cpp @@ -150,8 +150,12 @@ void calculate_tangent(vertex_array &vertices, int type) const glm::vec3 &t = tan[a]; const glm::vec3 &t2 = tan[vertex_count + a]; - vertices[a].tangent = glm::vec4(glm::normalize((t - n * glm::dot(n, t))), - (glm::dot(glm::cross(n, t), t2) < 0.0F) ? -1.0F : 1.0F); + vertices[a].tangent = + glm::vec4( + glm::normalize((t - n * glm::dot(n, t))), + (glm::dot(glm::cross(n, t), t2) < 0.0F) ? + -1.0F : + 1.0F); } }