MergeMetaTriangles: epsilon compare st, improves merging imprecise sts, e.g. for nonplanar surfaces after q3map_tcgen or just brush face texture projection
This commit is contained in:
parent
d113eed245
commit
bafb339c09
|
|
@ -123,6 +123,25 @@ inline Element float_mod( const Element& self, const ModulusElement& modulus ){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<typename Element, typename OtherElement>
|
||||||
|
inline bool vector2_equal( const BasicVector2<Element>& self, const BasicVector2<OtherElement>& other ){
|
||||||
|
return self.x() == other.x() && self.y() == other.y();
|
||||||
|
}
|
||||||
|
template<typename Element, typename OtherElement>
|
||||||
|
inline bool operator==( const BasicVector2<Element>& self, const BasicVector2<OtherElement>& other ){
|
||||||
|
return vector2_equal( self, other );
|
||||||
|
}
|
||||||
|
template<typename Element, typename OtherElement>
|
||||||
|
inline bool operator!=( const BasicVector2<Element>& self, const BasicVector2<OtherElement>& other ){
|
||||||
|
return !vector2_equal( self, other );
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename Element, typename OtherElement, typename Epsilon>
|
||||||
|
inline bool vector2_equal_epsilon( const BasicVector2<Element>& self, const BasicVector2<OtherElement>& other, Epsilon epsilon ){
|
||||||
|
return float_equal_epsilon( self.x(), other.x(), epsilon )
|
||||||
|
&& float_equal_epsilon( self.y(), other.y(), epsilon );
|
||||||
|
}
|
||||||
|
|
||||||
template<typename Element, typename OtherElement>
|
template<typename Element, typename OtherElement>
|
||||||
inline BasicVector2<Element> vector2_added( const BasicVector2<Element>& self, const BasicVector2<OtherElement>& other ){
|
inline BasicVector2<Element> vector2_added( const BasicVector2<Element>& self, const BasicVector2<OtherElement>& other ){
|
||||||
return BasicVector2<Element>(
|
return BasicVector2<Element>(
|
||||||
|
|
|
||||||
|
|
@ -1297,7 +1297,7 @@ int AddMetaVertToSurface( mapDrawSurface_t *ds, const bspDrawVert_t& dv1, const
|
||||||
( *coincident )++;
|
( *coincident )++;
|
||||||
|
|
||||||
/* compare texture coordinates and color */
|
/* compare texture coordinates and color */
|
||||||
if ( dv1.st[ 0 ] != dv2.st[ 0 ] || dv1.st[ 1 ] != dv2.st[ 1 ] ) {
|
if ( !vector2_equal_epsilon( dv1.st, dv2.st, 1e-4f ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( dv1.color[ 0 ].alpha() != dv2.color[ 0 ].alpha() ) {
|
if ( dv1.color[ 0 ].alpha() != dv2.color[ 0 ].alpha() ) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user