vector2d::equals now has an tolerance parameter for passing the epsilon (like vector3d has already). Note that this changes the default behavior of vector2d::equals as well as functions using it like the operators for ==, !=, <, >, <=, >= when using vector2d with f64 as the tolerance is increased in that case (for f32 and integer values it shouldn't make any difference).

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4584 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2013-10-08 14:25:13 +00:00
parent c894f8258a
commit b09c2a5c2d
2 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,9 @@
--------------------------
Changes in 1.9 (not yet released)
- vector2d::equals now has an tolerance parameter for passing the epsilon (like vector3d had). Note that this changes the default
behavior of vector2d::equals as well as functions using it like the operators for ==, !=, <, >, <=, >= when using vector2d with f64
as the tolerance is increased in that case (for f32 and integer values it shouldn't make any difference).
- Material renderers which offers blending feature (eg. EMT_TRANSPARENT_ALPHA_CHANNEL, EMT_ONETEXTURE_BLEND etc.) require SMaterial::BlendOperation set to other value than EBO_NONE.
- Removed support for built-in T&L variables in ASM/GLSL shaders (variables related to vertices eg. gl_MultiTexCoord0 are still supported). This change allow us to reduce CPU overhead in shader material renderers.
- IGUIEnvironment::hasFocus has now a parameter checkSubElements as subelements are usually seen as part of an element. Default unfortunately must be false due to backward compatibility.

View File

@ -100,10 +100,11 @@ public:
//! Checks if this vector equals the other one.
/** Takes floating point rounding errors into account.
\param other Vector to compare with.
\param tolerance Epsilon value for both - comparing X and Y.
\return True if the two vector are (almost) equal, else false. */
bool equals(const vector2d<T>& other) const
bool equals(const vector2d<T>& other, const T tolerance = (T)ROUNDING_ERROR_f32 ) const
{
return core::equals(X, other.X) && core::equals(Y, other.Y);
return core::equals(X, other.X, tolerance) && core::equals(Y, other.Y, tolerance);
}
vector2d<T>& set(T nx, T ny) {X=nx; Y=ny; return *this; }