Merged revisiosn 1851:1883 from 1.5 branch. unit tests and severla bug fixes.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1884 dfc29bdd-3216-0410-991c-e03cc46cb475
master
hybrid 2008-11-29 22:35:56 +00:00
parent 19491a579f
commit 7a1fac9dfb
56 changed files with 2263 additions and 262 deletions

View File

@ -1,5 +1,7 @@
Changes in version 1.5 (...12.2008)
- Added a test suite in the /tests directory. This can be used to perform regression tests, and should be updated with new tests to verify fixes or validate new features.
- Changed the preferred way of altering light node's radius: Use the new member methods of ILightSceneNode instead of directly modifying the SLight structure.
- Changed the initial attenuation back to (0,1/radius,0). To override this value simply change the attenuation in the SLight (lightnode->getLightData().Attenuation.set(x,y,z))

View File

@ -32,8 +32,9 @@ IrrlichtDevice *Device = 0;
core::stringc StartUpModelFile;
core::stringw MessageText;
core::stringw Caption;
scene::IAnimatedMeshSceneNode* Model = 0;
scene::ISceneNode* Model = 0;
scene::ISceneNode* SkyBox = 0;
bool Octree=false;
scene::ICameraSceneNode* Camera[2] = { 0, 0};
@ -135,11 +136,30 @@ void loadModel(const c8* fn)
// set default material properties
Model = Device->getSceneManager()->addAnimatedMeshSceneNode(m);
if (Octree)
Model = Device->getSceneManager()->addOctTreeSceneNode(m->getMesh(0));
else
{
scene::IAnimatedMeshSceneNode* animModel = Device->getSceneManager()->addAnimatedMeshSceneNode(m);
animModel->setAnimationSpeed(30);
Model = animModel;
}
Model->setMaterialFlag(video::EMF_LIGHTING, false);
// Model->setMaterialFlag(video::EMF_BACK_FACE_CULLING, false);
Model->setDebugDataVisible(scene::EDS_OFF);
Model->setAnimationSpeed(30);
// we need to uncheck the menu entries. would be cool to fake a menu event, but
// that's not so simple. so we do it brute force
gui::IGUIContextMenu* menu = (gui::IGUIContextMenu*)Device->getGUIEnvironment()->getRootGUIElement()->getElementFromId(400, true);
if (menu)
{
menu->setItemChecked(1, false);
menu->setItemChecked(2, false);
menu->setItemChecked(3, false);
menu->setItemChecked(4, false);
menu->setItemChecked(5, false);
menu->setItemChecked(6, false);
}
}
@ -242,41 +262,64 @@ public:
case 101: // File -> Set Model Archive
env->addFileOpenDialog(L"Please select your game archive/directory");
break;
case 102: // File -> LoadAsOctree
Octree = !Octree;
menu->setItemChecked(menu->getSelectedItem(), Octree);
break;
case 200: // File -> Quit
Device->closeDevice();
break;
case 300: // View -> Skybox
menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
SkyBox->setVisible(!SkyBox->isVisible());
break;
case 400: // View -> Debug Information
case 401: // View -> Debug Information
menu->setItemChecked(menu->getSelectedItem()+1, false);
menu->setItemChecked(menu->getSelectedItem()+2, false);
menu->setItemChecked(menu->getSelectedItem()+3, false);
menu->setItemChecked(menu->getSelectedItem()+4, false);
menu->setItemChecked(menu->getSelectedItem()+5, false);
menu->setItemChecked(menu->getSelectedItem()+6, false);
if (Model)
Model->setDebugDataVisible(scene::EDS_OFF);
break;
case 410: // View -> Debug Information
menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
if (Model)
Model->setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model->isDebugDataVisible()^scene::EDS_BBOX));
break;
case 420: // View -> Debug Information
menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
if (Model)
Model->setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model->isDebugDataVisible()^scene::EDS_NORMALS));
break;
case 430: // View -> Debug Information
menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
if (Model)
Model->setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model->isDebugDataVisible()^scene::EDS_SKELETON));
break;
case 440: // View -> Debug Information
menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
if (Model)
Model->setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model->isDebugDataVisible()^scene::EDS_MESH_WIRE_OVERLAY));
break;
case 450: // View -> Debug Information
menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
if (Model)
Model->setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model->isDebugDataVisible()^scene::EDS_HALF_TRANSPARENCY));
break;
case 460: // View -> Debug Information
menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
if (Model)
Model->setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model->isDebugDataVisible()^scene::EDS_BBOX_BUFFERS));
break;
case 499: // View -> Debug Information
menu->setItemChecked(menu->getSelectedItem()-1, true);
menu->setItemChecked(menu->getSelectedItem()-2, true);
menu->setItemChecked(menu->getSelectedItem()-3, true);
menu->setItemChecked(menu->getSelectedItem()-4, true);
menu->setItemChecked(menu->getSelectedItem()-5, true);
menu->setItemChecked(menu->getSelectedItem()-6, true);
if (Model)
Model->setDebugDataVisible(scene::EDS_FULL);
break;
@ -566,16 +609,17 @@ int main(int argc, char* argv[])
submenu = menu->getSubMenu(0);
submenu->addItem(L"Open Model File & Texture...", 100);
submenu->addItem(L"Set Model Archive...", 101);
submenu->addItem(L"Load as Octree", 102);
submenu->addSeparator();
submenu->addItem(L"Quit", 200);
submenu = menu->getSubMenu(1);
submenu->addItem(L"toggle sky box visibility", 300);
submenu->addItem(L"toggle model debug information", -1, true, true);
submenu->addItem(L"sky box visible", 300, true, false, true);
submenu->addItem(L"toggle model debug information", 400, true, true);
submenu->addItem(L"model material", -1, true, true );
submenu = submenu->getSubMenu(1);
submenu->addItem(L"Off", 400);
submenu->addItem(L"Off", 401);
submenu->addItem(L"Bounding Box", 410);
submenu->addItem(L"Normals", 420);
submenu->addItem(L"Skeleton", 430);

View File

@ -47,7 +47,7 @@ namespace scene
//! Enumeration for render passes.
/** A parameter passed to the registerNodeForRendering() method of the ISceneManager,
specifying when the mode wants to be drawn in relation to the other nodes. */
specifying when the node wants to be drawn in relation to the other nodes. */
enum E_SCENE_NODE_RENDER_PASS
{
//! Camera pass. The active view is set up here. The very first pass.
@ -670,8 +670,9 @@ namespace scene
\return Returns a pointer to the sky dome if successful, otherwise NULL.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual ISceneNode* addSkyDomeSceneNode(video::ITexture* texture,
u32 horiRes, u32 vertRes, f64 texturePercentage, f64 spherePercentage,
ISceneNode* parent = 0, s32 id=-1) = 0;
u32 horiRes=16, u32 vertRes=8,
f64 texturePercentage=0.9, f64 spherePercentage=2.0,
ISceneNode* parent=0, s32 id=-1) = 0;
//! Adds a particle system scene node to the scene graph.
/** \param withDefaultEmitter: Creates a default working point emitter

View File

@ -156,6 +156,8 @@ namespace scene
video::SColor vertexColor = video::SColor ( 255, 255, 255, 255 ), s32 smoothFactor = 0 ) =0;
//! Initializes the terrain data. Loads the vertices from the heightMapFile.
/** The data is interpreted as signed integers of the given bit size. Allowed
values are 8, 16, and 32. The heightmap must be square. */
virtual bool loadHeightMapRAW(io::IReadFile* file, s32 bitsPerPixel = 16,
video::SColor vertexColor = video::SColor ( 255, 255, 255, 255 ), s32 smoothFactor = 0 ) =0;

View File

@ -15,9 +15,8 @@ namespace io
{
//! Interface providing methods for making it easier to write XML files.
/** This XML Writer only writes UTF-16 xml files, because these are
parsed faster than all other formats by IXMLReader.
*/
/** This XML Writer writes xml files using in the platform dependent
wchar_t format and sets the xml-encoding correspondingly. */
class IXMLWriter : public virtual IReferenceCounted
{
public:

View File

@ -106,6 +106,8 @@ namespace video
//! Returns the alpha component from A1R5G5B5 color
/** In Irrlicht, alpha refers to opacity.
\return The alpha value of the color. 0 is transparent, 1 is opaque. */
inline u32 getAlpha(u16 color)
{
return ((color >> 15)&0x1);
@ -146,6 +148,7 @@ namespace video
//! Class representing a 32 bit ARGB color.
/** The color values for alpha, red, green, and blue are
stored in a single u32. So all four values may be between 0 and 255.
Alpha in Irrlicht is opacity, so 0 is fully transparent, 255 is fully opaque (solid).
This class is used by most parts of the Irrlicht Engine
to specify a color. Another way is using the class SColorf, which
stores the color values in 4 floats.
@ -168,9 +171,8 @@ namespace video
: color(clr) {}
//! Returns the alpha component of the color.
/** The alpha component defines how transparent a color should
be. 255 means not transparent (opaque), 0 means fully
transparent. */
/** The alpha component defines how opaque a color is.
\return The alpha value of the color. 0 is fully transparent, 255 is fully opaque. */
u32 getAlpha() const { return color>>24; }
//! Returns the red component of the color.
@ -201,10 +203,8 @@ namespace video
}
//! Sets the alpha component of the Color.
/** The alpha component defines how transparent a color should
be.
\param a: Has to be a value between 0 and 255.
255 means not transparent (opaque), 0 means fully transparent. */
/** The alpha component defines how transparent a color should be.
\param a The alpha value of the color. 0 is fully transparent, 255 is fully opaque. */
void setAlpha(u32 a) { color = ((a & 0xff)<<24) | (color & 0x00ffffff); }
//! Sets the red component of the Color.
@ -431,7 +431,7 @@ namespace video
}
}
//! Returns the alpha component of the color in the range 0.0 to 1.0
//! Returns the alpha component of the color in the range 0.0 (transparent) to 1.0 (opaque)
f32 getAlpha() const { return a; }
//! Returns the red component of the color in the range 0.0 to 1.0

View File

@ -16,7 +16,7 @@ namespace scene
struct SSharedMeshBuffer : public IMeshBuffer
{
//! constructor
SSharedMeshBuffer() : IMeshBuffer(), ChangedID_Vertex(1), ChangedID_Index(1), MappingHint(Never), Vertices(0)
SSharedMeshBuffer() : IMeshBuffer(), ChangedID_Vertex(1), ChangedID_Index(1), Vertices(0), MappingHint(EHM_NEVER)
{
#ifdef _DEBUG
setDebugName("SSharedMeshBuffer");
@ -141,9 +141,9 @@ namespace scene
//! flags the mesh as changed, reloads hardware buffers
virtual void setDirty(E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX)
{
if (E_BUFFER_TYPE Buffer==EBT_VERTEX_AND_INDEX || E_BUFFER_TYPE Buffer==EBT_VERTEX)
if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_VERTEX)
++ChangedID_Vertex;
if (E_BUFFER_TYPE Buffer==EBT_VERTEX_AND_INDEX || E_BUFFER_TYPE Buffer==EBT_INDEX)
if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_INDEX)
++ChangedID_Index;
}

View File

@ -158,6 +158,12 @@ namespace core
return min_ (max_(value,low), high);
}
//! returns if a equals b, taking possible rounding errors into account
inline bool equals(const f64 a, const f64 b, const f64 tolerance = ROUNDING_ERROR_64)
{
return (a + tolerance >= b) && (a - tolerance <= b);
}
//! returns if a equals b, taking possible rounding errors into account
inline bool equals(const f32 a, const f32 b, const f32 tolerance = ROUNDING_ERROR_32)
{

View File

@ -31,28 +31,41 @@
#include "IrrCompileConfig.h"
#include "aabbox3d.h"
#include "CDynamicMeshBuffer.h"
#include "CIndexBuffer.h"
#include "CMeshBuffer.h"
#include "coreutil.h"
#include "irrArray.h"
#include "irrMap.h"
#include "irrMath.h"
#include "irrString.h"
#include "irrTypes.h"
#include "SColor.h"
#include "SLight.h"
#include "CVertexBuffer.h"
#include "dimension2d.h"
#include "ECullingTypes.h"
#include "EDebugSceneTypes.h"
#include "EDriverFeatures.h"
#include "EDriverTypes.h"
#include "IAttributes.h"
#include "IAttributeExchangingObject.h"
#include "EGUIAlignment.h"
#include "EGUIElementTypes.h"
#include "EHardwareBufferFlags.h"
#include "EMaterialFlags.h"
#include "EMaterialTypes.h"
#include "EMeshWriterEnums.h"
#include "EMessageBoxFlags.h"
#include "ESceneNodeAnimatorTypes.h"
#include "ESceneNodeTypes.h"
#include "ETerrainElements.h"
#include "fast_atof.h"
#include "heapsort.h"
#include "IAnimatedMesh.h"
#include "IAnimatedMeshMD2.h"
#include "IAnimatedMeshMD3.h"
#include "IQ3LevelMesh.h"
#include "IAnimatedMeshSceneNode.h"
#include "IAttributeExchangingObject.h"
#include "IAttributes.h"
#include "IBillboardSceneNode.h"
#include "IBillboardTextSceneNode.h"
#include "IBoneSceneNode.h"
#include "ICameraSceneNode.h"
#include "ICursorControl.h"
#include "IDummyTransformationSceneNode.h"
#include "IDynamicMeshBuffer.h"
#include "IEventReceiver.h"
#include "IFileList.h"
#include "IFileSystem.h"
@ -83,6 +96,9 @@
#include "IGUIToolbar.h"
#include "IGUIWindow.h"
#include "IImage.h"
#include "IImageLoader.h"
#include "IImageWriter.h"
#include "IIndexBuffer.h"
#include "ILightSceneNode.h"
#include "ILogger.h"
#include "IMaterialRenderer.h"
@ -90,29 +106,44 @@
#include "IMesh.h"
#include "IMeshBuffer.h"
#include "IMeshCache.h"
#include "IMeshSceneNode.h"
#include "IMeshLoader.h"
#include "IMeshManipulator.h"
#include "IMeshSceneNode.h"
#include "IMeshWriter.h"
#include "IMetaTriangleSelector.h"
#include "IOSOperator.h"
#include "IParticleSystemSceneNode.h" // also includes all emitters and attractors
#include "IQ3LevelMesh.h"
#include "IQ3Shader.h"
#include "IReadFile.h"
#include "IReferenceCounted.h"
#include "irrArray.h"
#include "IrrlichtDevice.h"
#include "irrList.h"
#include "irrMap.h"
#include "irrMath.h"
#include "irrString.h"
#include "irrTypes.h"
#include "irrXML.h"
#include "ISceneCollisionManager.h"
#include "ISceneManager.h"
#include "ISceneNode.h"
#include "ISceneUserDataSerializer.h"
#include "ITriangleSelector.h"
#include "ISceneNodeAnimator.h"
#include "ISceneCollisionManager.h"
#include "ISceneNodeFactory.h"
#include "ISceneNodeAnimatorFactory.h"
#include "ISceneNodeAnimatorCameraFPS.h"
#include "ISceneNodeAnimatorCameraMaya.h"
#include "ISceneNodeAnimatorCollisionResponse.h"
#include "ISceneNodeAnimatorFactory.h"
#include "ISceneNodeFactory.h"
#include "ISceneUserDataSerializer.h"
#include "IShaderConstantSetCallBack.h"
#include "IShadowVolumeSceneNode.h"
#include "IParticleSystemSceneNode.h" // also includes all emitters and attractors
#include "ISkinnedMesh.h"
#include "ITerrainSceneNode.h"
#include "ITextSceneNode.h"
#include "ITexture.h"
#include "IReferenceCounted.h"
#include "ITimer.h"
#include "ITriangleSelector.h"
#include "IVertexBuffer.h"
#include "IVideoDriver.h"
#include "IVideoModeList.h"
#include "IVolumeLightSceneNode.h"
@ -122,25 +153,32 @@
#include "Keycodes.h"
#include "line2d.h"
#include "line3d.h"
#include "irrList.h"
#include "matrix4.h"
#include "plane3d.h"
#include "vector2d.h"
#include "vector3d.h"
#include "triangle3d.h"
#include "position2d.h"
#include "quaternion.h"
#include "rect.h"
#include "S3DVertex.h"
#include "SAnimatedMesh.h"
#include "SceneParameters.h"
#include "SColor.h"
#include "SExposedVideoData.h"
#include "SIrrCreationParameters.h"
#include "SKeyMap.h"
#include "SLight.h"
#include "SMaterial.h"
#include "SMesh.h"
#include "SMeshBuffer.h"
#include "SMeshBufferLightMap.h"
#include "SMeshBufferTangents.h"
#include "SParticle.h"
#include "SSharedMeshBuffer.h"
#include "SSkinMeshBuffer.h"
#include "SVertexIndex.h"
#include "SViewFrustum.h"
#include "triangle3d.h"
#include "vector2d.h"
#include "vector3d.h"
/*! \mainpage Irrlicht Engine 1.5.beta API documentation
*

View File

@ -32,15 +32,21 @@ class plane3d
// Constructors
plane3d(): Normal(0,1,0) { recalculateD(vector3d<T>(0,0,0)); }
plane3d(const vector3d<T>& MPoint, const vector3d<T>& Normal) : Normal(Normal) { recalculateD(MPoint); }
plane3d(T px, T py, T pz, T nx, T ny, T nz) : Normal(nx, ny, nz) { recalculateD(vector3d<T>(px, py, pz)); }
plane3d(const vector3d<T>& point1, const vector3d<T>& point2, const vector3d<T>& point3)
{ setPlane(point1, point2, point3); }
plane3d(const vector3d<T> & normal, const T d) : Normal(normal), D(d) { }
// operators
inline bool operator==(const plane3d<T>& other) const { return (D==other.D && Normal==other.Normal);}
inline bool operator!=(const plane3d<T>& other) const { return !(D==other.D && Normal==other.Normal);}
inline bool operator==(const plane3d<T>& other) const { return (equals(D, other.D) && Normal==other.Normal);}
inline bool operator!=(const plane3d<T>& other) const { return !(*this == other);}
// functions

View File

@ -59,8 +59,8 @@ public:
bool operator<(const vector2d<T>&other) const { return X<other.X && Y<other.Y; }
bool operator>(const vector2d<T>&other) const { return X>other.X && Y>other.Y; }
bool operator==(const vector2d<T>& other) const { return other.X==X && other.Y==Y; }
bool operator!=(const vector2d<T>& other) const { return other.X!=X || other.Y!=Y; }
bool operator==(const vector2d<T>& other) const { return equals(other); }
bool operator!=(const vector2d<T>& other) const { return !equals(other); }
// functions
@ -111,20 +111,20 @@ public:
return vector2d<T>(X - other.X, Y - other.Y).getLengthSQ();
}
//! rotates the point around a center by an amount of degrees.
/** \param degrees Amount of degrees to rotate by.
//! rotates the point anticlockwise around a center by an amount of degrees.
/** \param degrees Amount of degrees to rotate by, anticlockwise.
\param center Rotation center.
\return This vector after transformation. */
vector2d<T>& rotateBy(f64 degrees, const vector2d<T>& center)
{
degrees *= DEGTORAD64;
const T cs = (T)cos(degrees);
const T sn = (T)sin(degrees);
const f64 cs = cos(degrees);
const f64 sn = sin(degrees);
X -= center.X;
Y -= center.Y;
set(X*cs - Y*sn, X*sn + Y*cs);
set((T)(X*cs - Y*sn), (T)(X*sn + Y*cs));
X += center.X;
Y += center.Y;
@ -136,12 +136,12 @@ public:
\return Reference to this vector, after normalization. */
vector2d<T>& normalize()
{
T l = X*X + Y*Y;
if (l == 0)
f32 length = (f32)(X*X + Y*Y);
if (core::equals(length, 0.f))
return *this;
l = core::reciprocal_squareroot ( (f32)l );
X *= l;
Y *= l;
length = core::reciprocal_squareroot ( length );
X = (T)(X * length);
Y = (T)(Y * length);
return *this;
}
@ -233,41 +233,45 @@ public:
}
}
//! Get the interpolated vector
/** \param other Other vector to interpolate with.
\param d Value between 0.0f and 1.0f.
\return Interpolated vector. */
vector2d<T> getInterpolated(const vector2d<T>& other, f32 d) const
//! Creates an interpolated vector between this vector and another vector.
/** \param other The other vector to interpolate with.
\param d Interpolation value between 0.0f (all the other vector) and 1.0f (all this vector).
Note that this is the opposite direction of interpolation to getInterpolated_quadratic()
\return An interpolated vector. This vector is not modified. */
vector2d<T> getInterpolated(const vector2d<T>& other, f64 d) const
{
T inv = (T) 1.0 - d;
return vector2d<T>(other.X*inv + X*d, other.Y*inv + Y*d);
f64 inv = 1.0f - d;
return vector2d<T>((T)(other.X*inv + X*d), (T)(other.Y*inv + Y*d));
}
//! Returns (quadratically) interpolated vector between this and the two given ones.
/** \param v2 Second vector to interpolate with
\param v3 Third vector to interpolate with
\param d Value between 0.0f and 1.0f.
\return Interpolated vector. */
vector2d<T> getInterpolated_quadratic(const vector2d<T>& v2, const vector2d<T>& v3, const T d) const
//! Creates a quadratically interpolated vector between this and two other vectors.
/** \param v2 Second vector to interpolate with.
\param v3 Third vector to interpolate with (maximum at 1.0f)
\param d Interpolation value between 0.0f (all this vector) and 1.0f (all the 3rd vector).
Note that this is the opposite direction of interpolation to getInterpolated() and interpolate()
\return An interpolated vector. This vector is not modified. */
vector2d<T> getInterpolated_quadratic(const vector2d<T>& v2, const vector2d<T>& v3, f64 d) const
{
// this*(1-d)*(1-d) + 2 * v2 * (1-d) + v3 * d * d;
const T inv = (T) 1.0 - d;
const T mul0 = inv * inv;
const T mul1 = (T) 2.0 * d * inv;
const T mul2 = d * d;
const f64 inv = 1.0f - d;
const f64 mul0 = inv * inv;
const f64 mul1 = 2.0f * d * inv;
const f64 mul2 = d * d;
return vector2d<T> ( X * mul0 + v2.X * mul1 + v3.X * mul2,
Y * mul0 + v2.Y * mul1 + v3.Y * mul2);
return vector2d<T> ( (T)(X * mul0 + v2.X * mul1 + v3.X * mul2),
(T)(Y * mul0 + v2.Y * mul1 + v3.Y * mul2));
}
//! Sets this vector to the linearly interpolated vector between a and b.
/** \param a first vector to interpolate with
\param b second vector to interpolate with
\param t value between 0.0f and 1.0f. */
vector2d<T>& interpolate(const vector2d<T>& a, const vector2d<T>& b, const f32 t)
/** \param a first vector to interpolate with, maximum at 1.0f
\param b second vector to interpolate with, maximum at 0.0f
\param d Interpolation value between 0.0f (all vector b) and 1.0f (all vector a)
Note that this is the opposite direction of interpolation to getInterpolated_quadratic()
*/
vector2d<T>& interpolate(const vector2d<T>& a, const vector2d<T>& b, f64 d)
{
X = b.X + ( ( a.X - b.X ) * t );
Y = b.Y + ( ( a.Y - b.Y ) * t );
X = (T)((f64)b.X + ( ( a.X - b.X ) * d ));
Y = (T)((f64)b.Y + ( ( a.Y - b.Y ) * d ));
return *this;
}

View File

@ -13,6 +13,11 @@ namespace core
{
//! 3d vector template class with lots of operators and methods.
/** The vector3d class is used in Irrlicht for three main purposes:
1) As a direction vector (most of the methods assume this).
2) As a position in 3d space (which is synonymous with a direction vector from the origin to this position).
3) To hold three Euler rotations, where X is pitch, Y is yaw and Z is roll.
*/
template <class T>
class vector3d
{
@ -132,17 +137,16 @@ namespace core
//! Normalizes the vector.
/** In case of the 0 vector the result is still 0, otherwise
the length of the vector will be 1.
TODO: 64 Bit template doesnt work.. need specialized template
\return Reference to this vector after normalization. */
vector3d<T>& normalize()
{
T l = X*X + Y*Y + Z*Z;
if (l == 0)
f32 length = (f32)(X*X + Y*Y + Z*Z);
if (core::equals(length, 0.f))
return *this;
l = (T) reciprocal_squareroot ( (f32)l );
X *= l;
Y *= l;
Z *= l;
length = core::reciprocal_squareroot ( (f32)length );
X = (T)(X * length);
Y = (T)(Y * length);
Z = (T)(Z * length);
return *this;
}
@ -168,11 +172,11 @@ namespace core
void rotateXZBy(f64 degrees, const vector3d<T>& center=vector3d<T>())
{
degrees *= DEGTORAD64;
T cs = (T)cos(degrees);
T sn = (T)sin(degrees);
f64 cs = cos(degrees);
f64 sn = sin(degrees);
X -= center.X;
Z -= center.Z;
set(X*cs - Z*sn, Y, X*sn + Z*cs);
set((T)(X*cs - Z*sn), Y, (T)(X*sn + Z*cs));
X += center.X;
Z += center.Z;
}
@ -183,11 +187,11 @@ namespace core
void rotateXYBy(f64 degrees, const vector3d<T>& center=vector3d<T>())
{
degrees *= DEGTORAD64;
T cs = (T)cos(degrees);
T sn = (T)sin(degrees);
f64 cs = cos(degrees);
f64 sn = sin(degrees);
X -= center.X;
Y -= center.Y;
set(X*cs - Y*sn, X*sn + Y*cs, Z);
set((T)(X*cs - Y*sn), (T)(X*sn + Y*cs), Z);
X += center.X;
Y += center.Y;
}
@ -198,45 +202,74 @@ namespace core
void rotateYZBy(f64 degrees, const vector3d<T>& center=vector3d<T>())
{
degrees *= DEGTORAD64;
T cs = (T)cos(degrees);
T sn = (T)sin(degrees);
f64 cs = cos(degrees);
f64 sn = sin(degrees);
Z -= center.Z;
Y -= center.Y;
set(X, Y*cs - Z*sn, Y*sn + Z*cs);
set(X, (T)(Y*cs - Z*sn), (T)(Y*sn + Z*cs));
Z += center.Z;
Y += center.Y;
}
//! Returns interpolated vector.
/** \param other Other vector to interpolate between
\param d Value between 0.0f and 1.0f. */
vector3d<T> getInterpolated(const vector3d<T>& other, const T d) const
//! Creates an interpolated vector between this vector and another vector.
/** \param other The other vector to interpolate with.
\param d Interpolation value between 0.0f (all the other vector) and 1.0f (all this vector).
Note that this is the opposite direction of interpolation to getInterpolated_quadratic()
\return An interpolated vector. This vector is not modified. */
vector3d<T> getInterpolated(const vector3d<T>& other, f64 d) const
{
const T inv = (T) 1.0 - d;
return vector3d<T>(other.X*inv + X*d, other.Y*inv + Y*d, other.Z*inv + Z*d);
const f64 inv = 1.0 - d;
return vector3d<T>((T)(other.X*inv + X*d), (T)(other.Y*inv + Y*d), (T)(other.Z*inv + Z*d));
}
//! Returns interpolated vector. ( quadratic )
/** \param v2 Second vector to interpolate with
\param v3 Third vector to interpolate with
\param d Value between 0.0f and 1.0f. */
vector3d<T> getInterpolated_quadratic(const vector3d<T>& v2, const vector3d<T>& v3, const T d) const
//! Creates a quadratically interpolated vector between this and two other vectors.
/** \param v2 Second vector to interpolate with.
\param v3 Third vector to interpolate with (maximum at 1.0f)
\param d Interpolation value between 0.0f (all this vector) and 1.0f (all the 3rd vector).
Note that this is the opposite direction of interpolation to getInterpolated() and interpolate()
\return An interpolated vector. This vector is not modified. */
vector3d<T> getInterpolated_quadratic(const vector3d<T>& v2, const vector3d<T>& v3, f64 d) const
{
// this*(1-d)*(1-d) + 2 * v2 * (1-d) + v3 * d * d;
const T inv = (T) 1.0 - d;
const T mul0 = inv * inv;
const T mul1 = (T) 2.0 * d * inv;
const T mul2 = d * d;
const f64 inv = (T) 1.0 - d;
const f64 mul0 = inv * inv;
const f64 mul1 = (T) 2.0 * d * inv;
const f64 mul2 = d * d;
return vector3d<T> ( X * mul0 + v2.X * mul1 + v3.X * mul2,
Y * mul0 + v2.Y * mul1 + v3.Y * mul2,
Z * mul0 + v2.Z * mul1 + v3.Z * mul2);
return vector3d<T> ((T)(X * mul0 + v2.X * mul1 + v3.X * mul2),
(T)(Y * mul0 + v2.Y * mul1 + v3.Y * mul2),
(T)(Z * mul0 + v2.Z * mul1 + v3.Z * mul2));
}
//! Gets the Y and Z rotations of a vector.
/** Thanks to Arras on the Irrlicht forums for this method.
\return A vector representing the rotation in degrees of
this vector. The Z component of the vector will always be 0. */
//! Sets this vector to the linearly interpolated vector between a and b.
/** \param a first vector to interpolate with, maximum at 1.0f
\param b second vector to interpolate with, maximum at 0.0f
\param d Interpolation value between 0.0f (all vector b) and 1.0f (all vector a)
Note that this is the opposite direction of interpolation to getInterpolated_quadratic()
*/
vector3d<T>& interpolate(const vector3d<T>& a, const vector3d<T>& b, f64 d)
{
X = (T)((f64)b.X + ( ( a.X - b.X ) * d ));
Y = (T)((f64)b.Y + ( ( a.Y - b.Y ) * d ));
Z = (T)((f64)b.Z + ( ( a.Z - b.Z ) * d ));
return *this;
}
//! Get the rotations that would make a (0,0,1) direction vector point in the same direction as this direction vector.
/** Thanks to Arras on the Irrlicht forums for this method. This utility method is very useful for
orienting scene nodes towards specific targets. For example, if this vector represents the difference
between two scene nodes, then applying the result of getHorizontalAngle() to one scene node will point
it at the other one.
Example code:
// Where target and seeker are of type ISceneNode*
const vector3df toTarget(target->getAbsolutePosition() - seeker->getAbsolutePosition());
const vector3df requiredRotation = toTarget.getHorizontalAngle();
seeker->setRotation(requiredRotation);
\return A rotation vector containing the X (pitch) and Y (raw) rotations (in degrees) that when applied to a
+Z (e.g. 0, 0, 1) direction vector would make it point in the same direction as this vector. The Z (roll) rotation
is always 0, since two Euler rotations are sufficient to point in any given direction. */
vector3d<T> getHorizontalAngle() const
{
vector3d<T> angle;
@ -261,15 +294,13 @@ namespace core
}
//! Builds a direction vector from (this) rotation vector.
/** This vector is assumed to hold 3 Euler angle rotations, in degrees.
The implementation performs the same calculations as using a matrix to
do the rotation.
\param[in] forwards The direction representing "forwards" which will be
rotated by this vector. If you do not provide a
direction, then the positive Z axis (0, 0, 1) will
be assumed to be fowards.
\return A vector calculated by rotating the forwards direction by
the 3 Euler angles that this vector is assumed to represent. */
/** This vector is assumed to be a rotation vector composed of 3 Euler angle rotations, in degrees.
The implementation performs the same calculations as using a matrix to do the rotation.
\param[in] forwards The direction representing "forwards" which will be rotated by this vector.
If you do not provide a direction, then the +Z axis (0, 0, 1) will be assumed to be forwards.
\return A direction vector calculated by rotating the forwards direction by the 3 Euler angles
(in degrees) represented by this vector. */
vector3d<T> rotationToDirection(const vector3d<T> & forwards = vector3d<T>(0, 0, 1)) const
{
const f64 cr = cos( core::DEGTORAD64 * X );

View File

@ -1,5 +1,5 @@
==========================================================================
The Irrlicht Engine SDK version 1.4.2
The Irrlicht Engine SDK version 1.5.beta
==========================================================================
Welcome the Irrlicht Engine SDK.
@ -21,9 +21,9 @@ The Irrlicht Engine SDK version 1.4.2
You will find some directories after uncompressing the archive of the
SDK. These are:
\bin The compiled library Irrlicht.DLL and some compiled demo
and example applications, just start them to see the
\bin The compiled library Irrlicht.DLL and some compiled demo
and example applications, just start them to see the
Irrlicht Engine in action. Windows only.
\doc Documentation of the Irrlicht Engine.
\examples Examples and tutorials showing how to use the engine with
@ -39,7 +39,7 @@ The Irrlicht Engine SDK version 1.4.2
\source The source code of the Irrlicht Engine. This code is
not needed to develop applications with the engine,
but it is included to enable recompilation and
debugging, if necessary.
debugging, if necessary.
\tools Useful tools (with sourcecode) for the engine.
@ -52,8 +52,8 @@ The Irrlicht Engine SDK version 1.4.2
directory, and start some applications. There should also be an
application named Demo.exe which should show the most
interesting features of Irrlicht.
To start developing own applications and games with the engine take
To start developing own applications and games with the engine take
a look at the 01.HelloWorld example in the \examples directory.
There is also a .html file with a tutorial which should be
easily comprehensible.
@ -64,7 +64,7 @@ The Irrlicht Engine SDK version 1.4.2
subfolder source/Irrlicht. After this you should be able to 'make' all
example applications in /examples. You can run the examples directly from the
directory they are created in.
It is also possible to use Irrlicht as shared object
(libIrrlicht.so.versionNumber). Use the proper makefile target for this by
running 'make sharedlib' in the source folder. See the Makefile for details.
@ -91,32 +91,32 @@ The Irrlicht Engine SDK version 1.4.2
If you ever want to (re)compile the engine yourself (which means you don't
want to use the precompiled version) you need the following:
* Windows:
* Needed: PlatformSDK (which usually comes with all IDEs, download
* Needed: PlatformSDK (which usually comes with all IDEs, download
it separately for MSVC Express 2005)
* Optional: DirectX SDK, for D3D9 support
* Optional: DirectX SDK prior to May 2006, for D3D8 support
* Optional: DirectX SDK, for D3D9 support
* Optional: DirectX SDK prior to May 2006, for D3D8 support
* Linux:
* Needed: XServer with include files
* Optional: OpenGL headers and libraries (libGL.so), for OpenGL support
* GLX + XF86VidMode or XRandr extension (X11 support libraries,
the latter two for fullscreen mode)
* Needed: XServer with include files
* Optional: OpenGL headers and libraries (libGL.so), for OpenGL support
* GLX + XF86VidMode or XRandr extension (X11 support libraries,
the latter two for fullscreen mode)
* OSX:
* Needed: XCode and Cocoa framework
* Needed: XCode and Cocoa framework
* Needed: OpenGL headers and libraries
==========================================================================
4. Release Notes
==========================================================================
Informations about changes in this new version of the engine can be
Informations about changes in this new version of the engine can be
found in changes.txt.
Please note that the textures, 3D models and levels are copyright
by their authors and not covered by the Irrlicht engine license.
by their authors and not covered by the Irrlicht engine license.
==========================================================================
5. License
@ -127,9 +127,9 @@ The Irrlicht Engine SDK version 1.4.2
using the Irrlicht Engine in your product, an acknowledgement
would be highly appreciated.
Please note that the Irrlicht Engine is based in part on the work of
Please note that the Irrlicht Engine is based in part on the work of
the Independent JPEG Group, the zlib, and libpng. This means that if you use
the Irrlicht Engine in your product, you must acknowledge somewhere
the Irrlicht Engine in your product, you must acknowledge somewhere
in your documentation that you've used the IJG code and libpng. It would
also be nice to mention that you use the Irrlicht Engine and the zlib.
See the README files in the jpeglib and the zlib for
@ -139,7 +139,7 @@ The Irrlicht Engine SDK version 1.4.2
The Irrlicht Engine License
===========================
Copyright (C) 2002-2007 Nikolaus Gebhardt
Copyright (C) 2002-2008 Nikolaus Gebhardt
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -156,21 +156,20 @@ The Irrlicht Engine SDK version 1.4.2
2. Altered source versions must be clearly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
==========================================================================
6. Contact
==========================================================================
If you have problems, questions or suggestions, please visit the
If you have problems, questions or suggestions, please visit the
official homepage of the Irrlicht Engine:
http://irrlicht.sourceforge.net
You will find forums, bugtrackers, patches, tutorials, and other stuff
which will help you out.
If want to contact the team of the engine, please send an email to
Nikolaus Gebhardt:
@ -180,56 +179,60 @@ The Irrlicht Engine SDK version 1.4.2
by other people. Especially: (There are probably more people, sorry if I forgot one.
See http://irrlicht.sourceforge.net/author.html for more informations)
Christian Stehno Contribution Coordinator/Developer
Gareth Davidson - Bitplane; Developer/ Forum admin
Thomas Alten wrote the apfelbaum software rasterizer
Christian Stehno (hybrid) Contribution Coordinator/Developer
Gareth Davidson (bitplane) Developer/ Forum admin
Thomas Alten (burningwater) Wrote the burningsvideo software rasterizer
Luke P. Hoschke (luke) Wrote the b3d loader, the new animation system, VBOs and other things
Colin MacDonald (rogerborg)
Dean Wadsworth (varmint) OSX port maintainer and game developer
Alvaro F. Celis (afecelis) Lots of work in the community, for example video tutorials about Irrlicht, forum admin
John Goewert (Saigumi) Wrote some tutorials for the Irrlicht Engine and doing admin stuff
Jam Takes care of moderating the forums and keeps them clean from those evil spammers.
Etienne Petitjean wrote the MacPort of the engine
Greg Roelofs Created the zlib and libpng
The Independent JPEG Group Created JPEG lib
Guy Eric Schalnat, Andreas Dilger, Glenn Randers-Pehrson and others Created libPng
Chad Austin, Jacky Chong, Theo Reed, Ben Scott Made Audiere
Mark Jeacocke Wrote lots of helpful comments and ideas in the forums and per email.
Julio Gorgé Created the 'Unofficial DirectX 9.0 Driver for the Irrlicht Engine'
Andy Spurgeon Wrote the Dev-Cpp tutorial.
André Simon Wrote the Codewarrior tutorial.
KnightToFlight Created the unoffical terrain renderer addon for the Irrlicht Engine.
Jon Pry Wrote the code to load compressed TGA files.
Saigumi Wrote some tutorials for the Irrlicht Engine and doing admin stuff
Matthew Couch Wrote the tokamak integration tutorial.
Max Winkel Wrote the splitscreen tutorial.
Gorgon Zola Wrote the ODE integration tutorial.
Dean P. Macri Sent in code for curved surfaces and PCX Loading.
Sirshane Made several bug fixes, sent in code for making the mouse cursor invisible in Linux.
Matthias Gall Sent in code for a spline scene node animator and reported lots of bugs.
Mario Gruber Suggested triangle fan drawing and sent in code for this.
Ariaci Spotted out a bug in the ATI driver.
Dr Andros C Bragianos Improved texture mapping in test scene node.
Philipp Dortmann Sent in code for stencil buffer support for OpenGL.
Jerome Nichols Created the Irrlicht/Ruby interface located at irr.rubyforge.org
Vash TheStampede Sent code for missing Draw2DLine() implementation s
MattyBoy XBOX support suggestions
Oliver Klems createImageFromData() method suggestion/implementation
Jox really, really a lot of bug fixes, and the LMTS file loader
Zola Quaternion method additions
Tomasz Nowakowski various bug fixes
Nicholas Bray stencil shadow bug fixes with OpenGL
REAPER mouswheel events for scrollbar
Calimero various bug fixes like vector2d operators
Haddock bugfix in the linked list
G.o.D XML parser fix
Alvaro F. Celis Lots of work in the community, for example video tutorials about Irrlicht, forum admin
Erik Zilli Translated some of the tutorials from my stuttering english into real english. :)
Martin Piskernig Linux bugfixing and testing
Soconne Wrote the original terrain renderer were Irrlichts terrain renderer of Irrlicht is based on it.
Spintz GeoMipMap scene node, terrain renderer of Irrlicht is based on it.
Murphy McCauley OCT file loader, MIM tools
Saurav Mohapatra IrrCSM, and lots of addons, suggestions and bug reports
Zhuck Dimitry My3D Tools
Terry Welsh Allowed me to use the textures of his 'Parallax Mapping with Offset Limiting' paper for the parallax demo of Irrlicht
rt Wrote the original .png loader for Irrlicht
Salvatore Russo Wrote the original .dmf loader for Irrlicht
Vox Various bug reports and fixes
atomice Contributed code for a ms3d loader enhancement
William Finlayson OpenGL RTT, GLSL support and the reflection 2 layer material for OpenGL.
Delight Various code contributions for Irrlicht.NET (particle system, basic shader support and more)
Mark Jeacocke Wrote lots of helpful comments and ideas in the forums and per email.
Julio Gorgé Created the 'Unofficial DirectX 9.0 Driver for the Irrlicht Engine'
Andy Spurgeon Wrote the Dev-Cpp tutorial.
André Simon Wrote the Codewarrior tutorial.
KnightToFlight Created the unoffical terrain renderer addon for the Irrlicht Engine.
Jon Pry Wrote the code to load compressed TGA files.
Matthew Couch Wrote the tokamak integration tutorial.
Max Winkel Wrote the splitscreen tutorial.
Gorgon Zola Wrote the ODE integration tutorial.
Dean P. Macri Sent in code for curved surfaces and PCX Loading.
Sirshane Made several bug fixes, sent in code for making the mouse cursor invisible in Linux.
Matthias Gall Sent in code for a spline scene node animator and reported lots of bugs.
Mario Gruber Suggested triangle fan drawing and sent in code for this.
Ariaci Spotted out a bug in the ATI driver.
Dr Andros C Bragianos Improved texture mapping in cube scene node.
Philipp Dortmann Sent in code for stencil buffer support for OpenGL.
Jerome Nichols Created the Irrlicht/Ruby interface located at irr.rubyforge.org
Vash TheStampede Sent code for missing Draw2DLine() implementations
MattyBoy XBOX support suggestions
Oliver Klems createImageFromData() method suggestion/implementation
Jox really, really a lot of bug fixes, and the LMTS file loader
Zola Quaternion method additions
Tomasz Nowakowski various bug fixes
Nicholas Bray stencil shadow bug fixes with OpenGL
REAPER mouswheel events for scrollbar
Calimero various bug fixes like vector2d operators
Haddock bugfix in the linked list
G.o.D XML parser fix
Erik Zilli Translated some of the tutorials from my stuttering english into real english. :)
Martin Piskernig Linux bugfixing and testing
Soconne Wrote the original terrain renderer were Irrlichts terrain renderer of Irrlicht is based on it.
Spintz GeoMipMap scene node, terrain renderer of Irrlicht is based on it.
Murphy McCauley OCT file loader, MIM tools
Saurav Mohapatra IrrCSM, and lots of addons, suggestions and bug reports
Zhuck Dimitry My3D Tools
Terry Welsh Allowed me to use the textures of his 'Parallax Mapping with Offset Limiting' paper for the parallax demo of Irrlicht
rt Wrote the original .png loader for Irrlicht
Salvatore Russo Wrote the original .dmf loader for Irrlicht
Vox Various bug reports and fixes
atomice Contributed code for a ms3d loader enhancement
William Finlayson OpenGL RTT, GLSL support and the reflection 2 layer material for OpenGL.
Delight Various code contributions for Irrlicht.NET (particle system, basic shader support and more)
Michael Zoech Improved GLSL support
Greg Roelofs Created the zlib and libpng
Guy Eric Schalnat, Andreas Dilger, Glenn Randers-Pehrson and others Created libpng
The Independent JPEG Group Created JPEG lib

View File

@ -230,7 +230,7 @@ void CCameraSceneNode::OnRegisterSceneNode()
f32 dp = tgtv.dotProduct(up);
if ( core::equals ( fabs ( dp ), 1.f ) )
if ( core::equals(fabsf(dp), 1.f) )
{
up.X += 0.5f;
}

View File

@ -365,7 +365,7 @@ bool CD3D9Texture::copyTexture(IImage * image)
HRESULT hr = Texture->LockRect(0, &rect, 0, 0);
if (FAILED(hr))
{
os::Printer::log("Could not lock D3D9 Texture.", ELL_ERROR);
os::Printer::log("Texture data not copied", "Could not LockRect D3D9 Texture.", ELL_ERROR);
return false;
}
@ -375,7 +375,7 @@ bool CD3D9Texture::copyTexture(IImage * image)
hr = Texture->UnlockRect(0);
if (FAILED(hr))
{
os::Printer::log("Could not unlock D3D9 Texture.", ELL_ERROR);
os::Printer::log("Texture data not copied", "Could not UnlockRect D3D9 Texture.", ELL_ERROR);
return false;
}
}
@ -395,6 +395,13 @@ void* CD3D9Texture::lock(bool readOnly)
if(!IsRenderTarget)
{
hr = Texture->LockRect(0, &rect, 0, readOnly?D3DLOCK_READONLY:0);
if (FAILED(hr))
{
os::Printer::log("Could not lock DIRECT3D9 Texture.", ELL_ERROR);
return 0;
}
return rect.pBits;
}
else
{
@ -405,7 +412,7 @@ void* CD3D9Texture::lock(bool readOnly)
hr = Device->CreateOffscreenPlainSurface(desc.Width, desc.Height, desc.Format, D3DPOOL_SYSTEMMEM, &RTTSurface, 0);
if (FAILED(hr))
{
os::Printer::log("Could not lock DIRECT3D9 Texture.", ELL_ERROR);
os::Printer::log("Could not lock DIRECT3D9 Texture", "Offscreen surface creation failed.", ELL_ERROR);
return 0;
}
}
@ -414,31 +421,24 @@ void* CD3D9Texture::lock(bool readOnly)
hr = Texture->GetSurfaceLevel(0, &surface);
if (FAILED(hr))
{
os::Printer::log("Could not lock DIRECT3D9 Texture.", ELL_ERROR);
os::Printer::log("Could not lock DIRECT3D9 Texture", "Could not get surface.", ELL_ERROR);
return 0;
}
hr = Device->GetRenderTargetData(surface, RTTSurface);
surface->Release();
if(FAILED(hr))
{
os::Printer::log("Could not lock DIRECT3D9 Texture.", ELL_ERROR);
os::Printer::log("Could not lock DIRECT3D9 Texture", "Data copy failed.", ELL_ERROR);
return 0;
}
hr = RTTSurface->LockRect(&rect, 0, readOnly?D3DLOCK_READONLY:0);
if(FAILED(hr))
{
os::Printer::log("Could not lock DIRECT3D9 Texture.", ELL_ERROR);
os::Printer::log("Could not lock DIRECT3D9 Texture", "LockRect failed.", ELL_ERROR);
return 0;
}
return rect.pBits;
}
if (FAILED(hr))
{
os::Printer::log("Could not lock DIRECT3D9 Texture.", ELL_ERROR);
return 0;
}
return rect.pBits;
}

View File

@ -22,7 +22,9 @@ namespace irr
namespace scene
{
//#define _IRR_DEBUG_OBJ_LOADER_
#ifdef _DEBUG
#define _IRR_DEBUG_OBJ_LOADER_
#endif
static const u32 WORD_BUFFER_LENGTH = 512;

View File

@ -167,8 +167,9 @@ namespace scene
//! Adds a skydome scene node. A skydome is a large (half-) sphere with a
//! panoramic texture on it and is drawn around the camera position.
virtual ISceneNode* addSkyDomeSceneNode(video::ITexture* texture,
u32 horiRes, u32 vertRes, f64 texturePercentage,
f64 spherePercentage, ISceneNode* parent=0, s32 id=-1);
u32 horiRes=16, u32 vertRes=8,
f64 texturePercentage=0.9, f64 spherePercentage=2.0,
ISceneNode* parent=0, s32 id=-1);
//! Adds a text scene node, which is able to display
//! 2d text at a position in three dimensional space

View File

@ -272,6 +272,7 @@ void CSceneNodeAnimatorCameraFPS::setKeyMap(SKeyMap *map, u32 count)
{
// clear the keymap
KeyMap.clear();
KeyMapArray=map;
// add actions
for (u32 i=0; i<count; ++i)

View File

@ -321,35 +321,38 @@ namespace scene
{
case 1:
{
u8 val;
s8 val;
if( file->read( &val, bytesPerPixel ) != bytesPerPixel )
{
os::Printer::log("Error reading heightmap RAW file.");
mb->drop();
return false;
}
vertex.Pos.Y=val;
}
break;
case 2:
{
u16 val;
s16 val;
if( file->read( &val, bytesPerPixel ) != bytesPerPixel )
{
os::Printer::log("Error reading heightmap RAW file.");
mb->drop();
return false;
}
vertex.Pos.Y=val;
}
break;
case 4:
{
u32 val;
s32 val;
if( file->read( &val, bytesPerPixel ) != bytesPerPixel )
{
os::Printer::log("Error reading heightmap RAW file.");
mb->drop();
return false;
}
vertex.Pos.Y=(f32)val;
}
break;
}
@ -406,7 +409,7 @@ namespace scene
RenderBuffer->getIndexBuffer().set_used( TerrainData.PatchCount * TerrainData.PatchCount *
TerrainData.CalcPatchSize * TerrainData.CalcPatchSize * 6 );
u32 endTime = os::Timer::getTime();
const u32 endTime = os::Timer::getTime();
c8 tmp[255];
snprintf(tmp, 255, "Generated terrain data (%dx%d) in %.4f seconds",

View File

@ -260,10 +260,10 @@
EnableFunctionLevelLinking="true"
FloatingPointModel="2"
RuntimeTypeInfo="false"
PrecompiledHeaderFile=".\..\obj\IrrRelease/Irrlicht.pch"
AssemblerListingLocation=".\..\obj\IrrRelease/"
ObjectFile=".\..\obj\IrrRelease/"
ProgramDataBaseFileName=".\..\obj\IrrRelease/"
PrecompiledHeaderFile=".\..\obj\IrrReleaseFastFPU/Irrlicht.pch"
AssemblerListingLocation=".\..\obj\IrrReleaseFastFPU/"
ObjectFile=".\..\obj\IrrReleaseFastFPU/"
ProgramDataBaseFileName=".\..\obj\IrrReleaseFastFPU/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="0"
@ -358,10 +358,10 @@
RuntimeLibrary="1"
DisableLanguageExtensions="false"
RuntimeTypeInfo="false"
PrecompiledHeaderFile=".\..\obj\IrrDebug/Irrlicht.pch"
AssemblerListingLocation=".\..\obj\IrrDebug/"
ObjectFile=".\..\obj\IrrDebug/"
ProgramDataBaseFileName=".\..\obj\IrrDebug/"
PrecompiledHeaderFile=".\..\obj\IrrDebugStatic/Irrlicht.pch"
AssemblerListingLocation=".\..\obj\IrrDebugStatic/"
ObjectFile=".\..\obj\IrrDebugStatic/"
ProgramDataBaseFileName=".\..\obj\IrrDebugStatic/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="3"
@ -442,10 +442,10 @@
RuntimeLibrary="0"
BufferSecurityCheck="false"
EnableFunctionLevelLinking="true"
PrecompiledHeaderFile=".\..\obj\IrrRelease/Irrlicht.pch"
AssemblerListingLocation=".\..\obj\IrrRelease/"
ObjectFile=".\..\obj\IrrRelease/"
ProgramDataBaseFileName=".\..\obj\IrrRelease/"
PrecompiledHeaderFile=".\..\obj\IrrReleaseStatic/Irrlicht.pch"
AssemblerListingLocation=".\..\obj\IrrReleaseStatic/"
ObjectFile=".\..\obj\IrrReleaseStatic/"
ProgramDataBaseFileName=".\..\obj\IrrReleaseStatic/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="0"
@ -530,10 +530,10 @@
EnableFunctionLevelLinking="true"
FloatingPointModel="2"
RuntimeTypeInfo="false"
PrecompiledHeaderFile=".\..\obj\IrrRelease/Irrlicht.pch"
AssemblerListingLocation=".\..\obj\IrrRelease/"
ObjectFile=".\..\obj\IrrRelease/"
ProgramDataBaseFileName=".\..\obj\IrrRelease/"
PrecompiledHeaderFile=".\..\obj\IrrReleaseFastFPUStatic/Irrlicht.pch"
AssemblerListingLocation=".\..\obj\IrrReleaseFastFPUStatic/"
ObjectFile=".\..\obj\IrrReleaseFastFPUStatic/"
ProgramDataBaseFileName=".\..\obj\IrrReleaseFastFPUStatic/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="0"

View File

@ -261,9 +261,9 @@
FloatingPointModel="2"
RuntimeTypeInfo="false"
PrecompiledHeaderFile=".\..\obj\IrrRelease/Irrlicht.pch"
AssemblerListingLocation=".\..\obj\IrrRelease/"
ObjectFile=".\..\obj\IrrRelease/"
ProgramDataBaseFileName=".\..\obj\IrrRelease/"
AssemblerListingLocation=".\..\obj\IrrReleaseFastFPU/"
ObjectFile=".\..\obj\IrrReleaseFastFPU/"
ProgramDataBaseFileName=".\..\obj\IrrReleaseFastFPU/"
WarningLevel="3"
WarnAsError="false"
SuppressStartupBanner="true"
@ -362,9 +362,9 @@
DisableLanguageExtensions="false"
RuntimeTypeInfo="false"
PrecompiledHeaderFile=".\..\obj\IrrDebug/Irrlicht.pch"
AssemblerListingLocation=".\..\obj\IrrDebug/"
ObjectFile=".\..\obj\IrrDebug/"
ProgramDataBaseFileName=".\..\obj\IrrDebug/"
AssemblerListingLocation=".\..\obj\IrrDebugStatic/"
ObjectFile=".\..\obj\IrrDebugStatic/"
ProgramDataBaseFileName=".\..\obj\IrrDebugStatic/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="3"
@ -446,9 +446,9 @@
BufferSecurityCheck="false"
EnableFunctionLevelLinking="true"
PrecompiledHeaderFile=".\..\obj\IrrRelease/Irrlicht.pch"
AssemblerListingLocation=".\..\obj\IrrRelease/"
ObjectFile=".\..\obj\IrrRelease/"
ProgramDataBaseFileName=".\..\obj\IrrRelease/"
AssemblerListingLocation=".\..\obj\IrrReleaseStatic/"
ObjectFile=".\..\obj\IrrReleaseStatic/"
ProgramDataBaseFileName=".\..\obj\IrrReleaseStatic/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="0"
@ -534,9 +534,9 @@
FloatingPointModel="2"
RuntimeTypeInfo="false"
PrecompiledHeaderFile=".\..\obj\IrrRelease/Irrlicht.pch"
AssemblerListingLocation=".\..\obj\IrrRelease/"
ObjectFile=".\..\obj\IrrRelease/"
ProgramDataBaseFileName=".\..\obj\IrrRelease/"
AssemblerListingLocation=".\..\obj\IrrReleaseFastFPUStatic/"
ObjectFile=".\..\obj\IrrReleaseFastFPUStatic/"
ProgramDataBaseFileName=".\..\obj\IrrReleaseFastFPUStatic/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="0"

View File

@ -144,7 +144,7 @@ TAGS:
# Create object files from objective-c code
%.o:%.mm
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $@ $<
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
ifneq ($(MAKECMDGOALS),clean)
-include $(LINKOBJ:.o=.d)

39
tests/Makefile Normal file
View File

@ -0,0 +1,39 @@
# Irrlicht Engine Regression Tests Makefile
Target = tests
Sources = $(wildcard *.cpp)
CPPFLAGS = -I../include -I/usr/X11R6/include -pipe
# CXXFLAGS += -Wall -O3
CXXFLAGS += -g -D_DEBUG
ifeq ($(HOSTTYPE), x86_64)
LIBSELECT=64
endif
all: all_linux
# target specific settings
all_linux: SYSTEM=Linux
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../lib/$(SYSTEM) -lIrrlicht -lGL -lXxf86vm -lXext -lX11
all_win32 clean_win32: SYSTEM=Win32-gcc
all_win32: LDFLAGS = -L../lib/$(SYSTEM) -lIrrlicht -lopengl32 -lm
all_win32 clean_win32: SUF=.exe
# name of the binary - only valid for targets which set SYSTEM
DESTPATH = ../bin/$(SYSTEM)/$(Target)$(SUF)
OBJ = $(Sources:.cpp=.o)
all_linux all_win32: $(OBJ)
$(warning Building...)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ -o $(DESTPATH) $(LDFLAGS)
clean: clean_linux clean_win32
$(warning Cleaning...)
@$(RM) $(OBJ)
clean_linux clean_win32:
@$(RM) $(DESTPATH)
.PHONY: all all_win32 clean clean_linux clean_win32

View File

@ -0,0 +1,47 @@
#include <irrlicht.h>
#include <assert.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
bool disambiguateTextures(void)
{
IrrlichtDevice *device =
createDevice( video::EDT_SOFTWARE, dimension2d<s32>(640, 480), 16,
false, false, false, 0);
if (!device)
return false;
IVideoDriver * driver = device->getVideoDriver();
ITexture * tex1 = driver->getTexture("../media/tools.png");
ITexture * tex2 = driver->getTexture("../media/tools.png");
IReadFile * readFile = device->getFileSystem()->createAndOpenFile("../media/tools.png");
assert(readFile);
ITexture * tex3 = driver->getTexture(readFile);
readFile->drop();
// Expects an empty tmp/tmp directory under this app's wd and
// a media directory under this apps' directory with tools.png in it.
stringc wd = device->getFileSystem()->getWorkingDirectory();
stringc newWd = wd + "/empty/empty";
bool changed = device->getFileSystem()->changeWorkingDirectoryTo(newWd.c_str());
assert(changed);
ITexture * tex4 = driver->getTexture("../../media/tools.png");
assert(tex4);
assert(tex1 == tex2 && tex1 == tex3 && tex1 != tex4);
changed &= device->getFileSystem()->changeWorkingDirectoryTo(wd.c_str());
device->drop();
return (changed && tex1 == tex2 && tex1 == tex3 && tex1 != tex4) ? true : false;
}

67
tests/drawPixel.cpp Normal file
View File

@ -0,0 +1,67 @@
// Tests IVideoDriver::drawPixel().
// Expect to see two diagonal lines overlaying a wall texture cube.
// One line should run from red at the top left to green at the bottom right.
// The other should run from cyan 100% transparent at the bottom left to
// cyan 100% opaque at the top right.
#include "irrlicht.h"
#include "testUtils.h"
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
static bool runTestWithDriver(E_DRIVER_TYPE driverType)
{
IrrlichtDevice *device = createDevice( driverType, dimension2d<s32>(640, 480));
if (!device)
return true; // Treat a failure to create a driver as benign; this saves a lot of #ifdefs
IVideoDriver* driver = device->getVideoDriver();
ISceneManager * smgr = device->getSceneManager();
// Draw a cube to check that the pixels' alpha is working.
ISceneNode * cube = smgr->addCubeSceneNode(50.f, 0, -1, vector3df(0, 0, 60));
cube->setMaterialTexture(0, driver->getTexture("../media/wall.bmp"));
cube->setMaterialFlag(video::EMF_LIGHTING, false);
(void)smgr->addCameraSceneNode();
driver->beginScene(true, true, SColor(255,100,101,140));
smgr->drawAll();
// Test for offscreen values as well as onscreen.
for(s32 x = -10; x < 650; ++x)
{
s32 y = 480 * x / 640;
driver->drawPixel((u32)x, (u32)y, SColor(255, 255 * x / 640, 255 * (640 - x) / 640, 0));
y = 480 - y;
driver->drawPixel((u32)x, (u32)y, SColor(255 * x / 640, 0, 255, 255));
}
driver->endScene();
bool result = takeScreenshotAndCompareAgainstReference(driver, "-drawPixel.jpg");
device->drop();
return result;
}
bool drawPixel(void)
{
bool passed = true;
passed |= runTestWithDriver(EDT_NULL);
passed |= runTestWithDriver(EDT_SOFTWARE);
passed |= runTestWithDriver(EDT_BURNINGSVIDEO);
passed |= runTestWithDriver(EDT_OPENGL);
passed |= runTestWithDriver(EDT_DIRECT3D8);
passed |= runTestWithDriver(EDT_DIRECT3D9);
return passed;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

176
tests/fast_atof.cpp Normal file
View File

@ -0,0 +1,176 @@
// Test the accuracy and speed of
#include "irrlicht.h"
#include <assert.h>
#include <float.h>
#include <limits.h>
using namespace irr;
using namespace core;
static inline u32 old_strtol10(const char* in, const char** out=0)
{
u32 value = 0;
while ( ( *in >= '0') && ( *in <= '9' ))
{
value = ( value * 10 ) + ( *in - '0' );
++in;
}
if (out)
*out = in;
return value;
}
//! Provides a fast function for converting a string into a float,
//! about 6 times faster than atof in win32.
// If you find any bugs, please send them to me, niko (at) irrlicht3d.org.
static inline const char* old_fast_atof_move( const char* c, float& out)
{
bool inv = false;
const char *t;
float f;
if (*c=='-')
{
++c;
inv = true;
}
//f = (float)strtol(c, &t, 10);
f = (float) old_strtol10 ( c, &c );
if (*c == '.')
{
++c;
//float pl = (float)strtol(c, &t, 10);
float pl = (float) old_strtol10 ( c, &t );
pl *= fast_atof_table[t-c];
f += pl;
c = t;
if (*c == 'e')
{
++c;
//float exp = (float)strtol(c, &t, 10);
bool einv = (*c=='-');
if (einv)
++c;
float exp = (float)old_strtol10(c, &c);
if (einv)
exp *= -1.0f;
f *= (float)pow(10.0f, exp);
}
}
if (inv)
f *= -1.0f;
out = f;
return c;
}
static inline float old_fast_atof(const char* c)
{
float ret;
old_fast_atof_move(c, ret);
return ret;
}
static bool testCalculation(const char * valueString)
{
const f32 newFastValue = fast_atof(valueString);
const f32 oldFastValue = old_fast_atof(valueString);
const f32 atofValue = (f32)atof(valueString);
(void)printf("\n String '%s'\n New fast %.40f\n Old fast %.40f\n atof %.40f\n",
valueString, newFastValue, oldFastValue, atofValue);
bool accurate = fabs(newFastValue - atofValue) <= fabs(oldFastValue - atofValue);
if(!accurate)
(void)printf("*** ERROR - less accurate than old method ***\n\n");
return accurate;
}
bool fast_atof(void)
{
bool accurate = true;
accurate &= testCalculation("340282346638528859811704183484516925440.000000");
accurate &= testCalculation("3.402823466e+38F");
accurate &= testCalculation("3402823466e+29F");
accurate &= testCalculation("-340282346638528859811704183484516925440.000000");
accurate &= testCalculation("-3.402823466e+38F");
accurate &= testCalculation("-3402823466e+29F");
accurate &= testCalculation("34028234663852885981170418348451692544.000000");
accurate &= testCalculation("3.402823466e+37F");
accurate &= testCalculation("3402823466e+28F");
accurate &= testCalculation("-34028234663852885981170418348451692544.000000");
accurate &= testCalculation("-3.402823466e+37F");
accurate &= testCalculation("-3402823466e+28F");
accurate &= testCalculation(".00234567");
accurate &= testCalculation("-.00234567");
accurate &= testCalculation("0.00234567");
accurate &= testCalculation("-0.00234567");
accurate &= testCalculation("1.175494351e-38F");
accurate &= testCalculation("1175494351e-47F");
accurate &= testCalculation("1.175494351e-37F");
accurate &= testCalculation("1.175494351e-36F");
accurate &= testCalculation("-1.175494351e-36F");
accurate &= testCalculation("123456.789");
accurate &= testCalculation("-123456.789");
accurate &= testCalculation("0000123456.789");
accurate &= testCalculation("-0000123456.789");
if(!accurate)
{
(void)printf("Calculation is not accurate, so the speed is irrelevant\n");
return false;
}
IrrlichtDevice* device = createDevice(video::EDT_NULL);
if (!device)
return false;
ITimer* timer = device->getTimer();
enum { ITERATIONS = 100000 };
int i;
f32 value;
u32 then = timer->getRealTime();
for(i = 0; i < ITERATIONS; ++i)
value = (f32)atof("-340282346638528859811704183484516925440.000000");
const u32 atofTime = timer->getRealTime() - then;
then += atofTime;
for(i = 0; i < ITERATIONS; ++i)
value = fast_atof("-340282346638528859811704183484516925440.000000");
const u32 fastAtofTime = timer->getRealTime() - then;
then += fastAtofTime;
for(i = 0; i < ITERATIONS; ++i)
value = old_fast_atof("-340282346638528859811704183484516925440.000000");
const u32 oldFastAtofTime = timer->getRealTime() - then;
(void)printf(" atof time = %d\n fast_atof Time = %d\nold fast_atof time = %d\n",
atofTime, fastAtofTime, oldFastAtofTime);
device->drop();
if(fastAtofTime > atofTime)
{
(void)printf("The fast method is slower than atof()\n");
return false;
}
return true;
}

View File

@ -0,0 +1,226 @@
// Test the functionality of line2d>T>::intersectWith().
// Validation is done with asserts() on back-of-an-envelope
// expected results.
#include <irrlicht.h>
#include <assert.h>
using namespace irr;
using namespace core;
static bool testLines(line2df const & line1,
line2df const & line2,
bool expectedHit,
const vector2df & expectedIntersection)
{
bool gotExpectedResult = true;
(void)printf("\nLine 1 = %.1f %.1f to %.1f %.1f \n",
line1.start.X, line1.start.Y,
line1.end.X, line1.end.Y);
(void)printf("Line 2 = %.1f %.1f to %.1f %.1f\n",
line2.start.X, line2.start.Y,
line2.end.X, line2.end.Y);
vector2df intersection;
(void)printf("line1 with line2 = ");
if(line1.intersectWith(line2, intersection))
{
(void)printf("hit at %.1f %.1f - ",
intersection.X, intersection.Y);
if(!line1.isPointOnLine(intersection) || !line2.isPointOnLine(intersection))
{
(void)printf("ERROR! point is not on both lines - ");
gotExpectedResult = false;
}
if(expectedHit)
{
if(intersection == expectedIntersection)
{
(void)printf("expected\n");
}
else
{
(void)printf("unexpected intersection (expected %.1f %.1f)\n",
expectedIntersection.X, expectedIntersection.Y);
gotExpectedResult = false;
}
}
else
{
(void)printf("UNEXPECTED\n");
gotExpectedResult = false;
}
}
else
{
(void)printf("miss - ");
if(!expectedHit)
{
(void)printf("expected\n");
}
else
{
(void)printf("UNEXPECTED\n");
gotExpectedResult = false;
}
}
(void)printf("line2 with line1 = ");
if(line2.intersectWith(line1, intersection))
{
(void)printf("hit at %.1f %.1f - ",
intersection.X, intersection.Y);
if(!line1.isPointOnLine(intersection) || !line2.isPointOnLine(intersection))
{
(void)printf("ERROR! point is not on both lines - ");
gotExpectedResult = false;
}
if(expectedHit)
{
if(intersection == expectedIntersection)
{
(void)printf("expected\n");
}
else
{
(void)printf("unexpected intersection (expected %.1f %.1f)\n",
expectedIntersection.X, expectedIntersection.Y);
gotExpectedResult = false;
}
}
else
{
(void)printf("UNEXPECTED\n");
gotExpectedResult = false;
}
}
else
{
(void)printf("miss - ");
if(!expectedHit)
{
(void)printf("expected\n");
}
else
{
(void)printf("UNEXPECTED\n");
gotExpectedResult = false;
}
}
return gotExpectedResult;
}
bool line2dIntersectWith(void)
{
bool allExpected = true;
// Crossing lines, horizontal and vertical
allExpected &= testLines(line2df(vector2df(1,1),vector2df(1,3)),
line2df(vector2df(0,2),vector2df(2,2)),
true, vector2df(1,2));
// Crossing lines, both diagonal
allExpected &= testLines(line2df(vector2df(0,0),vector2df(2,2)),
line2df(vector2df(0,2),vector2df(2,0)),
true, vector2df(1,1));
// Non-crossing lines, horizontal and vertical
allExpected &= testLines(line2df(vector2df(1,1),vector2df(1,3)),
line2df(vector2df(0,4),vector2df(2,4)),
false, vector2df());
// Non-crossing lines, both diagonal
allExpected &= testLines(line2df(vector2df(0,0),vector2df(2,2)),
line2df(vector2df(3,4),vector2df(4,3)),
false, vector2df());
// Meeting at a common point
allExpected &= testLines(line2df(vector2df(0,0),vector2df(1,0)),
line2df(vector2df(1,0),vector2df(2,0)),
true, vector2df(1,0));
allExpected &= testLines(line2df(vector2df(0,0),vector2df(1,0)),
line2df(vector2df(1,0),vector2df(0,1)),
true, vector2df(1,0));
allExpected &= testLines(line2df(vector2df(0,0),vector2df(1,0)),
line2df(vector2df(1,0),vector2df(0,-1)),
true, vector2df(1,0));
allExpected &= testLines(line2df(vector2df(0,0),vector2df(0,1)),
line2df(vector2df(0,1),vector2df(1,1)),
true, vector2df(0,1));
allExpected &= testLines(line2df(vector2df(0,0),vector2df(0,1)),
line2df(vector2df(0,1),vector2df(1,-1)),
true, vector2df(0,1));
allExpected &= testLines(line2df(vector2df(0,0),vector2df(0,1)),
line2df(vector2df(0,1),vector2df(0,2)),
true, vector2df(0,1));
allExpected &= testLines(line2df(vector2df(0,0),vector2df(1,0)),
line2df(vector2df(1,0),vector2df(2,0)),
true, vector2df(1,0));
allExpected &= testLines(line2df(vector2df(0,0),vector2df(1,1)),
line2df(vector2df(1,1),vector2df(0,2)),
true, vector2df(1,1));
allExpected &= testLines(line2df(vector2df(0,0),vector2df(1,1)),
line2df(vector2df(1,1),vector2df(2,0)),
true, vector2df(1,1));
allExpected &= testLines(line2df(vector2df(0,0),vector2df(1,1)),
line2df(vector2df(1,1),vector2df(2,2)),
true, vector2df(1,1));
// Parallel lines, no intersection
allExpected &= testLines(line2df(vector2df(0,0),vector2df(1,0)),
line2df(vector2df(0,1),vector2df(1,1)),
false, vector2df());
allExpected &= testLines(line2df(vector2df(0,0),vector2df(0,1)),
line2df(vector2df(1,0),vector2df(1,1)),
false, vector2df());
// Non parallel lines, no intersection
allExpected &= testLines(line2df(vector2df(0,0),vector2df(1,0)),
line2df(vector2df(0,1),vector2df(0,2)),
false, vector2df());
allExpected &= testLines(line2df(vector2df(0,0),vector2df(0,1)),
line2df(vector2df(1,0),vector2df(2,0)),
false, vector2df());
// Coincident (and thus parallel) lines
allExpected &= testLines(line2df(vector2df(0,0),vector2df(1,0)),
line2df(vector2df(0,0),vector2df(1,0)),
true, vector2df(0,0));
allExpected &= testLines(line2df(vector2df(2,0),vector2df(0,2)),
line2df(vector2df(2,0),vector2df(0,2)),
true, vector2df(2,0));
// Overlapping parallel lines
allExpected &= testLines(line2df(vector2df(1,0),vector2df(2,0)),
line2df(vector2df(0,0),vector2df(3,0)),
true, vector2df(1.5f, 0));
allExpected &= testLines(line2df(vector2df(0,1),vector2df(0,2)),
line2df(vector2df(0,0),vector2df(0,3)),
true, vector2df(0, 1.5f));
allExpected &= testLines(line2df(vector2df(1,0),vector2df(2,0)),
line2df(vector2df(0,0),vector2df(3,0)),
true, vector2df(1.5f, 0));
allExpected &= testLines(line2df(vector2df(0,1),vector2df(0,2)),
line2df(vector2df(0,0),vector2df(0,3)),
true, vector2df(0, 1.5f));
allExpected &= testLines(line2df(vector2df(1,1),vector2df(2,2)),
line2df(vector2df(0,0),vector2df(3,3)),
true, vector2df(1.5f, 1.5f));
allExpected &= testLines(line2df(vector2df(1,2),vector2df(2,1)),
line2df(vector2df(0,3),vector2df(3,0)),
true, vector2df(1.5f, 1.5f));
if(allExpected)
(void)printf("\nAll tests passed\n");
else
(void)printf("\nFAIL!\n");
return allExpected;
}

62
tests/main.cpp Normal file
View File

@ -0,0 +1,62 @@
// This is the entry point for the Irrlicht test suite.
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <time.h>
// This is an MSVC pragma to link against the Irrlicht library.
// Other builds must link against it in the project files.
#if defined(_MSC_VER)
#pragma comment(lib, "Irrlicht.lib")
#endif // _MSC_VER
/* Each test must have the same signature. Test should (but are not
* required to) live in a .cpp file of the same name. There is no
* need to #include anything since the test entry points can be
* declared as extern before calling them.
*/
#define RUN_TEST(testEntryPoint)\
extern bool testEntryPoint(void);\
if(!testEntryPoint()) \
{\
(void)printf("\n\n\n******** Test failure ********\nTest '" #testEntryPoint "' failed\n"\
"******** Test failure ********\n\nPress return to continue\n\a\a\a");\
(void)getc(stdin);\
fails++;\
}
//! This is the main entry point for the Irrlicht test suite.
/** \return The number of test that failed, i.e. 0 is success. */
int main()
{
int fails = 0;
RUN_TEST(testVector3d);
RUN_TEST(testVector2d);
RUN_TEST(planeMatrix);
RUN_TEST(fast_atof);
RUN_TEST(line2dIntersectWith);
RUN_TEST(disambiguateTextures);
RUN_TEST(drawPixel);
RUN_TEST(md2Animation);
(void)printf("\nTests finished. %d test%s failed.\n", fails, 1 == fails ? "" : "s");
if(0 == fails)
{
time_t rawtime;
struct tm * timeinfo;
(void)time(&rawtime);
timeinfo = gmtime(&rawtime);
(void)printf("\nTest suite pass at GMT %s\n", asctime(timeinfo));
FILE * testsLastPassedAtFile = fopen("tests-last-passed-at.txt", "w");
if(testsLastPassedAtFile)
{
(void)fprintf(testsLastPassedAtFile, "Test suite pass at GMT %s\n", asctime(timeinfo));
(void)fclose(testsLastPassedAtFile);
}
}
return fails;
}

64
tests/md2Animation.cpp Normal file
View File

@ -0,0 +1,64 @@
// This test validates the last frame of a non-looped MD2 animation
#include "irrlicht.h"
#include "testUtils.h"
#include <assert.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
bool md2Animation(void)
{
IrrlichtDevice *device = createDevice( EDT_OPENGL, dimension2d<s32>(640, 480));
assert(device);
if (!device)
return false;
IVideoDriver* driver = device->getVideoDriver();
ISceneManager * smgr = device->getSceneManager();
IAnimatedMesh* mesh = smgr->getMesh("../media/sydney.md2");
IAnimatedMeshSceneNode* node;
assert(mesh);
if(mesh)
{
node = smgr->addAnimatedMeshSceneNode(mesh);
assert(node);
if(node)
{
node->setPosition(vector3df(20, 0, 50));
node->setMaterialFlag(EMF_LIGHTING, false);
node->setMaterialTexture(0, driver->getTexture("../media/sydney.bmp"));
node->setLoopMode(false);
(void)smgr->addCameraSceneNode();
// We could just jump to the last frame, but where's the fun in that?
// Let's watch the animation, doing the initial run() first so that we
// don't miss any of the fun.
device->run();
node->setMD2Animation(EMAT_DEATH_FALLBACK);
const s32 endFrame = node->getEndFrame();
while((s32)node->getFrameNr() < endFrame)
{
device->run();
driver->beginScene(true, true, SColor(255, 255, 255, 0));
smgr->drawAll();
driver->endScene();
}
}
}
bool result = takeScreenshotAndCompareAgainstReference(driver, "-md2Animation.jpg");
device->drop();
return result;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
tests/media/tools.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 845 B

196
tests/planeMatrix.cpp Normal file
View File

@ -0,0 +1,196 @@
// Test the ability to transform a plane with a matrix.
#include "irrlicht.h"
#include <assert.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
// There's all sorts of FP accuracy errors here, so use a sloppy comparison.
static bool sloppyComparePlanes(const plane3df plane1, const plane3df plane2)
{
return(equals(plane1.D, plane2.D, 0.001f) &&
equals(plane1.Normal.X, plane2.Normal.X, 0.001f) &&
equals(plane1.Normal.Y, plane2.Normal.Y, 0.001f) &&
equals(plane1.Normal.Z, plane2.Normal.Z, 0.001f));
}
static bool transformPlane(const vector3df & point, const vector3df & normal,
const matrix4 & matrix, const plane3df & expected)
{
plane3df plane(point, vector3df(normal).normalize());
(void)printf("\n Pre: (%.3ff,%.3ff,%.3ff), %.3ff\n",
plane.Normal.X, plane.Normal.Y, plane.Normal.Z, plane.D);
matrix.transformPlane(plane);
(void)printf(" Post: (%.3ff,%.3ff,%.3ff), %.3ff\n",
plane.Normal.X, plane.Normal.Y, plane.Normal.Z, plane.D);
(void)printf("Expected: (%.3ff,%.3ff,%.3ff), %.3ff\n",
expected.Normal.X, expected.Normal.Y, expected.Normal.Z, expected.D);
// (void)printf("success &= transformPlane(vector3df(%d, %d, %d), vector3df(%d, %d, %d), matrix, plane3df(vector3df(%.3ff,%.3ff,%.3ff), %.3ff));\n",
// (int)point.X, (int)point.Y, (int)point.Z,
// (int)normal.X, (int)normal.Y, (int)normal.Z,
// plane.Normal.X, plane.Normal.Y, plane.Normal.Z, plane.D);
assert(sloppyComparePlanes(plane, expected));
if(!sloppyComparePlanes(plane, expected))
{
(void)printf("Unexpected result\n");
return false;
}
return true;
}
bool planeMatrix(void)
{
matrix4 rotationMatrix;
rotationMatrix.setRotationDegrees(vector3df(90, 0, 0));
matrix4 translationMatrix;
translationMatrix.setTranslation(vector3df(0, 3, 0));
matrix4 scaleMatrix;
scaleMatrix.setScale(vector3df(1, 2, 3));
bool success = true;
matrix4 matrix = rotationMatrix;
(void)printf("\nRotation matrix\n%02.02f %02.02f %02.02f %02.02f"
"\n%02.02f %02.02f %02.02f %02.02f"
"\n%02.02f %02.02f %02.02f %02.02f"
"\n%02.02f %02.02f %02.02f %02.02f\n",
matrix[0], matrix[1], matrix[2], matrix[3],
matrix[4], matrix[5], matrix[6], matrix[7],
matrix[8], matrix[9], matrix[10], matrix[11],
matrix[12], matrix[13], matrix[14], matrix[15]);
success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-.707f, 0.f, -.707f), 0.f));
success &= transformPlane(vector3df(0, 0, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(.707f, 0.f, .707f), 0.f));
success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-.707f, 0.f, .707f), 0.f));
success &= transformPlane(vector3df(0, 0, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(.707f, 0.f, -.707f), 0.f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-.707f, 0.f, -.707f), .707f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(.707f, 0.f, .707f), -.707f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-.707f, 0.f, .707f), -.707f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(.707f, 0.f, -.707f), .707f));
matrix = translationMatrix;
(void)printf("\nTranslation matrix\n%02.02f %02.02f %02.02f %02.02f"
"\n%02.02f %02.02f %02.02f %02.02f"
"\n%02.02f %02.02f %02.02f %02.02f"
"\n%02.02f %02.02f %02.02f %02.02f\n",
matrix[0], matrix[1], matrix[2], matrix[3],
matrix[4], matrix[5], matrix[6], matrix[7],
matrix[8], matrix[9], matrix[10], matrix[11],
matrix[12], matrix[13], matrix[14], matrix[15]);
success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.707f,-0.707f,0.000f), 2.121f));
success &= transformPlane(vector3df(0, 0, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.707f,0.707f,0.000f), -2.121f));
success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.707f,0.707f,0.000f), -2.121f));
success &= transformPlane(vector3df(0, 0, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.707f,-0.707f,0.000f), 2.121f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.707f,-0.707f,0.000f), 2.828f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.707f,0.707f,0.000f), -2.828f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.707f,0.707f,0.000f), -2.828f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.707f,-0.707f,0.000f), 2.828f));
matrix = scaleMatrix;
(void)printf("\nScale matrix\n%02.02f %02.02f %02.02f %02.02f"
"\n%02.02f %02.02f %02.02f %02.02f"
"\n%02.02f %02.02f %02.02f %02.02f"
"\n%02.02f %02.02f %02.02f %02.02f\n",
matrix[0], matrix[1], matrix[2], matrix[3],
matrix[4], matrix[5], matrix[6], matrix[7],
matrix[8], matrix[9], matrix[10], matrix[11],
matrix[12], matrix[13], matrix[14], matrix[15]);
success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.894f,-0.447f,0.000f), -0.000f));
success &= transformPlane(vector3df(0, 0, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.894f,0.447f,0.000f), -0.000f));
success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.894f,0.447f,0.000f), -0.000f));
success &= transformPlane(vector3df(0, 0, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.894f,-0.447f,0.000f), -0.000f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.894f,-0.447f,0.000f), 0.894f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.894f,0.447f,0.000f), -0.894f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.894f,0.447f,0.000f), -0.894f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.894f,-0.447f,0.000f), 0.894f));
matrix = rotationMatrix * translationMatrix;
(void)printf("\nRotation * translation matrix\n%02.02f %02.02f %02.02f %02.02f"
"\n%02.02f %02.02f %02.02f %02.02f"
"\n%02.02f %02.02f %02.02f %02.02f"
"\n%02.02f %02.02f %02.02f %02.02f\n",
matrix[0], matrix[1], matrix[2], matrix[3],
matrix[4], matrix[5], matrix[6], matrix[7],
matrix[8], matrix[9], matrix[10], matrix[11],
matrix[12], matrix[13], matrix[14], matrix[15]);
success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.707f,0.000f,-0.707f), 2.121f));
success &= transformPlane(vector3df(0, 0, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.707f,-0.000f,0.707f), -2.121f));
success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.707f,-0.000f,0.707f), -2.121f));
success &= transformPlane(vector3df(0, 0, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.707f,0.000f,-0.707f), 2.121f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.707f,0.000f,-0.707f), 2.828f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.707f,-0.000f,0.707f), -2.828f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.707f,-0.000f,0.707f), -2.828f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.707f,0.000f,-0.707f), 2.828f));
matrix = rotationMatrix * scaleMatrix;
(void)printf("\nRotation * scale matrix\n%02.02f %02.02f %02.02f %02.02f"
"\n%02.02f %02.02f %02.02f %02.02f"
"\n%02.02f %02.02f %02.02f %02.02f"
"\n%02.02f %02.02f %02.02f %02.02f\n",
matrix[0], matrix[1], matrix[2], matrix[3],
matrix[4], matrix[5], matrix[6], matrix[7],
matrix[8], matrix[9], matrix[10], matrix[11],
matrix[12], matrix[13], matrix[14], matrix[15]);
success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.447f,0.000f,-0.894f), -0.000f));
success &= transformPlane(vector3df(0, 0, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.447f,-0.000f,0.894f), -0.000f));
success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.447f,-0.000f,0.894f), -0.000f));
success &= transformPlane(vector3df(0, 0, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.447f,0.000f,-0.894f), -0.000f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.447f,0.000f,-0.894f), 1.118f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.447f,-0.000f,0.894f), -1.118f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.447f,-0.000f,0.894f), -1.118f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.447f,0.000f,-0.894f), 1.118f));
matrix = translationMatrix * scaleMatrix;
(void)printf("\nTranslation * scale matrix\n%02.02f %02.02f %02.02f %02.02f"
"\n%02.02f %02.02f %02.02f %02.02f"
"\n%02.02f %02.02f %02.02f %02.02f"
"\n%02.02f %02.02f %02.02f %02.02f\n",
matrix[0], matrix[1], matrix[2], matrix[3],
matrix[4], matrix[5], matrix[6], matrix[7],
matrix[8], matrix[9], matrix[10], matrix[11],
matrix[12], matrix[13], matrix[14], matrix[15]);
success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.894f,-0.447f,0.000f), 1.342f));
success &= transformPlane(vector3df(0, 0, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.894f,0.447f,0.000f), -1.342f));
success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.894f,0.447f,0.000f), -1.342f));
success &= transformPlane(vector3df(0, 0, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.894f,-0.447f,0.000f), 1.342f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.894f,-0.447f,0.000f), 2.236f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.894f,0.447f,0.000f), -2.236f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.894f,0.447f,0.000f), -2.236f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.894f,-0.447f,0.000f), 2.236f));
matrix = rotationMatrix * translationMatrix * scaleMatrix;
(void)printf("\nRotation * translation * scale matrix\n%02.02f %02.02f %02.02f %02.02f"
"\n%02.02f %02.02f %02.02f %02.02f"
"\n%02.02f %02.02f %02.02f %02.02f"
"\n%02.02f %02.02f %02.02f %02.02f\n",
matrix[0], matrix[1], matrix[2], matrix[3],
matrix[4], matrix[5], matrix[6], matrix[7],
matrix[8], matrix[9], matrix[10], matrix[11],
matrix[12], matrix[13], matrix[14], matrix[15]);
success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.447f,0.000f,-0.894f), 2.683f));
success &= transformPlane(vector3df(0, 0, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.447f,-0.000f,0.894f), -2.683f));
success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.447f,-0.000f,0.894f), -2.683f));
success &= transformPlane(vector3df(0, 0, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.447f,0.000f,-0.894f), 2.683f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.447f,0.000f,-0.894f), 3.801f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.447f,-0.000f,0.894f), -3.801f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.447f,-0.000f,0.894f), -3.801f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.447f,0.000f,-0.894f), 3.801f));
return success;
}

110
tests/testUtils.cpp Normal file
View File

@ -0,0 +1,110 @@
// Copyright (C) 2008 Colin MacDonald
// No rights reserved: this software is in the public domain.
#define _CRT_SECURE_NO_WARNINGS
#include "testUtils.h"
#include <memory.h>
#include <stdio.h>
#include <assert.h>
bool binaryCompareFiles(const char * fileName1, const char * fileName2)
{
assert(fileName1);
assert(fileName2);
if(!fileName1 || !fileName2)
return false;
FILE * file1 = fopen(fileName1, "rb");
assert(file1);
if(!file1)
{
(void)printf("binaryCompareFiles: File '%s' cannot be opened\n", fileName1);
return false;
}
FILE * file2 = fopen(fileName2, "rb");
assert(file2);
if(!file2)
{
(void)printf("binaryCompareFiles: File '%s' cannot be opened\n", fileName2);
(void)fclose(file1);
return false;
}
(void)fseek(file1, 0, SEEK_END);
(void)fseek(file2, 0, SEEK_END);
if(ftell(file1) != ftell(file2))
{
(void)printf("binaryCompareFiles: Files are different sizes\n");
(void)fclose(file1);
(void)fclose(file2);
return false;
}
(void)fseek(file1, 0, SEEK_SET);
(void)fseek(file2, 0, SEEK_SET);
char file1Buffer[8196];
char file2Buffer[8196];
while(!feof(file1))
{
if(feof(file2)
||(fread(file1Buffer, sizeof(file1Buffer), 1, file1) !=
fread(file2Buffer, sizeof(file2Buffer), 1, file2)))
{
(void)printf("binaryCompareFiles: Error during file reading\n");
break;
}
if(memcmp(file1Buffer, file2Buffer, sizeof(file1Buffer)))
{
(void)printf("binaryCompareFiles: Error during file reading\n");
break;
}
}
bool filesAreIdentical = feof(file1) && feof(file2);
(void)fclose(file1);
(void)fclose(file2);
return filesAreIdentical;
}
bool takeScreenshotAndCompareAgainstReference(irr::video::IVideoDriver * driver, const char * fileName)
{
irr::video::IImage * screenshot = driver->createScreenShot();
if(screenshot)
{
irr::core::stringc driverName = driver->getName();
// For OpenGL (only), chop the version number out. Other drivers have more stable version numbers.
if(driverName.find("OpenGL") > -1)
driverName = "OpenGL";
irr::core::stringc filename = "results/";
filename += driverName;
filename += fileName;
bool written = driver->writeImageToFile(screenshot, filename.c_str());
screenshot->drop();
if(!written)
{
(void)printf("Failed to write screenshot to file '%s'\n", filename.c_str());
return false;
}
irr::core::stringc referenceFilename = "media/";
referenceFilename += driverName;
referenceFilename += fileName;
return binaryCompareFiles(filename.c_str(), referenceFilename.c_str());
}
else
{
(void)printf("Failed to take screenshot\n");
}
return false;
}

21
tests/testUtils.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef _TEST_UTILS_H_
#define _TEST_UTILS_H_ 1
#include "irrlicht.h"
//! Compare two files
/** \param fileName1 The first file for comparison.
\param fileName1 The second file for comparison.
\return true if the files are identical, false on any error or difference. */
extern bool binaryCompareFiles(const char * fileName1, const char * fileName2);
//! Take a screenshot and compare it against a reference screenshot in the tests/media subdirectory
/** \param driver The Irrlicht video driver.
\fileName The unique filename suffix that will be appended to the name of the video driver.
\return true if the screenshot was taken and is identical to the reference image of the same name
in the tests/media directory, false on any error or difference. */
bool takeScreenshotAndCompareAgainstReference(irr::video::IVideoDriver * driver, const char * fileName);
#endif // _TEST_UTILS_H_

132
tests/testVector2d.cpp Normal file
View File

@ -0,0 +1,132 @@
// Test the functionality of vector2d<T>, particularly methods that
// involve calculations done using different precision than <T>.
// Note that all reference vector2d<T>s are creating using double precision
// values cast to (T), as we need to test <f64>.
#include "irrlicht.h"
#include <assert.h>
using namespace irr;
using namespace core;
template<class T>
static bool compareVectors(const core::vector2d<T> & compare,
const core::vector2d<T> & with)
{
if(compare != with)
{
(void)printf("\nERROR: vector2d %.16f, %.16f != vector2d %.16f, %.16f\n",
(f64)compare.X, (f64)compare.Y, (f64)with.X, (f64)with.Y);
assert(compare == with);
return false;
}
return true;
}
template <class T>
static bool doTests()
{
#define COMPARE_VECTORS(compare, with)\
if(!compareVectors(compare, with)) return false;
vector2d<T> vec(5, 5);
vector2d<T> otherVec(10, 20);
if(!equals(vec.getDistanceFrom(otherVec), (T)15.8113883))
{
(void)printf("vector2d::getDistanceFrom() failed\n");
assert(0);
return false;
}
vector2d<T> center(0, 0);
vec.rotateBy(45, center);
COMPARE_VECTORS(vec, vector2d<T>(0, (T)7.0710678118654755));
vec.normalize();
COMPARE_VECTORS(vec, vector2d<T>(0, (T)1.0000000461060017));
vec.set(10, 10);
center.set(5, 5);
vec.rotateBy(-5, center);
// -5 means rotate clockwise slightly, so expect the X to increase
// slightly and the Y to decrease slightly.
COMPARE_VECTORS(vec, vector2d<T>((T)10.416752204197017, (T)9.5451947767204359));
vec.set(5, 5);
vec.normalize();
compareVectors(vec, vector2d<T>((T)0.70710681378841400, (T)0.70710681378841400));
vec.set(5, 5);
otherVec.set(10, 20);
vector2d<T> interpolated;
(void)interpolated.interpolate(vec, otherVec, 0.f);
COMPARE_VECTORS(interpolated, otherVec); // 0.f means all the second vector
(void)interpolated.interpolate(vec, otherVec, 0.25f);
COMPARE_VECTORS(interpolated, vector2d<T>((T)8.75, (T)16.25));
(void)interpolated.interpolate(vec, otherVec, 0.75f);
COMPARE_VECTORS(interpolated, vector2d<T>((T)6.25, (T)8.75));
(void)interpolated.interpolate(vec, otherVec, 1.f);
COMPARE_VECTORS(interpolated, vec); // 1.f means all the first vector
interpolated = vec.getInterpolated(otherVec, 0.f);
COMPARE_VECTORS(interpolated, otherVec); // 0.f means all the second vector
interpolated = vec.getInterpolated(otherVec, 0.25f);
COMPARE_VECTORS(interpolated, vector2d<T>((T)8.75, (T)16.25));
interpolated = vec.getInterpolated(otherVec, 0.75f);
COMPARE_VECTORS(interpolated, vector2d<T>((T)6.25, (T)8.75));
interpolated = vec.getInterpolated(otherVec, 1.f);
COMPARE_VECTORS(interpolated, vec); // 1.f means all the first vector
vector2d<T> thirdVec(20, 10);
interpolated = vec.getInterpolated_quadratic(otherVec, thirdVec, 0.f);
COMPARE_VECTORS(interpolated, vec); // 0.f means all the 1st vector
interpolated = vec.getInterpolated_quadratic(otherVec, thirdVec, 0.25f);
COMPARE_VECTORS(interpolated, vector2d<T>((T)7.8125, (T)10.9375));
interpolated = vec.getInterpolated_quadratic(otherVec, thirdVec, 0.5f);
COMPARE_VECTORS(interpolated, vector2d<T>((T)11.25, (T)13.75));
interpolated = vec.getInterpolated_quadratic(otherVec, thirdVec, 0.75f);
COMPARE_VECTORS(interpolated, vector2d<T>((T)15.3125, (T)13.4375));
interpolated = vec.getInterpolated_quadratic(otherVec, thirdVec, 1.f);
COMPARE_VECTORS(interpolated, thirdVec); // 1.f means all the 3rd vector
return true;
}
bool testVector2d(void)
{
bool f32Success = doTests<f32>();
if(f32Success)
(void)printf("vector2df tests passed\n\n");
else
(void)printf("\n*** vector2df tests failed ***\n\n");
bool f64Success = doTests<f64>();
if(f64Success)
(void)printf("vector2d<f64> tests passed\n\n");
else
(void)printf("\n*** vector2d<f64> tests failed ***\n\n");
bool s32Success = doTests<s32>();
if(s32Success)
(void)printf("vector2di tests passed\n\n");
else
(void)printf("\n*** vector2di tests failed ***\n\n");
return f32Success && f64Success && s32Success;
}

143
tests/testVector3d.cpp Normal file
View File

@ -0,0 +1,143 @@
// Test the functionality of vector3d<T>, particularly methods that
// involve calculations done using different precision than <T>.
// Note that all reference vector3d<T>s are creating using double precision
// values cast to (T), as we need to test <f64>.
#include "irrlicht.h"
#include <assert.h>
using namespace irr;
using namespace core;
template<class T>
static bool compareVectors(const core::vector3d<T> & compare,
const core::vector3d<T> & with)
{
if(compare != with)
{
(void)printf("\nERROR: vector3d %.16f, %.16f, %.16f != vector3d %.16f, %.16f, %.16f\n",
(f64)compare.X, (f64)compare.Y, (f64)compare.Z,
(f64)with.X, (f64)with.Y, (f64)with.Z);
assert(compare == with);
return false;
}
return true;
}
template <class T>
static bool doTests()
{
#define COMPARE_VECTORS(compare, with)\
if(!compareVectors(compare, with)) return false;
vector3d<T> vec(5, 5, 0);
vector3d<T> otherVec(10, 20, 0);
if(!equals(vec.getDistanceFrom(otherVec), (T)15.8113883))
{
(void)printf("vector3d::getDistanceFrom() failed\n");
assert(0);
return false;
}
vector3d<T> center(0, 0, 0);
vec.rotateXYBy(45, center);
COMPARE_VECTORS(vec, vector3d<T>(0, (T)7.0710678118654755, 0));
vec.normalize();
COMPARE_VECTORS(vec, vector3d<T>(0, (T)1.0000000461060017, 0));
vec.set(10, 10, 10);
center.set(5, 5, 10);
vec.rotateXYBy(-5, center);
// -5 means rotate clockwise slightly, so expect the X to increase
// slightly and the Y to decrease slightly.
COMPARE_VECTORS(vec, vector3d<T>((T)10.416752204197017, (T)9.5451947767204359, 10));
vec.set(10, 10, 10);
center.set(5, 10, 5);
vec.rotateXZBy(-5, center);
COMPARE_VECTORS(vec, vector3d<T>((T)10.416752204197017, 10, (T)9.5451947767204359));
vec.set(10, 10, 10);
center.set(10, 5, 5);
vec.rotateYZBy(-5, center);
COMPARE_VECTORS(vec, vector3d<T>(10, (T)10.416752204197017, (T)9.5451947767204359));
vec.set(5, 5, 0);
vec.normalize();
compareVectors(vec, vector3d<T>((T)0.70710681378841400, (T)0.70710681378841400, 0));
vec.set(5, 5, 0);
otherVec.set(10, 20, 40);
vector3d<T> interpolated;
(void)interpolated.interpolate(vec, otherVec, 0.f);
COMPARE_VECTORS(interpolated, otherVec); // 0.f means all the second vector
(void)interpolated.interpolate(vec, otherVec, 0.25f);
COMPARE_VECTORS(interpolated, vector3d<T>((T)8.75, (T)16.25, 30));
(void)interpolated.interpolate(vec, otherVec, 0.75f);
COMPARE_VECTORS(interpolated, vector3d<T>((T)6.25, (T)8.75, 10));
(void)interpolated.interpolate(vec, otherVec, 1.f);
COMPARE_VECTORS(interpolated, vec); // 1.f means all the first vector
interpolated = vec.getInterpolated(otherVec, 0.f);
COMPARE_VECTORS(interpolated, otherVec); // 0.f means all the second vector
interpolated = vec.getInterpolated(otherVec, 0.25f);
COMPARE_VECTORS(interpolated, vector3d<T>((T)8.75, (T)16.25, 30));
interpolated = vec.getInterpolated(otherVec, 0.75f);
COMPARE_VECTORS(interpolated, vector3d<T>((T)6.25, (T)8.75, 10));
interpolated = vec.getInterpolated(otherVec, 1.f);
COMPARE_VECTORS(interpolated, vec); // 1.f means all the first vector
vector3d<T> thirdVec(20, 10, -30);
interpolated = vec.getInterpolated_quadratic(otherVec, thirdVec, 0.f);
COMPARE_VECTORS(interpolated, vec); // 0.f means all the 1st vector
interpolated = vec.getInterpolated_quadratic(otherVec, thirdVec, 0.25f);
COMPARE_VECTORS(interpolated, vector3d<T>((T)7.8125, (T)10.9375, (T)13.125));
interpolated = vec.getInterpolated_quadratic(otherVec, thirdVec, 0.5f);
COMPARE_VECTORS(interpolated, vector3d<T>((T)11.25, (T)13.75, (T)12.5));
interpolated = vec.getInterpolated_quadratic(otherVec, thirdVec, 0.75f);
COMPARE_VECTORS(interpolated, vector3d<T>((T)15.3125, (T)13.4375, (T)-1.875));
interpolated = vec.getInterpolated_quadratic(otherVec, thirdVec, 1.f);
COMPARE_VECTORS(interpolated, thirdVec); // 1.f means all the 3rd vector
return true;
}
bool testVector3d(void)
{
bool f32Success = doTests<f32>();
if(f32Success)
(void)printf("vector3df tests passed\n\n");
else
(void)printf("\n*** vector3df tests failed ***\n\n");
bool f64Success = doTests<f64>();
if(f64Success)
(void)printf("vector3d<f64> tests passed\n\n");
else
(void)printf("\n*** vector3d<f64> tests failed ***\n\n");
bool s32Success = doTests<s32>();
if(s32Success)
(void)printf("vector3di tests passed\n\n");
else
(void)printf("\n*** vector3di tests failed ***\n\n");
return f32Success && f64Success && s32Success;
}

View File

@ -0,0 +1,2 @@
Test suite pass at GMT Thu Nov 6 01:32:10 2008

21
tests/tests-readme.txt Normal file
View File

@ -0,0 +1,21 @@
Welcome to the Irrlicht test suite.
This is composed of a series of tests which exercise basic Irrlicht functionality. These are not
strictly unit tests, since there is no stub framework that isolates each method under test. They
do however test small units of functionality and should help to isolate problems or spot regressions.
Each test resides in its own source file, and must have an entry point with the signature
bool testName(void); where testName should be the same as the source file name (without the suffix).
Each test runs independently, and is responsible for cleaning up after itself and restoring the
working directory to /tests.
testUtils.cpp provides some functions for creating screenshots and comparing files (including images).
Validation images should go im the /media subdirectory. Since the tests rely on the presence of /media
and /empty/empty subdirectories, the working directory must be the /tests directory, not /bin/$PLATFORM.
This means that you cannot run /bin/$PLATFORM/texts.exe from there. You can however cd to /tests and
run ../bin/$PLATFORM/tests.exe
The overall test application will return a count of the number of test that failed, i.e. 0 is success.

46
tests/tests_vc8.sln Normal file
View File

@ -0,0 +1,46 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tests", "tests_vc8.vcproj", "{2A1DE18B-F678-4A94-A996-E848E20B2983}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Irrlicht", "..\source\Irrlicht\Irrlicht8.0.vcproj", "{E08E042A-6C45-411B-92BE-3CC31331019F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release - Fast FPU|Win32 = Release - Fast FPU|Win32
Release|Win32 = Release|Win32
Static lib - Debug|Win32 = Static lib - Debug|Win32
Static lib - Release - Fast FPU|Win32 = Static lib - Release - Fast FPU|Win32
Static lib - Release|Win32 = Static lib - Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2A1DE18B-F678-4A94-A996-E848E20B2983}.Debug|Win32.ActiveCfg = Debug|Win32
{2A1DE18B-F678-4A94-A996-E848E20B2983}.Debug|Win32.Build.0 = Debug|Win32
{2A1DE18B-F678-4A94-A996-E848E20B2983}.Release - Fast FPU|Win32.ActiveCfg = Release|Win32
{2A1DE18B-F678-4A94-A996-E848E20B2983}.Release - Fast FPU|Win32.Build.0 = Release|Win32
{2A1DE18B-F678-4A94-A996-E848E20B2983}.Release|Win32.ActiveCfg = Release|Win32
{2A1DE18B-F678-4A94-A996-E848E20B2983}.Release|Win32.Build.0 = Release|Win32
{2A1DE18B-F678-4A94-A996-E848E20B2983}.Static lib - Debug|Win32.ActiveCfg = Debug|Win32
{2A1DE18B-F678-4A94-A996-E848E20B2983}.Static lib - Debug|Win32.Build.0 = Debug|Win32
{2A1DE18B-F678-4A94-A996-E848E20B2983}.Static lib - Release - Fast FPU|Win32.ActiveCfg = Release|Win32
{2A1DE18B-F678-4A94-A996-E848E20B2983}.Static lib - Release - Fast FPU|Win32.Build.0 = Release|Win32
{2A1DE18B-F678-4A94-A996-E848E20B2983}.Static lib - Release|Win32.ActiveCfg = Release|Win32
{2A1DE18B-F678-4A94-A996-E848E20B2983}.Static lib - Release|Win32.Build.0 = Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Win32.ActiveCfg = Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Win32.Build.0 = Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU|Win32.ActiveCfg = Release - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU|Win32.Build.0 = Release - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Win32.ActiveCfg = Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Win32.Build.0 = Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Debug|Win32.ActiveCfg = Static lib - Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Debug|Win32.Build.0 = Static lib - Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release - Fast FPU|Win32.ActiveCfg = Static lib - Release - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release - Fast FPU|Win32.Build.0 = Static lib - Release - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release|Win32.ActiveCfg = Static lib - Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release|Win32.Build.0 = Static lib - Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

232
tests/tests_vc8.vcproj Normal file
View File

@ -0,0 +1,232 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="tests"
ProjectGUID="{2A1DE18B-F678-4A94-A996-E848E20B2983}"
RootNamespace="tests"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\include"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\bin\Win32-VisualStudio\$(ProjectName).exe"
GenerateDebugInformation="true"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\bin\Win32-VisualStudio\$(ProjectName).exe"
GenerateDebugInformation="true"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\disambiguateTextures.cpp"
>
</File>
<File
RelativePath=".\drawPixel.cpp"
>
</File>
<File
RelativePath=".\fast_atof.cpp"
>
</File>
<File
RelativePath=".\line2dIntersectWith.cpp"
>
</File>
<File
RelativePath=".\main.cpp"
>
</File>
<File
RelativePath=".\md2Animation.cpp"
>
</File>
<File
RelativePath=".\planeMatrix.cpp"
>
</File>
<File
RelativePath=".\testUtils.cpp"
>
</File>
<File
RelativePath=".\testVector2d.cpp"
>
</File>
<File
RelativePath=".\testVector3d.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\testUtils.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

46
tests/tests_vc9.sln Normal file
View File

@ -0,0 +1,46 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C++ Express 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tests", "tests_vc9.vcproj", "{2A1DE18B-F678-4A94-A996-E848E20B2983}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Irrlicht", "..\source\Irrlicht\Irrlicht9.0.vcproj", "{E08E042A-6C45-411B-92BE-3CC31331019F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release - Fast FPU|Win32 = Release - Fast FPU|Win32
Release|Win32 = Release|Win32
Static lib - Debug|Win32 = Static lib - Debug|Win32
Static lib - Release - Fast FPU|Win32 = Static lib - Release - Fast FPU|Win32
Static lib - Release|Win32 = Static lib - Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2A1DE18B-F678-4A94-A996-E848E20B2983}.Debug|Win32.ActiveCfg = Debug|Win32
{2A1DE18B-F678-4A94-A996-E848E20B2983}.Debug|Win32.Build.0 = Debug|Win32
{2A1DE18B-F678-4A94-A996-E848E20B2983}.Release - Fast FPU|Win32.ActiveCfg = Release|Win32
{2A1DE18B-F678-4A94-A996-E848E20B2983}.Release - Fast FPU|Win32.Build.0 = Release|Win32
{2A1DE18B-F678-4A94-A996-E848E20B2983}.Release|Win32.ActiveCfg = Release|Win32
{2A1DE18B-F678-4A94-A996-E848E20B2983}.Release|Win32.Build.0 = Release|Win32
{2A1DE18B-F678-4A94-A996-E848E20B2983}.Static lib - Debug|Win32.ActiveCfg = Debug|Win32
{2A1DE18B-F678-4A94-A996-E848E20B2983}.Static lib - Debug|Win32.Build.0 = Debug|Win32
{2A1DE18B-F678-4A94-A996-E848E20B2983}.Static lib - Release - Fast FPU|Win32.ActiveCfg = Release|Win32
{2A1DE18B-F678-4A94-A996-E848E20B2983}.Static lib - Release - Fast FPU|Win32.Build.0 = Release|Win32
{2A1DE18B-F678-4A94-A996-E848E20B2983}.Static lib - Release|Win32.ActiveCfg = Release|Win32
{2A1DE18B-F678-4A94-A996-E848E20B2983}.Static lib - Release|Win32.Build.0 = Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Win32.ActiveCfg = Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Win32.Build.0 = Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU|Win32.ActiveCfg = Release - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU|Win32.Build.0 = Release - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Win32.ActiveCfg = Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Win32.Build.0 = Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Debug|Win32.ActiveCfg = Static lib - Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Debug|Win32.Build.0 = Static lib - Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release - Fast FPU|Win32.ActiveCfg = Static lib - Release - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release - Fast FPU|Win32.Build.0 = Static lib - Release - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release|Win32.ActiveCfg = Static lib - Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release|Win32.Build.0 = Static lib - Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

228
tests/tests_vc9.vcproj Normal file
View File

@ -0,0 +1,228 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="tests"
ProjectGUID="{2A1DE18B-F678-4A94-A996-E848E20B2983}"
RootNamespace="tests"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\include"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\bin\Win32-VisualStudio\$(ProjectName).exe"
GenerateDebugInformation="true"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\include"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\bin\Win32-VisualStudio\$(ProjectName).exe"
GenerateDebugInformation="true"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\disambiguateTextures.cpp"
>
</File>
<File
RelativePath=".\drawPixel.cpp"
>
</File>
<File
RelativePath=".\fast_atof.cpp"
>
</File>
<File
RelativePath=".\line2dIntersectWith.cpp"
>
</File>
<File
RelativePath=".\main.cpp"
>
</File>
<File
RelativePath=".\md2Animation.cpp"
>
</File>
<File
RelativePath=".\planeMatrix.cpp"
>
</File>
<File
RelativePath=".\testUtils.cpp"
>
</File>
<File
RelativePath=".\testVector2d.cpp"
>
</File>
<File
RelativePath=".\testVector3d.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\testUtils.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>