From 65e6d4a560977d554e9807c50f9c6e946bb4383c Mon Sep 17 00:00:00 2001 From: Garux Date: Sun, 17 Sep 2017 11:52:23 +0300 Subject: [PATCH] del douplicated code in seamless texturing->line --- radiant/surfacedialog.cpp | 45 --------------------------------------- radiant/winding.cpp | 2 +- radiant/winding.h | 2 ++ 3 files changed, 3 insertions(+), 46 deletions(-) diff --git a/radiant/surfacedialog.cpp b/radiant/surfacedialog.cpp index 5dc70e39..81490e21 100644 --- a/radiant/surfacedialog.cpp +++ b/radiant/surfacedialog.cpp @@ -1453,51 +1453,6 @@ void Face_getTexture( Face& face, CopiedString& shader, TextureProjection& proje typedef Function4 FaceGetTexture; -/* copied from winding.cpp */ -inline bool float_is_largest_absolute( double axis, double other ){ - return fabs( axis ) > fabs( other ); -} - -/// \brief Returns the index of the component of \p v that has the largest absolute value. -inline int vector3_largest_absolute_component_index( const DoubleVector3& v ){ - return ( float_is_largest_absolute( v[1], v[0] ) ) - ? ( float_is_largest_absolute( v[1], v[2] ) ) - ? 1 - : 2 - : ( float_is_largest_absolute( v[0], v[2] ) ) - ? 0 - : 2; -} - -/// \brief Returns the infinite line that is the intersection of \p plane and \p other. -inline DoubleLine plane3_intersect_plane3( const Plane3& plane, const Plane3& other ){ - DoubleLine line; - line.direction = vector3_cross( plane.normal(), other.normal() ); - switch ( vector3_largest_absolute_component_index( line.direction ) ) - { - case 0: - line.origin.x() = 0; - line.origin.y() = ( -other.dist() * plane.normal().z() - -plane.dist() * other.normal().z() ) / line.direction.x(); - line.origin.z() = ( -plane.dist() * other.normal().y() - -other.dist() * plane.normal().y() ) / line.direction.x(); - break; - case 1: - line.origin.x() = ( -plane.dist() * other.normal().z() - -other.dist() * plane.normal().z() ) / line.direction.y(); - line.origin.y() = 0; - line.origin.z() = ( -other.dist() * plane.normal().x() - -plane.dist() * other.normal().x() ) / line.direction.y(); - break; - case 2: - line.origin.x() = ( -other.dist() * plane.normal().y() - -plane.dist() * other.normal().y() ) / line.direction.z(); - line.origin.y() = ( -plane.dist() * other.normal().x() - -other.dist() * plane.normal().x() ) / line.direction.z(); - line.origin.z() = 0; - break; - default: - break; - } - - return line; -} - - void Face_setTexture_Seamless( Face& face, const char* shader, const TextureProjection& projection, const ContentsFlagsValue& flags ){ face.SetShader( shader ); diff --git a/radiant/winding.cpp b/radiant/winding.cpp index 9651af2c..3ada9647 100644 --- a/radiant/winding.cpp +++ b/radiant/winding.cpp @@ -59,7 +59,7 @@ inline int vector3_largest_absolute_component_index( const DoubleVector3& v ){ } /// \brief Returns the infinite line that is the intersection of \p plane and \p other. -inline DoubleLine plane3_intersect_plane3( const Plane3& plane, const Plane3& other ){ +DoubleLine plane3_intersect_plane3( const Plane3& plane, const Plane3& other ){ DoubleLine line; line.direction = vector3_cross( plane.normal(), other.normal() ); switch ( vector3_largest_absolute_component_index( line.direction ) ) diff --git a/radiant/winding.h b/radiant/winding.h index e4ad6ebc..f1ce97b9 100644 --- a/radiant/winding.h +++ b/radiant/winding.h @@ -286,4 +286,6 @@ inline void Winding_printConnectivity( Winding& winding ){ } } +DoubleLine plane3_intersect_plane3( const Plane3& plane, const Plane3& other ); + #endif