Merged revisions 2349:2403 from 1.5 branch. Added defines for version handling, added method to check for drivers. Fix bugs in Joystick handler, filename handler, and byteswap.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2439 dfc29bdd-3216-0410-991c-e03cc46cb475
master
hybrid 2009-07-02 08:59:55 +00:00
parent 7d00cc91d1
commit 8e9c3de276
14 changed files with 115 additions and 49 deletions

View File

@ -19,9 +19,9 @@ namespace video
EDT_NULL,
//! The Irrlicht Engine Software renderer.
/** Runs on all platforms, with every hardware. It should only be used for
2d graphics, but it can also perform some primitive 3d
functions. These 3d drawing functions are quite fast, but
/** Runs on all platforms, with every hardware. It should only
be used for 2d graphics, but it can also perform some primitive
3d functions. These 3d drawing functions are quite fast, but
very inaccurate, and don't even support clipping in 3D mode. */
EDT_SOFTWARE,

View File

@ -25,9 +25,6 @@ namespace scene
{
public:
//! Destructor
virtual ~ISceneCollisionManager() {}
//! Finds the collision point of a line and lots of triangles, if there is one.
/** \param ray: Line with witch collisions are tested.
\param selector: TriangleSelector containing the triangles. It
@ -112,6 +109,8 @@ namespace scene
\param idBitMask: Only scene nodes with an id with bits set
like in this mask will be tested. If the BitMask is 0, this
feature is disabled.
Please note that the default node id of -1 will match with
every bitmask != 0
\param bNoDebugObjects: Doesn't take debug objects into account
when true. These are scene nodes with IsDebugObject() = true.
\param root If different from 0, the search is limited to the children of this node.
@ -147,6 +146,8 @@ namespace scene
bits contained in this mask will be tested. However, if this parameter is 0, then
all nodes are checked.
feature is disabled.
Please note that the default node id of -1 will match with
every bitmask != 0
\param bNoDebugObjects: Doesn't take debug objects into account
when true. These are scene nodes with IsDebugObject() = true.
\return Scene node nearest to the camera, which collides with

View File

@ -6,7 +6,13 @@
#define __IRR_COMPILE_CONFIG_H_INCLUDED__
//! Irrlicht SDK Version
#define IRRLICHT_SDK_VERSION "1.6 SVN"
#define IRRLICHT_VERSION_MAJOR 1
#define IRRLICHT_VERSION_MINOR 6
#define IRRLICHT_VERSION_REVISION 0
// This flag will be defined only in SVN, the official release code will have
// it undefined
#define IRRLICHT_VERSION_SVN
#define IRRLICHT_SDK_VERSION "1.6-SVN"
#include <stdio.h> // TODO: Although included elsewhere this is required at least for mingw
@ -112,7 +118,7 @@ headers, e.g. Summer 2004. This is a Microsoft issue, not an Irrlicht one.
#endif
//! Define _IRR_COMPILE_WITH_OPENGL_ to compile the Irrlicht engine with OpenGL.
/** If you do not wish the engine to be compiled with OpengGL, comment this
/** If you do not wish the engine to be compiled with OpenGL, comment this
define out. */
#define _IRR_COMPILE_WITH_OPENGL_

View File

@ -33,9 +33,10 @@ namespace irr
} // end namespace scene
//! The Irrlicht device. You can create it with createDevice() or createDeviceEx().
/** This is the most important class of the Irrlicht Engine. You can access everything
in the engine if you have a pointer to an instance of this class.
There should be only one instance of this class at any time.
/** This is the most important class of the Irrlicht Engine. You can
access everything in the engine if you have a pointer to an instance of
this class. There should be only one instance of this class at any
time.
*/
class IrrlichtDevice : public virtual IReferenceCounted
{
@ -229,6 +230,50 @@ namespace irr
virtual bool getGammaRamp(f32 &red, f32 &green, f32 &blue,
f32 &brightness, f32 &contrast) =0;
//! Allows to check which drivers are supported by the engine.
/** Even if true is returned the driver needs not be available
for an actual configuration requested upon device creation. */
static bool isDriverSupported(video::E_DRIVER_TYPE driver)
{
switch (driver)
{
case video::EDT_NULL:
return true;
case video::EDT_SOFTWARE:
#ifdef _IRR_COMPILE_WITH_SOFTWARE_
return true;
#else
return false;
#endif
case video::EDT_BURNINGSVIDEO:
#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
return true;
#else
return false;
#endif
case video::EDT_DIRECT3D8:
#ifdef _IRR_COMPILE_WITH_DIRECT3D_8_
return true;
#else
return false;
#endif
case video::EDT_DIRECT3D9:
#ifdef _IRR_COMPILE_WITH_DIRECT3D_9_
return true;
#else
return false;
#endif
case video::EDT_OPENGL:
#ifdef _IRR_COMPILE_WITH_OPENGL_
return true;
#else
return false;
#endif
default:
return false;
}
}
};
} // end namespace irr

View File

@ -398,10 +398,14 @@ core::string<c16> CFileSystem::getFileBasename(const core::string<c16>& filename
s32 lastSlash = filename.findLast('/');
const s32 lastBackSlash = filename.findLast('\\');
lastSlash = core::max_(lastSlash, lastBackSlash);
// get number of chars after last dot
s32 end = 0;
if (!keepExtension)
{
end = filename.findLast('.');
// take care to search only after last slash to check only for
// dots in the filename
end = filename.findLast('.', lastSlash);
if (end == -1)
end=0;
else

View File

@ -26,6 +26,10 @@ CGUISpinBox::CGUISpinBox(const wchar_t* text, bool border,IGUIEnvironment* envir
RangeMin(-FLT_MAX), RangeMax(FLT_MAX), FormatString(L"%f"),
DecimalPlaces(-1)
{
#ifdef _DEBUG
setDebugName("CGUISpinBox");
#endif
s32 ButtonWidth = 16;
IGUISpriteBank *sb = 0;
if (environment && environment->getSkin())

View File

@ -17,6 +17,10 @@ namespace gui
CGUISpriteBank::CGUISpriteBank(IGUIEnvironment* env) :
Environment(env), Driver(0)
{
#ifdef _DEBUG
setDebugName("CGUISpriteBank");
#endif
if (Environment)
{
Driver = Environment->getVideoDriver();

View File

@ -1038,6 +1038,9 @@ namespace video
CImage::CImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size)
:Data(0), Size(size), Format(format), DeleteMemory(true)
{
#ifdef _DEBUG
setDebugName("CImage");
#endif
initData();
}

View File

@ -32,6 +32,10 @@ static const u32 WORD_BUFFER_LENGTH = 512;
COBJMeshFileLoader::COBJMeshFileLoader(scene::ISceneManager* smgr, io::IFileSystem* fs)
: SceneManager(smgr), FileSystem(fs)
{
#ifdef _DEBUG
setDebugName("COBJMeshFileLoader");
#endif
if (FileSystem)
FileSystem->grab();
}

View File

@ -8,6 +8,9 @@ namespace irr
CParticleScaleAffector::CParticleScaleAffector(const core::dimension2df& scaleTo)
: ScaleTo(scaleTo)
{
#ifdef _DEBUG
setDebugName("CParticleScaleAffector");
#endif
}

View File

@ -70,9 +70,9 @@ ISceneNode* CSceneCollisionManager::getSceneNodeFromRayBB(const core::line3d<f32
//! recursive method for going through all scene nodes
void CSceneCollisionManager::getPickedNodeBB(ISceneNode* root, core::line3df& ray,
s32 bits, bool bNoDebugObjects,
f32& outbestdistance, ISceneNode*& outbestnode)
void CSceneCollisionManager::getPickedNodeBB(ISceneNode* root,
core::line3df& ray, s32 bits, bool bNoDebugObjects,
f32& outbestdistance, ISceneNode*& outbestnode)
{
const core::list<ISceneNode*>& children = root->getChildren();
const core::vector3df rayVector = ray.getVector().normalize();
@ -782,7 +782,7 @@ core::vector3df CSceneCollisionManager::collideWithWorld(s32 recursionDepth,
return pos + vel;
// original destination point
core::vector3df destinationPoint = pos + vel;
const core::vector3df destinationPoint = pos + vel;
core::vector3df newBasePoint = pos;
// only update if we are not already very close
@ -800,9 +800,8 @@ core::vector3df CSceneCollisionManager::collideWithWorld(s32 recursionDepth,
// calculate sliding plane
core::vector3df slidePlaneOrigin = colData.intersectionPoint;
core::vector3df slidePlaneNormal = newBasePoint - colData.intersectionPoint;
slidePlaneNormal.normalize();
const core::vector3df slidePlaneOrigin = colData.intersectionPoint;
const core::vector3df slidePlaneNormal = (newBasePoint - colData.intersectionPoint).normalize();
core::plane3d<f32> slidingPlane(slidePlaneOrigin, slidePlaneNormal);
core::vector3df newDestinationPoint =
@ -811,7 +810,7 @@ core::vector3df CSceneCollisionManager::collideWithWorld(s32 recursionDepth,
// generate slide vector
core::vector3df newVelocityVector = newDestinationPoint -
const core::vector3df newVelocityVector = newDestinationPoint -
colData.intersectionPoint;
if (newVelocityVector.getLength() < veryCloseDistance)

View File

@ -1342,10 +1342,10 @@ void CIrrDeviceMacOSX::pollJoysticks()
result = (*(ActiveJoysticks[joystick].interface))->getElementValue(ActiveJoysticks[joystick].interface, ActiveJoysticks[joystick].axisComp[n].cookie, &hidEvent);
if (kIOReturnSuccess == result)
{
f32 min = -32768.0f;
f32 max = 32768.0f;
f32 deviceScale = max - min;
f32 readScale = (f32)ActiveJoysticks[joystick].axisComp[n].maxRead - (f32)ActiveJoysticks[joystick].axisComp[n].minRead;
const f32 min = -32768.0f;
const f32 max = 32767.0f;
const f32 deviceScale = max - min;
const f32 readScale = (f32)ActiveJoysticks[joystick].axisComp[n].maxRead - (f32)ActiveJoysticks[joystick].axisComp[n].minRead;
if (hidEvent.value < ActiveJoysticks[joystick].axisComp[n].minRead)
ActiveJoysticks[joystick].axisComp[n].minRead = hidEvent.value;

View File

@ -1,5 +1,5 @@
VERSION = 1.5
# Irrlicht Engine 1.5
VERSION = 1.6.0-SVN
# Irrlicht Engine 1.6.0-SVN
# Makefile for Linux
#
# To use, just run:

View File

@ -11,30 +11,23 @@
#include <SDL/SDL_endian.h>
#define bswap_16(X) SDL_Swap16(X)
#define bswap_32(X) SDL_Swap32(X)
#elif defined(_IRR_WINDOWS_API_)
#if (defined(_MSC_VER) && (_MSC_VER > 1298))
#include <stdlib.h>
#define bswap_16(X) _byteswap_ushort(X)
#define bswap_32(X) _byteswap_ulong(X)
#else
#define bswap_16(X) ((((X)&0xFF) << 8) | (((X)&=0xFF00) >> 8))
#define bswap_32(X) ( (((X)&0x000000FF)<<24) | (((X)&0xFF000000) >> 24) | (((X)&0x0000FF00) << 8) | (((X) &0x00FF0000) >> 8))
#endif
#elif defined(_IRR_WINDOWS_API_) && defined(_MSC_VER) && (_MSC_VER > 1298)
#include <stdlib.h>
#define bswap_16(X) _byteswap_ushort(X)
#define bswap_32(X) _byteswap_ulong(X)
#elif defined(_IRR_OSX_PLATFORM_)
#include <libkern/OSByteOrder.h>
#define bswap_16(X) OSReadSwapInt16(&X,0)
#define bswap_32(X) OSReadSwapInt32(&X,0)
#elif defined(__FreeBSD__)
#include <sys/endian.h>
#define bswap_16(X) bswap16(X)
#define bswap_32(X) bswap32(X)
#elif !defined(_IRR_SOLARIS_PLATFORM_) && !defined(__PPC__) && !defined(_IRR_WINDOWS_API_)
#include <byteswap.h>
#else
#if defined(_IRR_OSX_PLATFORM_)
#include <libkern/OSByteOrder.h>
#define bswap_16(X) OSReadSwapInt16(&X,0)
#define bswap_32(X) OSReadSwapInt32(&X,0)
#elif defined(__FreeBSD__)
#include <sys/endian.h>
#define bswap_16(X) bswap16(X)
#define bswap_32(X) bswap32(X)
#elif !defined(_IRR_SOLARIS_PLATFORM_) && !defined(__PPC__)
#include <byteswap.h>
#else
#define bswap_16(X) ((((X)&0xFF) << 8) | (((X)&=0xFF00) >> 8))
#define bswap_32(X) ( (((X)&0x000000FF)<<24) | (((X)&0xFF000000) >> 24) | (((X)&0x0000FF00) << 8) | (((X) &0x00FF0000) >> 8))
#endif
#define bswap_16(X) ((((X)&0xFF) << 8) | (((X)&0xFF00) >> 8))
#define bswap_32(X) ( (((X)&0x000000FF)<<24) | (((X)&0xFF000000) >> 24) | (((X)&0x0000FF00) << 8) | (((X) &0x00FF0000) >> 8))
#endif
namespace irr