Commit ffb7a5c3 authored by hybrid's avatar hybrid

Merged revisions 2485:2528 from 1.5 branch. Updated changes.txt. Fix for...

Merged revisions 2485:2528 from 1.5 branch. Updated changes.txt. Fix for getAngle. Font handling fixed.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2529 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 41d6633d
......@@ -31,8 +31,6 @@ Changes in 1.6 (??.??.2009)
- bugfix for 2795321 found by egrath: Don't rely anymore on broken XkbSetDetectableAutoRepeat.
- bugfix: Use make_lower throughout for spritebank filenames (found and patched by Ion Dune)
- bugfix: CMountPointReader::openFile no longer returns true for empty files. Corresponding test added.
- Direct3D now also uses screen coordinates in 2d mode, just like OpenGL. This means that screen coords are going from 0..ScreenWidth and 0..ScreenHeight instead of -1..1.
......@@ -86,10 +84,6 @@ Changes in 1.6 (??.??.2009)
- Improved window serialization
- bugfix (2796207): menu acted (wrongly) on left-click down instead of left-click up.
- Fixed problem with highlighting menus when mouse was outside sub-menu area.
- Add mouse events EMIE_MOUSE_DOUBLE_CLICK and EMIE_MOUSE_TRIPLE_CLICK (thx to Ulf for patch proposal)
- Set "ButtonStates" for mouse events also on Linux (was only for Windows formerly)
......@@ -635,33 +629,95 @@ Changes in 1.6 (??.??.2009)
-------------------------------------
Changes in version 1.5.1 (??.?? 2009)
- Make sure a missing font does not corrupt the skin.
- Fix getAngle in vector2d as suggested by xray. This has only a minor impact on s32 vectors.
- bugfix: CGUIFont::getCharacterFromPos regards now kerning (found by Arras)
- Add support for range fog in some OpenGL versions.
- Fix for shadow volume removal, submitted by vitek.
- Avoid using X11 autorepeat to deal with broken X11 versions.
- Speculars are properly exported into mtl files now, instead of corrupting them.
- Binary type loading in attributes fixed.
- bugfix: Use make_lower throughout for spritebank filenames (found and patched by Ion Dune)
- STL loader fixed: Right-handedness corrected, normals and bboxes are correctly added now.
- bugfix: CUnZipReader::openFile no longer returns true for empty files. Corresponding test added.
- Big endian issues in .x loader fixed.
- HSLColor methods repaired.
- copyToScaling fixed.
- Fixed problem with highlighting menus when mouse was outside sub-menu area.
- bugfix (2796207): menu acted (wrongly) on left-click down instead of left-click up.
- bswap16 fallback macro fixed
- getBaseName fixed to work correct with dots in filenames.
- static method isDriverSupported allows for simple check of available drivers.
- Some defines added to check for the Irrlicht version of the library.
- Make sure all renderstates are properly initialized
- Wrong size for main depth buffer fixed.
- Fix 3ds shininess to the allowed range.
- Fix loading of Collada files from irrEdit 1.2
- Remove texture pointers after texture clear.
- WindowsCE pathnames fixed.
- Some virtuals are now overridden as expected.
- Incomplete FBOs are properly signalled now
- Update to libpng 1.2.35, fixed issues on 64bit machines with system's libpng.
- Remove texture pointers after texture clear.
- Fixed wrong grab/drop in setOverrideFont
- Added draw2dRectOutline
- rectf and recti added.
- Fix ALPHA_CHANNEL_REF to a fixed check for alpha==127 as expected.
- Fixed OSX device bug where screen size was not set in fullscreen mode.
- cursor setVisible changed to be called less often.
- OpenGL version calculation fixed.
- OSX device now supports shift and ctrl keys.
- Fixed ambient light issues in bruningsvideo.
- Fixed ambient light issues in burningsvideo.
- device reset for d3d fixed when using VBOs.
- Fix dimension2d +=
- MD2 mesh loader: Now uses much less memory, reduced number of allocations when loading meshes.
- OpenGL render state (texture wrongly cached) fixed.
- Fixed animator removal.
- Fix terrain to use 32bit only when necessary, make terrain use hw buffers. Heightmap loading and height calculation fixed.
- Checnged collision checks for children of invisible elements to also be ignored (as they're actually invisible due to inheritance).
- Fix terrain to use 32bit only when necessary, make terrain use hw buffers. Heightmap loading and height calculation fixed. Visibility and LOD calculations updated.
- Some mem leaks fixed
......
......@@ -495,10 +495,14 @@ namespace video
//! Draws a vertex primitive list
/** Note that, depending on the index type, some vertices might be not
accessible through the index list. The limit is at 65535 vertices for 16bit
indices.
indices. Please note that currently not all primitives are available for
all drivers, and some might be emulated via triangle renders.
\param vertices Pointer to array of vertices.
\param vertexCount Amount of vertices in the array.
\param indexList Pointer to array of indices.
\param indexList Pointer to array of indices. These define the vertices used
for each primitive. Depending on the pType, indices are interpreted as single
objects (for point like primitives), pairs (for lines), triplets (for
triangles), or quads.
\param primCount Amount of Primitives
\param vType Vertex type, e.g. video::EVT_STANDARD for S3DVertex.
\param pType Primitive type, e.g. scene::EPT_TRIANGLE_FAN for a triangle fan.
......
......@@ -157,16 +157,16 @@ public:
}
//! Calculates the angle of this vector in degrees in the trigonometric sense.
/** 0 is to the left (9 o'clock), values increase clockwise.
/** 0 is to the right (3 o'clock), values increase counter-clockwise.
This method has been suggested by Pr3t3nd3r.
\return Returns a value between 0 and 360. */
f64 getAngleTrig() const
{
if (X == 0)
return Y < 0 ? 270 : 90;
else
if (Y == 0)
return X < 0 ? 180 : 0;
else
if (X == 0)
return Y < 0 ? 270 : 90;
if ( Y > 0)
if (X > 0)
......@@ -181,7 +181,7 @@ public:
}
//! Calculates the angle of this vector in degrees in the counter trigonometric sense.
/** 0 is to the right (3 o'clock), values increase counter-clockwise.
/** 0 is to the right (3 o'clock), values increase clockwise.
\return Returns a value between 0 and 360. */
inline f64 getAngle() const
{
......@@ -190,7 +190,8 @@ public:
else if (X == 0)
return Y < 0 ? 90 : 270;
f64 tmp = Y / getLength();
// don't use getLength here to avoid precision loss with s32 vectors
f64 tmp = Y / sqrt((f64)(X*X + Y*Y));
tmp = atan( core::squareroot(1 - tmp*tmp) / tmp) * RADTODEG64;
if (X>0 && Y>0)
......
......@@ -205,12 +205,14 @@ void CGUISkin::setFont(IGUIFont* font, EGUI_DEFAULT_FONT which)
if ((u32)which >= EGDS_COUNT)
return;
if (font)
font->grab();
if (Fonts[which])
Fonts[which]->drop();
if (font)
{
font->grab();
if (Fonts[which])
Fonts[which]->drop();
Fonts[which] = font;
Fonts[which] = font;
}
}
......
......@@ -913,8 +913,8 @@ bool CIrrDeviceLinux::run()
XEvent next_event;
XPeekEvent (event.xkey.display, &next_event);
if ((next_event.type == KeyPress) &&
(next_event.xkey.keycode == event.xkey.keycode) &&
(next_event.xkey.time - event.xkey.time) < 2) // usually same time, but on some systems a difference of 1 is possible
(next_event.xkey.keycode == event.xkey.keycode) &&
(next_event.xkey.time - event.xkey.time) < 2) // usually same time, but on some systems a difference of 1 is possible
{
/* Ignore the key release event */
break;
......
......@@ -168,7 +168,7 @@ bool fast_atof(void)
atofTime, fastAtofTime, oldFastAtofTime);
device->drop();
if(fastAtofTime > atofTime)
if(fastAtofTime > (1.2f*atofTime))
{
logTestString("The fast method is slower than atof()\n");
return false;
......
......@@ -134,8 +134,7 @@ int main(int argumentCount, char * arguments[])
(void)sprintf(runNextTest, "\"%s\" %d %d", arguments[0], testToRun, fails);
fails = system(runNextTest); // Spawn the next test in a new process.
}
if(1 == testToRun)
else
{
(void)openTestLog(false);
const int passed = numberOfTests - fails;
......@@ -161,7 +160,7 @@ int main(int argumentCount, char * arguments[])
#ifdef _IRR_WINDOWS_
(void)system("tests.log");
#else
(void)system("more tests.log");
(void)system("$PAGER tests.log");
#endif
}
......
......@@ -46,7 +46,7 @@ static bool doTests()
COMPARE_VECTORS(vec, vector2d<T>(0, (T)1.0000000461060017));
vec.set(10, 10);
vector2d<T> center(5, 5);
vector2d<T> center(5, 5);
vec.rotateBy(-5, center);
// -5 means rotate clockwise slightly, so expect the X to increase
// slightly and the Y to decrease slightly.
......@@ -59,6 +59,7 @@ static bool doTests()
vec.set(5, 5);
otherVec.set(10, 20);
logTestString("vector2df interpolation\n");
vector2d<T> interpolated;
(void)interpolated.interpolate(vec, otherVec, 0.f);
COMPARE_VECTORS(interpolated, otherVec); // 0.f means all the second vector
......@@ -86,6 +87,7 @@ static bool doTests()
COMPARE_VECTORS(interpolated, vec); // 1.f means all the first vector
logTestString("vector2df quadratic interpolation\n");
vector2d<T> thirdVec(20, 10);
interpolated = vec.getInterpolated_quadratic(otherVec, thirdVec, 0.f);
COMPARE_VECTORS(interpolated, vec); // 0.f means all the 1st vector
......@@ -102,6 +104,66 @@ static bool doTests()
interpolated = vec.getInterpolated_quadratic(otherVec, thirdVec, 1.f);
COMPARE_VECTORS(interpolated, thirdVec); // 1.f means all the 3rd vector
// check if getAngle returns values matching those of the double precision version
logTestString("vector2df getAngle\n");
for (s32 i=0; i<200; ++i)
{
core::vector2d<T> tmp(-1, -100+i);
core::vector2d<f64> ref(-1, -100+i);
if (!equals(tmp.getAngle(),ref.getAngle(), 0.0003))
{
logTestString("\nERROR: angle %.16f != angle %.16f\n",
tmp.getAngle(), ref.getAngle());
return false;
}
f32 val = atan2f(tmp.Y, tmp.X)*core::RADTODEG;
if (val<=0)
val=-val;
else
val=360-val;
if (!equals((f32)tmp.getAngle(),val, 0.5f))
{
logTestString("\nERROR: angle %.16f != atan2 %.16f\n vector %.16f, %.16f\n",
tmp.getAngle(), val, tmp.X, tmp.Y);
return false;
}
tmp = core::vector2d<T>(1, -100+i);
ref = core::vector2d<f64>(1, -100+i);
if (!equals(tmp.getAngle(),ref.getAngle(), 0.0003))
{
logTestString("\nERROR: angle %.16f != angle %.16f\n",
tmp.getAngle(), ref.getAngle());
return false;
}
val = atan2f(tmp.Y, tmp.X)*core::RADTODEG;
if (val<=0)
val=-val;
else
val=360-val;
if (!equals((f32)tmp.getAngle(),val, 0.5f))
{
logTestString("\nERROR: angle %.16f != atan2 %.16f\n vector %.16f, %.16f\n",
tmp.getAngle(), val, tmp.X, tmp.Y);
return false;
}
}
core::vector2d<T> tmp(0, -100);
core::vector2d<f64> ref(0, -100);
if (!equals(tmp.getAngle(),ref.getAngle()))
{
logTestString("\nERROR: angle %.16f != angle %.16f\n",
tmp.getAngle(), ref.getAngle());
return false;
}
tmp = core::vector2d<T>(0, 100);
ref = core::vector2d<f64>(0, 100);
if (!equals(tmp.getAngle(),ref.getAngle()))
{
logTestString("\nERROR: angle %.16f != angle %.16f\n",
tmp.getAngle(), ref.getAngle());
return false;
}
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment