Merged revisions 3218-3270 from branch 1.7. Many bugfixes, mainly in GUI and device, a few mesh loader fixes. Octree culling bug fix.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3271 dfc29bdd-3216-0410-991c-e03cc46cb475
master
hybrid 2010-04-03 22:21:50 +00:00
parent d52e51242a
commit 9e9e55a903
54 changed files with 552 additions and 313 deletions

View File

@ -1,4 +1,53 @@
Changes in 1.7
-----------------------------
Changes in 1.7.1 (17.02.2010)
- Fix octree with frustum+parent checks enabled (didn't clip at all before). Now using plane-checks instead of edge-checks for frustum-box intersection.
- Prevent that X11 selects larger resolutions in fullscreen even when perfect fits are available.
- Ignore setResizable also on X11 when we're fullscreen to avoid messing up the window mode.
- Work around a crash when pressing ESC after closing a Messagebox (found by Acki)
- Prevent borland compile warnings in SColorHSL::FromRGB and in SVertexColorThresholdManipulator (found by mdeininger)
- Improve Windows version detection rules (Patch from brferreira)
- Make it compile on Borland compilers (thx to mdeininger)
- Make sure that CAnimatedMeshSceneNode::clone calls the virtual updateAbsolutePosition for the new object
- Fix that clones got dropped too often when SceneNodes without parent got cloned (found by Ulf)
- Make sure TAB is still recognized on X11 when shift+tab is pressed. This does also fix going to the previous tabstop on X11.
- Send EGET_ELEMENT_LEFT also when there won't be a new hovered element
- Update docs for EGET_ELEMENT_LEFT and EGET_ELEMENT_HOVERED
- Fix tooltips: Remove them when the element is hidden or removed (thx to seven for finding)
- Fix tooltips: Make (more) sure they don't get confused by gui-subelements
- Fix tooltips: Get faster relaunch times working
- Fix tooltips: Make sure hovered element is never the tooltip itself
- Fix string::remove which got in an endless loop when remove was called with an empty string (found and fixed by Ulf)
- Correctly release the GLSL shaders
- Make sure we only release an X11 atom when it was actually created
- Fix aabbox collision test, which not only broke the collision test routines, but also frustum culling, octree tests, etc.
- Fix compilation problem under OSX due to wrong glProgramParameteri usage
- mem leak in OBJ loader fixed
- Removed some default parameters to reduce ambigious situations
---------------------------
Changes in 1.7 (03.02.2010)
- Implement minimize and deminimize under OSX.
@ -194,8 +243,8 @@ Changes in 1.7
- draw3DTriangle now renders filled polygons, old behavior can be achieved by setting EMT_WIREFRAME
----------------
Changes in 1.6.1
-----------------------------
Changes in 1.6.1 (13.01.2010)
- Fix pingpong for CSceneNodeAnimatorFlyStraight (found by gbox)

View File

@ -161,9 +161,11 @@ namespace irr
EGET_ELEMENT_FOCUSED,
//! The mouse cursor hovered over a gui element.
/** If an element has sub-elements you also get this message for the subelements */
EGET_ELEMENT_HOVERED,
//! The mouse cursor left the hovered element.
/** If an element has sub-elements you also get this message for the subelements */
EGET_ELEMENT_LEFT,
//! An element would like to close.

View File

@ -187,6 +187,7 @@ public:
}
//! The alignment defines how the borders of this element will be positioned when the parent element is resized.
void setAlignment(EGUI_ALIGNMENT left, EGUI_ALIGNMENT right, EGUI_ALIGNMENT top, EGUI_ALIGNMENT bottom)
{
AlignLeft = left;

View File

@ -22,7 +22,7 @@ namespace video
enum E_TEXTURE_CREATION_FLAG
{
/** Forces the driver to create 16 bit textures always, independent of
which format the file on disk has. When choosing this you may loose
which format the file on disk has. When choosing this you may lose
some color detail, but gain much speed and memory. 16 bit textures can
be transferred twice as fast as 32 bit textures and only use half of
the space in memory.

View File

@ -8,11 +8,11 @@
//! Irrlicht SDK Version
#define IRRLICHT_VERSION_MAJOR 1
#define IRRLICHT_VERSION_MINOR 7
#define IRRLICHT_VERSION_REVISION 0
#define IRRLICHT_VERSION_REVISION 1
// This flag will be defined only in SVN, the official release code will have
// it undefined
#define IRRLICHT_VERSION_SVN -beta
#define IRRLICHT_SDK_VERSION "1.7.0-beta"
#define IRRLICHT_SDK_VERSION "1.7.1-beta"
#include <stdio.h> // TODO: Although included elsewhere this is required at least for mingw
@ -101,9 +101,9 @@
//! Define _IRR_COMPILE_WITH_DIRECT3D_8_ and _IRR_COMPILE_WITH_DIRECT3D_9_ to
//! compile the Irrlicht engine with Direct3D8 and/or DIRECT3D9.
/** If you only want to use the software device or opengl this can be useful.
/** If you only want to use the software device or opengl you can disable those defines.
This switch is mostly disabled because people do not get the g++ compiler compile
directX header files, and directX is only available on windows platforms. If you
directX header files, and directX is only available on Windows platforms. If you
are using Dev-Cpp, and want to compile this using a DX dev pack, you can define
_IRR_COMPILE_WITH_DX9_DEV_PACK_. So you simply need to add something like this
to the compiler settings: -DIRR_COMPILE_WITH_DX9_DEV_PACK
@ -352,7 +352,7 @@ defined. */
//! Define _IRR_COMPILE_WITH_ZIP_ENCRYPTION_ if you want to read AES-encrypted ZIP archives
#define _IRR_COMPILE_WITH_ZIP_ENCRYPTION_
//! Define _IRR_COMPILE_WITH_BZIP2_ if you want to support bzip2 compressed zip archives
/** bzip2 is superior to the original zip file compression modes, but requires
/** bzip2 is superior to the original zip file compression modes, but requires
a certain amount of memory for decompression and adds several files to the
library. */
#define _IRR_COMPILE_WITH_BZIP2_

View File

@ -106,7 +106,7 @@ namespace video
//! Returns the alpha component from A1R5G5B5 color
/** In Irrlicht, alpha refers to opacity.
/** In Irrlicht, alpha refers to opacity.
\return The alpha value of the color. 0 is transparent, 1 is opaque. */
inline u32 getAlpha(u16 color)
{
@ -172,7 +172,7 @@ namespace video
: color(clr) {}
//! Returns the alpha component of the color.
/** The alpha component defines how opaque a color is.
/** 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; }
@ -297,10 +297,10 @@ namespace video
{
d = core::clamp(d, 0.f, 1.f);
const f32 inv = 1.0f - d;
return SColor((u32)(other.getAlpha()*inv + getAlpha()*d),
(u32)(other.getRed()*inv + getRed()*d),
(u32)(other.getGreen()*inv + getGreen()*d),
(u32)(other.getBlue()*inv + getBlue()*d));
return SColor((u32)core::round32(other.getAlpha()*inv + getAlpha()*d),
(u32)core::round32(other.getRed()*inv + getRed()*d),
(u32)core::round32(other.getGreen()*inv + getGreen()*d),
(u32)core::round32(other.getBlue()*inv + getBlue()*d));
}
//! Returns interpolated color. ( quadratic )
@ -374,7 +374,7 @@ namespace video
//! Converts this color to a SColor without floats.
SColor toSColor() const
{
return SColor((u32)(a*255.0f), (u32)(r*255.0f), (u32)(g*255.0f), (u32)(b*255.0f));
return SColor((u32)core::round32(a*255.0f), (u32)core::round32(r*255.0f), (u32)core::round32(g*255.0f), (u32)core::round32(b*255.0f));
}
//! Sets three color components to new values at once.
@ -492,7 +492,8 @@ namespace video
inline void SColorHSL::fromRGB(const SColor &color)
{
const f32 maxVal = (f32)core::max_(color.getRed(), color.getGreen(), color.getBlue());
const u32 maxValInt = core::max_(color.getRed(), color.getGreen(), color.getBlue());
const f32 maxVal = (f32)maxValInt;
const f32 minVal = (f32)core::min_(color.getRed(), color.getGreen(), color.getBlue());
Luminance = (maxVal/minVal)*0.5f;
if (core::equals(maxVal, minVal))
@ -512,11 +513,11 @@ namespace video
Saturation = (delta)/(2-maxVal-minVal);
}
if (maxVal==color.getRed())
if (maxValInt == color.getRed())
Hue = (color.getGreen()-color.getBlue())/delta;
else if (maxVal==color.getGreen())
else if (maxValInt == color.getGreen())
Hue = 2+(color.getBlue()-color.getRed())/delta;
else if (maxVal==color.getBlue())
else // blue is max
Hue = 4+(color.getRed()-color.getGreen())/delta;
Hue *= (60.0f * core::DEGTORAD);
@ -571,7 +572,7 @@ namespace video
rm1 = rm1 + (rm2 - rm1) * ( ( 240.0f * core::DEGTORAD ) - rh) /
(60.0f * core::DEGTORAD);
return (u32) (rm1 * 255.f);
return (u32) core::round32(rm1 * 255.f);
}
} // end namespace video

View File

@ -67,7 +67,7 @@ namespace scene
video::SColor high) : Threshold(threshold), Low(low), High(high) {}
void operator()(video::S3DVertex& vertex) const
{
vertex.Color = (vertex.Color.getAverage()>Threshold)?High:Low;
vertex.Color = ((u8)vertex.Color.getAverage()>Threshold)?High:Low;
}
private:
u8 Threshold;

View File

@ -13,18 +13,18 @@
#include <limits.h> // For INT_MAX / UINT_MAX
#if defined(_IRR_SOLARIS_PLATFORM_) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) || defined (_WIN32_WCE)
#define sqrtf(X) (f32)sqrt((f64)(X))
#define sinf(X) (f32)sin((f64)(X))
#define cosf(X) (f32)cos((f64)(X))
#define asinf(X) (f32)asin((f64)(X))
#define acosf(X) (f32)acos((f64)(X))
#define atan2f(X,Y) (f32)atan2((f64)(X),(f64)(Y))
#define ceilf(X) (f32)ceil((f64)(X))
#define floorf(X) (f32)floor((f64)(X))
#define powf(X,Y) (f32)pow((f64)(X),(f64)(Y))
#define fmodf(X,Y) (f32)fmod((f64)(X),(f64)(Y))
#define fabsf(X) (f32)fabs((f64)(X))
#define logf(X) (f32)log((f64)(X))
#define sqrtf(X) (irr::f32)sqrt((irr::f64)(X))
#define sinf(X) (irr::f32)sin((irr::f64)(X))
#define cosf(X) (irr::f32)cos((irr::f64)(X))
#define asinf(X) (irr::f32)asin((irr::f64)(X))
#define acosf(X) (irr::f32)acos((irr::f64)(X))
#define atan2f(X,Y) (irr::f32)atan2((irr::f64)(X),(irr::f64)(Y))
#define ceilf(X) (irr::f32)ceil((irr::f64)(X))
#define floorf(X) (irr::f32)floor((irr::f64)(X))
#define powf(X,Y) (irr::f32)pow((irr::f64)(X),(irr::f64)(Y))
#define fmodf(X,Y) (irr::f32)fmod((irr::f64)(X),(irr::f64)(Y))
#define fabsf(X) (irr::f32)fabs((irr::f64)(X))
#define logf(X) (irr::f32)log((irr::f64)(X))
#endif
#ifndef FLT_MAX

View File

@ -1137,8 +1137,8 @@ public:
string<T,TAlloc>& remove(const string<T,TAlloc>& toRemove)
{
u32 size = toRemove.size();
if (size == 0) return *this;
if ( size == 0 )
return *this;
u32 pos = 0;
u32 found = 0;
for (u32 i=0; i<used; ++i)

View File

@ -217,5 +217,9 @@ code like 'code', but some generate warnings so we use this macro here */
((irr::u32)(irr::u8)(c0) | ((irr::u32)(irr::u8)(c1) << 8) | \
((irr::u32)(irr::u8)(c2) << 16) | ((irr::u32)(irr::u8)(c3) << 24 ))
#if defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
#define _strcmpi(a,b) strcmpi(a,b)
#endif
#endif // __IRR_TYPES_H_INCLUDED__

View File

@ -184,7 +184,7 @@
#include "vector2d.h"
#include "vector3d.h"
/*! \mainpage Irrlicht Engine 1.6 API documentation
/*! \mainpage Irrlicht Engine 1.7 API documentation
*
* <div align="center"><img src="logobig.png" ></div>
*

View File

@ -1060,9 +1060,15 @@ ISceneNode* CAnimatedMeshSceneNode::clone(ISceneNode* newParent, ISceneManager*
if (!newManager) newManager = SceneManager;
CAnimatedMeshSceneNode * newNode =
new CAnimatedMeshSceneNode(Mesh, newParent, newManager, ID, RelativeTranslation,
new CAnimatedMeshSceneNode(Mesh, NULL, newManager, ID, RelativeTranslation,
RelativeRotation, RelativeScale);
if ( newParent )
{
newNode->setParent(newParent); // not in constructor because virtual overload for updateAbsolutePosition won't be called
newNode->drop();
}
newNode->cloneMembers(this, newManager);
newNode->Materials = Materials;
@ -1088,7 +1094,6 @@ ISceneNode* CAnimatedMeshSceneNode::clone(ISceneNode* newParent, ISceneManager*
newNode->RenderFromIdentity = RenderFromIdentity;
newNode->MD3Special = MD3Special;
(void)newNode->drop();
return newNode;
}

View File

@ -601,7 +601,7 @@ bool CB3DMeshFileLoader::readChunkKEYS(CSkinnedMesh::SJoint *inJoint)
core::vector3df oldScale[2];
CSkinnedMesh::SRotationKey *oldRotKey=0;
core::quaternion oldRot[2];
bool isFirst[3]={true};
bool isFirst[3]={true,true,true};
while((B3dStack.getLast().startposition + B3dStack.getLast().length) > B3DFile->getPos()) //this chunk repeats
{
s32 frame;

View File

@ -225,13 +225,14 @@ ISceneNode* CBillboardSceneNode::clone(ISceneNode* newParent, ISceneManager* new
if (!newManager)
newManager = SceneManager;
CBillboardSceneNode* nb = new CBillboardSceneNode(newParent,
CBillboardSceneNode* nb = new CBillboardSceneNode(newParent,
newManager, ID, RelativeTranslation, Size);
nb->cloneMembers(this, newManager);
nb->Material = Material;
nb->drop();
if ( newParent )
nb->drop();
return nb;
}

View File

@ -14,7 +14,7 @@ namespace scene
//! constructor
CCameraSceneNode::CCameraSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
CCameraSceneNode::CCameraSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
const core::vector3df& position, const core::vector3df& lookat)
: ICameraSceneNode(parent, mgr, id, position),
Target(lookat), UpVector(0.0f, 1.0f, 0.0f), ZNear(1.0f), ZFar(3000.0f),
@ -25,14 +25,14 @@ CCameraSceneNode::CCameraSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 i
#endif
// set default projection
Fovy = core::PI / 2.5f; // Field of view, in radians.
Fovy = core::PI / 2.5f; // Field of view, in radians.
const video::IVideoDriver* const d = mgr?mgr->getVideoDriver():0;
if (d)
Aspect = (f32)d->getCurrentRenderTargetSize().Width /
(f32)d->getCurrentRenderTargetSize().Height;
else
Aspect = 4.0f / 3.0f; // Aspect ratio.
Aspect = 4.0f / 3.0f; // Aspect ratio.
recalculateProjectionMatrix();
recalculateViewArea();
@ -99,10 +99,10 @@ const core::matrix4& CCameraSceneNode::getViewMatrixAffector() const
//! It is possible to send mouse and key events to the camera. Most cameras
//! may ignore this input, but camera scene nodes which are created for
//! may ignore this input, but camera scene nodes which are created for
//! example with scene::ISceneManager::addMayaCameraSceneNode or
//! scene::ISceneManager::addFPSCameraSceneNode, may want to get this input
//! for changing their position, look at target or whatever.
//! for changing their position, look at target or whatever.
bool CCameraSceneNode::OnEvent(const SEvent& event)
{
if (!InputReceiverEnabled)
@ -111,7 +111,7 @@ bool CCameraSceneNode::OnEvent(const SEvent& event)
// send events to event receiving animators
ISceneNodeAnimatorList::Iterator ait = Animators.begin();
for (; ait != Animators.end(); ++ait)
if ((*ait)->isEventReceiverEnabled() && (*ait)->OnEvent(event))
return true;
@ -173,25 +173,25 @@ const core::vector3df& CCameraSceneNode::getUpVector() const
}
f32 CCameraSceneNode::getNearValue() const
f32 CCameraSceneNode::getNearValue() const
{
return ZNear;
}
f32 CCameraSceneNode::getFarValue() const
f32 CCameraSceneNode::getFarValue() const
{
return ZFar;
}
f32 CCameraSceneNode::getAspectRatio() const
f32 CCameraSceneNode::getAspectRatio() const
{
return Aspect;
}
f32 CCameraSceneNode::getFOV() const
f32 CCameraSceneNode::getFOV() const
{
return Fovy;
}
@ -243,7 +243,7 @@ void CCameraSceneNode::OnRegisterSceneNode()
//! render
void CCameraSceneNode::render()
{
{
core::vector3df pos = getAbsolutePosition();
core::vector3df tgtv = Target - pos;
tgtv.normalize();
@ -327,7 +327,7 @@ void CCameraSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttribute
TargetAndRotationAreBound = in->getAttributeAsBool("Binding");
recalculateProjectionMatrix();
recalculateViewArea();
recalculateViewArea();
}
@ -353,12 +353,13 @@ ISceneNode* CCameraSceneNode::clone(ISceneNode* newParent, ISceneManager* newMan
if (!newManager)
newManager = SceneManager;
CCameraSceneNode* nb = new CCameraSceneNode(newParent,
CCameraSceneNode* nb = new CCameraSceneNode(newParent,
newManager, ID, RelativeTranslation, Target);
nb->cloneMembers(this, newManager);
nb->drop();
if ( newParent )
nb->drop();
return nb;
}

View File

@ -24,7 +24,7 @@ namespace scene
| / | /
|/ | /
0------11,1/
000 100
000 100
*/
//! constructor
@ -190,13 +190,14 @@ ISceneNode* CCubeSceneNode::clone(ISceneNode* newParent, ISceneManager* newManag
if (!newManager)
newManager = SceneManager;
CCubeSceneNode* nb = new CCubeSceneNode(Size, newParent,
CCubeSceneNode* nb = new CCubeSceneNode(Size, newParent,
newManager, ID, RelativeTranslation);
nb->cloneMembers(this, newManager);
nb->getMaterial(0) = getMaterial(0);
nb->drop();
if ( newParent )
nb->drop();
return nb;
}

View File

@ -16,6 +16,9 @@
#include "CNullDriver.h"
#include "IMaterialRendererServices.h"
#if defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
#include "irrMath.h" // needed by borland for sqrtf define
#endif
#include <d3d9.h>
namespace irr

View File

@ -9,6 +9,9 @@
#ifdef _IRR_WINDOWS_
#ifdef _IRR_COMPILE_WITH_DIRECT3D_9_
#if defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
#include "irrMath.h" // needed by borland for sqrtf define
#endif
#include <d3d9.h>
#include "IMaterialRenderer.h"

View File

@ -9,6 +9,9 @@
#ifdef _IRR_WINDOWS_
#ifdef _IRR_COMPILE_WITH_DIRECT3D_9_
#if defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
#include "irrMath.h" // needed by borland for sqrtf define
#endif
#include <d3d9.h>
#include "CD3D9ShaderMaterialRenderer.h"

View File

@ -9,6 +9,9 @@
#ifdef _IRR_WINDOWS_
#ifdef _IRR_COMPILE_WITH_DIRECT3D_9_
#if defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
#include "irrMath.h" // needed by borland for sqrtf define
#endif
#include <d3d9.h>
#include "CD3D9ShaderMaterialRenderer.h"

View File

@ -9,6 +9,9 @@
#ifdef _IRR_WINDOWS_
#ifdef _IRR_COMPILE_WITH_DIRECT3D_9_
#if defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
#include "irrMath.h" // needed by borland for sqrtf define
#endif
#include <d3d9.h>
#include <d3dx9shader.h>

View File

@ -10,6 +10,9 @@
#include "ITexture.h"
#include "IImage.h"
#if defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
#include "irrMath.h" // needed by borland for sqrtf define
#endif
#include <d3d9.h>
namespace irr

View File

@ -54,13 +54,14 @@ ISceneNode* CEmptySceneNode::clone(ISceneNode* newParent, ISceneManager* newMana
if (!newManager)
newManager = SceneManager;
CEmptySceneNode* nb = new CEmptySceneNode(newParent,
CEmptySceneNode* nb = new CEmptySceneNode(newParent,
newManager, ID);
nb->cloneMembers(this, newManager);
nb->Box = Box;
nb->drop();
if ( newParent )
nb->drop();
return nb;
}

View File

@ -751,8 +751,10 @@ bool CFileSystem::existFile(const io::path& filename) const
#else
return (_access(filename.c_str(), 0) != -1);
#endif
#else
#elif defined(F_OK)
return (access(filename.c_str(), F_OK) != -1);
#else
return (access(filename.c_str(), 0) != -1);
#endif
#endif
}

View File

@ -55,7 +55,7 @@ const wchar_t* IRR_XML_FORMAT_GUI_ELEMENT_ATTR_TYPE = L"type";
//! constructor
CGUIEnvironment::CGUIEnvironment(io::IFileSystem* fs, video::IVideoDriver* driver, IOSOperator* op)
: IGUIElement(EGUIET_ELEMENT, 0, 0, 0, core::rect<s32>(core::position2d<s32>(0,0), driver ? core::dimension2d<s32>(driver->getScreenSize()) : core::dimension2d<s32>(0,0))),
Driver(driver), Hovered(0), Focus(0), LastHoveredMousePos(0,0), CurrentSkin(0),
Driver(driver), Hovered(0), HoveredNoSubelement(0), Focus(0), LastHoveredMousePos(0,0), CurrentSkin(0),
FileSystem(fs), UserReceiver(0), Operator(op)
{
if (Driver)
@ -84,7 +84,9 @@ CGUIEnvironment::CGUIEnvironment(io::IFileSystem* fs, video::IVideoDriver* drive
//set tooltip default
ToolTip.LastTime = 0;
ToolTip.EnterTime = 0;
ToolTip.LaunchTime = 1000;
ToolTip.RelaunchTime = 500;
ToolTip.Element = 0;
// environment is root tab group
@ -96,6 +98,12 @@ CGUIEnvironment::CGUIEnvironment(io::IFileSystem* fs, video::IVideoDriver* drive
//! destructor
CGUIEnvironment::~CGUIEnvironment()
{
if ( HoveredNoSubelement && HoveredNoSubelement != this )
{
HoveredNoSubelement->drop();
HoveredNoSubelement = 0;
}
if (Hovered && Hovered != this)
{
Hovered->drop();
@ -359,6 +367,11 @@ void CGUIEnvironment::clear()
Hovered->drop();
Hovered = 0;
}
if ( HoveredNoSubelement && HoveredNoSubelement != this)
{
HoveredNoSubelement->drop();
HoveredNoSubelement = 0;
}
// get the root's children in case the root changes in future
const core::list<IGUIElement*>& children = getRootGUIElement()->getChildren();
@ -388,19 +401,12 @@ bool CGUIEnvironment::OnEvent(const SEvent& event)
//
void CGUIEnvironment::OnPostRender( u32 time )
{
// check tooltip
IGUIElement * hoveredNonSub = Hovered;
while ( hoveredNonSub && hoveredNonSub->isSubElement() )
{
hoveredNonSub = hoveredNonSub->getParent();
}
// launch tooltip
if ( time - ToolTip.LastTime >= ToolTip.LaunchTime &&
hoveredNonSub && hoveredNonSub != this &&
ToolTip.Element == 0 &&
hoveredNonSub != ToolTip.Element &&
hoveredNonSub->getToolTipText().size() &&
if ( ToolTip.Element == 0 &&
HoveredNoSubelement && HoveredNoSubelement != this &&
(time - ToolTip.EnterTime >= ToolTip.LaunchTime
|| (time - ToolTip.LastTime >= ToolTip.RelaunchTime && time - ToolTip.LastTime < ToolTip.LaunchTime)) &&
HoveredNoSubelement->getToolTipText().size() &&
getSkin() &&
getSkin()->getFont(EGDF_TOOLTIP)
)
@ -408,7 +414,7 @@ void CGUIEnvironment::OnPostRender( u32 time )
core::rect<s32> pos;
pos.UpperLeftCorner = LastHoveredMousePos;
core::dimension2du dim = getSkin()->getFont(EGDF_TOOLTIP)->getDimension(hoveredNonSub->getToolTipText().c_str());
core::dimension2du dim = getSkin()->getFont(EGDF_TOOLTIP)->getDimension(HoveredNoSubelement->getToolTipText().c_str());
dim.Width += getSkin()->getSize(EGDS_TEXT_DISTANCE_X)*2;
dim.Height += getSkin()->getSize(EGDS_TEXT_DISTANCE_Y)*2;
@ -418,7 +424,7 @@ void CGUIEnvironment::OnPostRender( u32 time )
pos.constrainTo(getAbsolutePosition());
ToolTip.Element = addStaticText(hoveredNonSub->getToolTipText().c_str(), pos, true, true, this, -1, true);
ToolTip.Element = addStaticText(HoveredNoSubelement->getToolTipText().c_str(), pos, true, true, this, -1, true);
ToolTip.Element->setOverrideColor(getSkin()->getColor(EGDC_TOOLTIP));
ToolTip.Element->setBackgroundColor(getSkin()->getColor(EGDC_TOOLTIP_BACKGROUND));
ToolTip.Element->setOverrideFont(getSkin()->getFont(EGDF_TOOLTIP));
@ -429,7 +435,22 @@ void CGUIEnvironment::OnPostRender( u32 time )
pos = ToolTip.Element->getRelativePosition();
pos.LowerRightCorner.Y = pos.UpperLeftCorner.Y + textHeight;
ToolTip.Element->setRelativePosition(pos);
}
if (ToolTip.Element && ToolTip.Element->isVisible() ) // (isVisible() check only because we might use visibility for ToolTip one day)
{
ToolTip.LastTime = time;
// got invisible or removed in the meantime?
if ( !HoveredNoSubelement ||
!HoveredNoSubelement->isVisible() ||
!HoveredNoSubelement->getParent()
) // got invisible or removed in the meantime?
{
ToolTip.Element->remove();
ToolTip.Element->drop();
ToolTip.Element = 0;
}
}
IGUIElement::OnPostRender ( time );
@ -440,50 +461,49 @@ void CGUIEnvironment::OnPostRender( u32 time )
void CGUIEnvironment::updateHoveredElement(core::position2d<s32> mousePos)
{
IGUIElement* lastHovered = Hovered;
IGUIElement* lastHoveredNoSubelement = HoveredNoSubelement;
LastHoveredMousePos = mousePos;
Hovered = getElementFromPoint(mousePos);
if (Hovered)
if ( ToolTip.Element && Hovered == ToolTip.Element )
{
u32 now = os::Timer::getTime();
// When the mouse is over the ToolTip we remove that so it will be re-created at a new position.
// Note that ToolTip.EnterTime does not get changed here, so it will be re-created at once.
ToolTip.Element->remove();
ToolTip.Element->drop();
ToolTip.Element = 0;
if (Hovered != this)
Hovered->grab();
// Get the real Hovered
Hovered = getElementFromPoint(mousePos);
}
if (Hovered != lastHovered)
// for tooltips we want the element itself and not some of it's subelements
HoveredNoSubelement = Hovered;
while ( HoveredNoSubelement && HoveredNoSubelement->isSubElement() )
{
HoveredNoSubelement = HoveredNoSubelement->getParent();
}
if (Hovered && Hovered != this)
Hovered->grab();
if ( HoveredNoSubelement && HoveredNoSubelement != this)
HoveredNoSubelement->grab();
if (Hovered != lastHovered)
{
SEvent event;
event.EventType = EET_GUI_EVENT;
if (lastHovered)
{
SEvent event;
event.EventType = EET_GUI_EVENT;
if (lastHovered)
{
event.GUIEvent.Caller = lastHovered;
event.GUIEvent.EventType = EGET_ELEMENT_LEFT;
lastHovered->OnEvent(event);
}
if (ToolTip.Element)
{
ToolTip.Element->remove();
ToolTip.Element->drop();
ToolTip.Element = 0;
ToolTip.LastTime += 500;
}
else
{
// boost tooltip generation for relaunch
if ( now - ToolTip.LastTime < ToolTip.LastTime )
{
ToolTip.LastTime += 500;
}
else
{
ToolTip.LastTime = now;
}
}
event.GUIEvent.Caller = lastHovered;
event.GUIEvent.EventType = EGET_ELEMENT_LEFT;
lastHovered->OnEvent(event);
}
if ( Hovered )
{
event.GUIEvent.Caller = Hovered;
event.GUIEvent.Element = Hovered;
event.GUIEvent.EventType = EGET_ELEMENT_HOVERED;
@ -491,8 +511,26 @@ void CGUIEnvironment::updateHoveredElement(core::position2d<s32> mousePos)
}
}
if ( lastHoveredNoSubelement != HoveredNoSubelement )
{
if (ToolTip.Element)
{
ToolTip.Element->remove();
ToolTip.Element->drop();
ToolTip.Element = 0;
}
if ( HoveredNoSubelement )
{
u32 now = os::Timer::getTime();
ToolTip.EnterTime = now;
}
}
if (lastHovered && lastHovered != this)
lastHovered->drop();
if (lastHoveredNoSubelement && lastHoveredNoSubelement != this)
lastHoveredNoSubelement->drop();
}

View File

@ -282,7 +282,9 @@ private:
{
IGUIStaticText* Element;
u32 LastTime;
u32 EnterTime;
u32 LaunchTime;
u32 RelaunchTime;
};
SToolTip ToolTip;
@ -293,6 +295,7 @@ private:
core::array<SSpriteBank> Banks;
video::IVideoDriver* Driver;
IGUIElement* Hovered;
IGUIElement* HoveredNoSubelement; // subelements replaced by their parent, so you only have 'real' elements here
IGUIElement* Focus;
core::position2d<s32> LastHoveredMousePos;
IGUISkin* CurrentSkin;

View File

@ -36,7 +36,7 @@ CGUIListBox::CGUIListBox(IGUIEnvironment* environment, IGUIElement* parent,
IGUISkin* skin = Environment->getSkin();
const s32 s = skin->getSize(EGDS_SCROLLBAR_SIZE);
ScrollBar = new CGUIScrollBar(false, Environment, this, 0,
ScrollBar = new CGUIScrollBar(false, Environment, this, -1,
core::rect<s32>(RelativeRect.getWidth() - s, 0, RelativeRect.getWidth(), RelativeRect.getHeight()),
!clip);
ScrollBar->setSubElement(true);

View File

@ -321,6 +321,8 @@ bool CGUIMessageBox::OnEvent(const SEvent& event)
{
if (OkButton && event.KeyInput.Key == KEY_RETURN)
{
setVisible(false); // this is a workaround to make sure it's no longer the hovered element, crashes on pressing 1-2 times ESC
Environment->setFocus(0);
outevent.GUIEvent.EventType = EGET_MESSAGEBOX_OK;
Parent->OnEvent(outevent);
remove();
@ -329,6 +331,8 @@ bool CGUIMessageBox::OnEvent(const SEvent& event)
else
if ((CancelButton || CloseButton) && event.KeyInput.Key == KEY_ESCAPE)
{
setVisible(false); // this is a workaround to make sure it's no longer the hovered element, crashes on pressing 1-2 times ESC
Environment->setFocus(0);
outevent.GUIEvent.EventType = EGET_MESSAGEBOX_CANCEL;
Parent->OnEvent(outevent);
remove();
@ -337,6 +341,8 @@ bool CGUIMessageBox::OnEvent(const SEvent& event)
else
if (YesButton && event.KeyInput.Key == KEY_KEY_Y)
{
setVisible(false); // this is a workaround to make sure it's no longer the hovered element, crashes on pressing 1-2 times ESC
Environment->setFocus(0);
outevent.GUIEvent.EventType = EGET_MESSAGEBOX_YES;
Parent->OnEvent(outevent);
remove();
@ -345,6 +351,8 @@ bool CGUIMessageBox::OnEvent(const SEvent& event)
else
if (NoButton && event.KeyInput.Key == KEY_KEY_N)
{
setVisible(false); // this is a workaround to make sure it's no longer the hovered element, crashes on pressing 1-2 times ESC
Environment->setFocus(0);
outevent.GUIEvent.EventType = EGET_MESSAGEBOX_NO;
Parent->OnEvent(outevent);
remove();
@ -357,6 +365,8 @@ bool CGUIMessageBox::OnEvent(const SEvent& event)
{
if (event.GUIEvent.Caller == OkButton)
{
setVisible(false); // this is a workaround to make sure it's no longer the hovered element, crashes on pressing 1-2 times ESC
Environment->setFocus(0);
outevent.GUIEvent.EventType = EGET_MESSAGEBOX_OK;
Parent->OnEvent(outevent);
remove();
@ -366,6 +376,8 @@ bool CGUIMessageBox::OnEvent(const SEvent& event)
if (event.GUIEvent.Caller == CancelButton ||
event.GUIEvent.Caller == CloseButton)
{
setVisible(false); // this is a workaround to make sure it's no longer the hovered element, crashes on pressing 1-2 times ESC
Environment->setFocus(0);
outevent.GUIEvent.EventType = EGET_MESSAGEBOX_CANCEL;
Parent->OnEvent(outevent);
remove();
@ -374,6 +386,8 @@ bool CGUIMessageBox::OnEvent(const SEvent& event)
else
if (event.GUIEvent.Caller == YesButton)
{
setVisible(false); // this is a workaround to make sure it's no longer the hovered element, crashes on pressing 1-2 times ESC
Environment->setFocus(0);
outevent.GUIEvent.EventType = EGET_MESSAGEBOX_YES;
Parent->OnEvent(outevent);
remove();
@ -382,6 +396,8 @@ bool CGUIMessageBox::OnEvent(const SEvent& event)
else
if (event.GUIEvent.Caller == NoButton)
{
setVisible(false); // this is a workaround to make sure it's no longer the hovered element, crashes on pressing 1-2 times ESC
Environment->setFocus(0);
outevent.GUIEvent.EventType = EGET_MESSAGEBOX_NO;
Parent->OnEvent(outevent);
remove();

View File

@ -31,7 +31,7 @@ CGUIModalScreen::CGUIModalScreen(IGUIEnvironment* environment, IGUIElement* pare
bool CGUIModalScreen::canTakeFocus(IGUIElement* target) const
{
return (target && (target == this // this element can take it
return (target && ((const IGUIElement*)target == this // this element can take it
|| isMyChild(target) // own childs also
|| (target->getType() == EGUIET_MODAL_SCREEN )// other modals also fine
|| (target->getParent() && target->getParent()->getType() == EGUIET_MODAL_SCREEN ))) // childs of other modals will do

View File

@ -244,13 +244,16 @@ bool CIrrDeviceLinux::switchToFullscreen(bool reset)
else if (bestMode!=-1 &&
modes[i]->hdisplay >= Width &&
modes[i]->vdisplay >= Height &&
modes[i]->hdisplay < modes[bestMode]->hdisplay &&
modes[i]->vdisplay < modes[bestMode]->vdisplay)
modes[i]->hdisplay <= modes[bestMode]->hdisplay &&
modes[i]->vdisplay <= modes[bestMode]->vdisplay)
bestMode = i;
}
if (bestMode != -1)
{
os::Printer::log("Starting fullscreen mode...", ELL_INFORMATION);
os::Printer::log("Starting vidmode fullscreen mode...", ELL_INFORMATION);
os::Printer::log("hdisplay: ", core::stringc(modes[bestMode]->hdisplay).c_str(), ELL_INFORMATION);
os::Printer::log("vdisplay: ", core::stringc(modes[bestMode]->vdisplay).c_str(), ELL_INFORMATION);
XF86VidModeSwitchToMode(display, screennr, modes[bestMode]);
XF86VidModeSetViewPort(display, screennr, 0, 0);
UseXVidMode=true;
@ -278,12 +281,16 @@ bool CIrrDeviceLinux::switchToFullscreen(bool reset)
else if (bestMode!=-1 &&
(u32)modes[i].width >= Width &&
(u32)modes[i].height >= Height &&
modes[i].width < modes[bestMode].width &&
modes[i].height < modes[bestMode].height)
modes[i].width <= modes[bestMode].width &&
modes[i].height <= modes[bestMode].height)
bestMode = i;
}
if (bestMode != -1)
{
os::Printer::log("Starting randr fullscreen mode...", ELL_INFORMATION);
os::Printer::log("width: ", core::stringc(modes[bestMode].width).c_str(), ELL_INFORMATION);
os::Printer::log("height: ", core::stringc(modes[bestMode].height).c_str(), ELL_INFORMATION);
XRRSetScreenConfig(display,config,DefaultRootWindow(display),bestMode,oldRandrRotation,CurrentTime);
UseXRandR=true;
}
@ -998,6 +1005,7 @@ bool CIrrDeviceLinux::run()
irrevent.KeyInput.Key = (EKEY_CODE)KeyMap[idx].Win32Key;
else
{
// Usually you will check keysymdef.h and add the corresponding key to createKeyMap.
irrevent.KeyInput.Key = (EKEY_CODE)0;
os::Printer::log("Could not find win32 key for x11 key.", core::stringc((int)mp.X11Key).c_str(), ELL_WARNING);
}
@ -1235,7 +1243,7 @@ video::ECOLOR_FORMAT CIrrDeviceLinux::getColorFormat() const
void CIrrDeviceLinux::setResizable(bool resize)
{
#ifdef _IRR_COMPILE_WITH_X11_
if (CreationParams.DriverType == video::EDT_NULL)
if (CreationParams.DriverType == video::EDT_NULL || CreationParams.Fullscreen )
return;
XUnmapWindow(display, window);
@ -1375,6 +1383,7 @@ void CIrrDeviceLinux::createKeyMap()
KeyMap.reallocate(84);
KeyMap.push_back(SKeyMap(XK_BackSpace, KEY_BACK));
KeyMap.push_back(SKeyMap(XK_Tab, KEY_TAB));
KeyMap.push_back(SKeyMap(XK_ISO_Left_Tab, KEY_TAB));
KeyMap.push_back(SKeyMap(XK_Linefeed, 0)); // ???
KeyMap.push_back(SKeyMap(XK_Clear, KEY_CLEAR));
KeyMap.push_back(SKeyMap(XK_Return, KEY_RETURN));

View File

@ -40,7 +40,7 @@ namespace irr
}
} // end namespace irr
// Get the codepage from the locale language id
// Get the codepage from the locale language id
// Based on the table from http://www.science.co.il/Language/Locale-Codes.asp?s=decimal
static unsigned int LocaleIdToCodepage(unsigned int lcid)
{
@ -198,7 +198,7 @@ static unsigned int LocaleIdToCodepage(unsigned int lcid)
return 1258;
}
return 65001; // utf-8
}
}
namespace
{
@ -210,7 +210,7 @@ namespace
irr::core::list<SEnvMapper> EnvMap;
HKL KEYBOARD_INPUT_HKL=0;
unsigned int KEYBOARD_INPUT_CODEPAGE = 1252;
unsigned int KEYBOARD_INPUT_CODEPAGE = 1252;
};
SEnvMapper* getEnvMapperFromHWnd(HWND hWnd)
@ -412,7 +412,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
sizeof(keyChars),
(WCHAR*)&unicodeChar,
1 );
event.KeyInput.Char = unicodeChar;
event.KeyInput.Char = unicodeChar;
}
else
event.KeyInput.Char = 0;
@ -485,7 +485,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
// get the new codepage used for keyboard input
KEYBOARD_INPUT_HKL = GetKeyboardLayout(0);
KEYBOARD_INPUT_CODEPAGE = LocaleIdToCodepage( LOWORD(KEYBOARD_INPUT_HKL) );
return 0;
return 0;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
@ -583,7 +583,7 @@ CIrrDeviceWin32::CIrrDeviceWin32(const SIrrlichtCreationParameters& params)
MoveWindow(HWnd, windowLeft, windowTop, realWidth, realHeight, TRUE);
// make sure everything gets updated to the real sizes
Resized = true;
Resized = true;
}
else if (CreationParams.WindowId)
{
@ -1039,132 +1039,215 @@ video::IVideoModeList* CIrrDeviceWin32::getVideoModeList()
return &VideoModeList;
}
typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD);
// Needed for old windows apis
#define PRODUCT_ULTIMATE 0x00000001
#define PRODUCT_HOME_BASIC 0x00000002
#define PRODUCT_HOME_PREMIUM 0x00000003
#define PRODUCT_ENTERPRISE 0x00000004
#define PRODUCT_HOME_BASIC_N 0x00000005
#define PRODUCT_BUSINESS 0x00000006
#define PRODUCT_STARTER 0x0000000B
#define PRODUCT_BUSINESS_N 0x00000010
#define PRODUCT_HOME_PREMIUM_N 0x0000001A
#define PRODUCT_ENTERPRISE_N 0x0000001B
#define PRODUCT_ULTIMATE_N 0x0000001C
#define PRODUCT_STARTER_N 0x0000002F
#define PRODUCT_PROFESSIONAL 0x00000030
#define PRODUCT_PROFESSIONAL_N 0x00000031
#define PRODUCT_STARTER_E 0x00000042
#define PRODUCT_HOME_BASIC_E 0x00000043
#define PRODUCT_HOME_PREMIUM_E 0x00000044
#define PRODUCT_PROFESSIONAL_E 0x00000045
#define PRODUCT_ENTERPRISE_E 0x00000046
#define PRODUCT_ULTIMATE_E 0x00000047
void CIrrDeviceWin32::getWindowsVersion(core::stringc& out)
{
OSVERSIONINFOEX osvi;
BOOL bOsVersionInfoEx;
OSVERSIONINFOEX osvi;
PGPI pGPI;
BOOL bOsVersionInfoEx;
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO*) &osvi);
if (!bOsVersionInfoEx)
{
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if (! GetVersionEx((OSVERSIONINFO *) &osvi))
return;
}
bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO*) &osvi);
if (!bOsVersionInfoEx)
{
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if (! GetVersionEx((OSVERSIONINFO *) &osvi))
return;
}
switch (osvi.dwPlatformId)
{
case VER_PLATFORM_WIN32_NT:
if (osvi.dwMajorVersion <= 4)
out.append("Microsoft Windows NT ");
else
if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0)
out.append("Microsoft Windows 2000 ");
else
if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1)
out.append("Microsoft Windows XP ");
else
if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0)
out.append("Microsoft Windows Vista ");
switch (osvi.dwPlatformId)
{
case VER_PLATFORM_WIN32_NT:
if (osvi.dwMajorVersion <= 4)
out.append("Microsoft Windows NT ");
else
if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0)
out.append("Microsoft Windows 2000 ");
else
if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1)
out.append("Microsoft Windows XP ");
else
if (osvi.dwMajorVersion == 6 )
{
if (osvi.dwMinorVersion == 0)
{
if (osvi.wProductType == VER_NT_WORKSTATION)
out.append("Microsoft Windows Vista ");
else
out.append("Microsoft Windows Server 2008 ");
}
else if (osvi.dwMinorVersion == 1)
{
if (osvi.wProductType == VER_NT_WORKSTATION)
out.append("Microsoft Windows 7 ");
else
out.append("Microsoft Windows Server 2008 R2 ");
}
}
if (bOsVersionInfoEx)
{
#ifdef VER_SUITE_ENTERPRISE
if (osvi.wProductType == VER_NT_WORKSTATION)
{
if (bOsVersionInfoEx)
{
if (osvi.dwMajorVersion == 6)
{
DWORD dwType;
pGPI = (PGPI)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetProductInfo");
pGPI(osvi.dwMajorVersion, osvi.dwMinorVersion, 0, 0, &dwType);
switch (dwType)
{
case PRODUCT_ULTIMATE:
case PRODUCT_ULTIMATE_E:
case PRODUCT_ULTIMATE_N:
out.append("Ultimate Edition ");
break;
case PRODUCT_PROFESSIONAL:
case PRODUCT_PROFESSIONAL_E:
case PRODUCT_PROFESSIONAL_N:
out.append("Professional Edition ");
break;
case PRODUCT_HOME_BASIC:
case PRODUCT_HOME_BASIC_E:
case PRODUCT_HOME_BASIC_N:
out.append("Home Basic Edition ");
break;
case PRODUCT_HOME_PREMIUM:
case PRODUCT_HOME_PREMIUM_E:
case PRODUCT_HOME_PREMIUM_N:
out.append("Home Premium Edition ");
break;
case PRODUCT_ENTERPRISE:
case PRODUCT_ENTERPRISE_E:
case PRODUCT_ENTERPRISE_N:
out.append("Enterprise Edition ");
break;
case PRODUCT_BUSINESS:
case PRODUCT_BUSINESS_N:
out.append("Business Edition ");
break;
case PRODUCT_STARTER:
case PRODUCT_STARTER_E:
case PRODUCT_STARTER_N:
out.append("Starter Edition ");
break;
}
}
#ifdef VER_SUITE_ENTERPRISE
else
if (osvi.wProductType == VER_NT_WORKSTATION)
{
#ifndef __BORLANDC__
if( osvi.wSuiteMask & VER_SUITE_PERSONAL )
out.append("Personal ");
else
out.append("Professional ");
if( osvi.wSuiteMask & VER_SUITE_PERSONAL )
out.append("Personal ");
else
out.append("Professional ");
#endif
}
else if (osvi.wProductType == VER_NT_SERVER)
{
if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
out.append("DataCenter Server ");
else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
out.append("Advanced Server ");
else
out.append("Server ");
}
#endif
}
else
{
HKEY hKey;
char szProductType[80];
DWORD dwBufLen;
}
else if (osvi.wProductType == VER_NT_SERVER)
{
if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
out.append("DataCenter Server ");
else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
out.append("Advanced Server ");
else
out.append("Server ");
}
#endif
}
else
{
HKEY hKey;
char szProductType[80];
DWORD dwBufLen;
RegOpenKeyEx( HKEY_LOCAL_MACHINE,
__TEXT("SYSTEM\\CurrentControlSet\\Control\\ProductOptions"),
0, KEY_QUERY_VALUE, &hKey );
RegQueryValueEx( hKey, __TEXT("ProductType"), NULL, NULL,
(LPBYTE) szProductType, &dwBufLen);
RegCloseKey( hKey );
RegOpenKeyEx( HKEY_LOCAL_MACHINE,
__TEXT("SYSTEM\\CurrentControlSet\\Control\\ProductOptions"),
0, KEY_QUERY_VALUE, &hKey );
RegQueryValueEx( hKey, __TEXT("ProductType"), NULL, NULL,
(LPBYTE) szProductType, &dwBufLen);
RegCloseKey( hKey );
if (_strcmpi( "WINNT", szProductType) == 0 )
out.append("Professional ");
if (_strcmpi( "LANMANNT", szProductType) == 0)
out.append("Server ");
if (_strcmpi( "SERVERNT", szProductType) == 0)
out.append("Advanced Server ");
}
if (_strcmpi( "WINNT", szProductType) == 0 )
out.append("Professional ");
if (_strcmpi( "LANMANNT", szProductType) == 0)
out.append("Server ");
if (_strcmpi( "SERVERNT", szProductType) == 0)
out.append("Advanced Server ");
}
// Display version, service pack (if any), and build number.
// Display version, service pack (if any), and build number.
char tmp[255];
char tmp[255];
if (osvi.dwMajorVersion <= 4 )
{
sprintf(tmp, "version %ld.%ld %s (Build %ld)",
osvi.dwMajorVersion,
osvi.dwMinorVersion,
osvi.szCSDVersion,
osvi.dwBuildNumber & 0xFFFF);
}
else
{
sprintf(tmp, "%s (Build %ld)", osvi.szCSDVersion,
osvi.dwBuildNumber & 0xFFFF);
}
if (osvi.dwMajorVersion <= 4 )
{
sprintf(tmp, "version %ld.%ld %s (Build %ld)",
osvi.dwMajorVersion,
osvi.dwMinorVersion,
osvi.szCSDVersion,
osvi.dwBuildNumber & 0xFFFF);
}
else
{
sprintf(tmp, "%s (Build %ld)", osvi.szCSDVersion,
osvi.dwBuildNumber & 0xFFFF);
}
out.append(tmp);
break;
out.append(tmp);
break;
case VER_PLATFORM_WIN32_WINDOWS:
case VER_PLATFORM_WIN32_WINDOWS:
IsNonNTWindows = true;
IsNonNTWindows = true;
if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0)
{
out.append("Microsoft Windows 95 ");
if ( osvi.szCSDVersion[1] == 'C' || osvi.szCSDVersion[1] == 'B' )
out.append("OSR2 " );
}
if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0)
{
out.append("Microsoft Windows 95 ");
if ( osvi.szCSDVersion[1] == 'C' || osvi.szCSDVersion[1] == 'B' )
out.append("OSR2 " );
}
if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10)
{
out.append("Microsoft Windows 98 ");
if ( osvi.szCSDVersion[1] == 'A' )
out.append( "SE " );
}
if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10)
{
out.append("Microsoft Windows 98 ");
if ( osvi.szCSDVersion[1] == 'A' )
out.append( "SE " );
}
if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90)
out.append("Microsoft Windows Me ");
if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90)
out.append("Microsoft Windows Me ");
break;
break;
case VER_PLATFORM_WIN32s:
case VER_PLATFORM_WIN32s:
IsNonNTWindows = true;
out.append("Microsoft Win32s ");
break;
}
IsNonNTWindows = true;
out.append("Microsoft Win32s ");
break;
}
}
//! Notifies the device, that it has been resized
@ -1323,7 +1406,7 @@ void CIrrDeviceWin32::pollJoysticks()
event.EventType = irr::EET_JOYSTICK_INPUT_EVENT;
event.JoystickEvent.Joystick = (u8)joystick;
event.JoystickEvent.POV = (u16)info.dwPOV;
// set to undefined if no POV value was returned or the value
// is out of range

View File

@ -262,7 +262,8 @@ ISceneNode* CLightSceneNode::clone(ISceneNode* newParent, ISceneManager* newMana
nb->LightData = LightData;
nb->BBox = BBox;
nb->drop();
if ( newParent )
nb->drop();
return nb;
}

View File

@ -372,7 +372,8 @@ ISceneNode* CMeshSceneNode::clone(ISceneNode* newParent, ISceneManager* newManag
nb->ReadOnlyMaterials = ReadOnlyMaterials;
nb->Materials = Materials;
nb->drop();
if ( newParent )
nb->drop();
return nb;
}

View File

@ -24,12 +24,6 @@ CArchiveLoaderMount::CArchiveLoaderMount( io::IFileSystem* fs)
}
//! destructor
CArchiveLoaderMount::~CArchiveLoaderMount()
{
}
//! returns true if the file maybe is able to be loaded by this class
bool CArchiveLoaderMount::isALoadableFileFormat(const io::path& filename) const
{
@ -86,16 +80,15 @@ IFileArchive* CArchiveLoaderMount::createArchive(io::IReadFile* file, bool ignor
return 0;
}
//! compatible Folder Archticture
//
//! compatible Folder Architecture
CMountPointReader::CMountPointReader(IFileSystem * parent, const io::path& basename, bool ignoreCase, bool ignorePaths)
: CFileList(basename, ignoreCase, ignorePaths), Parent(parent)
{
//! ensure CFileList path ends in a slash
if (Path.lastChar() != '/' )
Path.append ('/');
Path.append('/');
io::path work = Parent->getWorkingDirectory();
const io::path work = Parent->getWorkingDirectory();
Parent->changeWorkingDirectoryTo(basename);
buildDirectory();
@ -104,10 +97,6 @@ CMountPointReader::CMountPointReader(IFileSystem * parent, const io::path& basen
sort();
}
CMountPointReader::~CMountPointReader()
{
}
//! returns the list of files
const IFileList* CMountPointReader::getFileList() const
@ -118,6 +107,8 @@ const IFileList* CMountPointReader::getFileList() const
void CMountPointReader::buildDirectory()
{
IFileList * list = Parent->createFileList();
if (!list)
return;
const u32 size = list->getFileCount();
for (u32 i=0; i < size; ++i)
@ -142,7 +133,7 @@ void CMountPointReader::buildDirectory()
{
addItem(full, 0, true, 0);
Parent->changeWorkingDirectoryTo(pwd);
buildDirectory ();
buildDirectory();
Parent->changeWorkingDirectoryTo("..");
}
}

View File

@ -25,9 +25,6 @@ namespace io
//! Constructor
CArchiveLoaderMount(io::IFileSystem* fs);
//! destructor
virtual ~CArchiveLoaderMount();
//! returns true if the file maybe is able to be loaded by this class
//! based on the file extension (e.g. ".zip")
virtual bool isALoadableFileFormat(const io::path& filename) const;
@ -66,9 +63,6 @@ namespace io
CMountPointReader(IFileSystem *parent, const io::path& basename,
bool ignoreCase, bool ignorePaths);
//! Destructor
virtual ~CMountPointReader();
//! opens a file by index
virtual IReadFile* createAndOpenFile(u32 index);

View File

@ -104,7 +104,7 @@ bool CArchiveLoaderNPK::isALoadableFileFormat(io::IReadFile* file) const
NPK Reader
*/
CNPKReader::CNPKReader(IReadFile* file, bool ignoreCase, bool ignorePaths)
: CFileList(file ? file->getFileName() : "", ignoreCase, ignorePaths), File(file)
: CFileList((file ? file->getFileName() : io::path("")), ignoreCase, ignorePaths), File(file)
{
#ifdef _DEBUG
setDebugName("CNPKReader");
@ -137,13 +137,13 @@ const IFileList* CNPKReader::getFileList() const
bool CNPKReader::scanLocalHeader()
{
SNPKHeader header;
// Read and validate the header
File->read(&header, sizeof(header));
if (!isHeaderValid(header))
return false;
// Seek to the table of contents
// Seek to the table of contents
#ifdef __BIG_ENDIAN__
header.Offset = os::Byteswap::byteswap(header.Offset);
header.Length = os::Byteswap::byteswap(header.Length);
@ -222,7 +222,7 @@ bool CNPKReader::scanLocalHeader()
#ifdef IRR_DEBUG_NPK_READER
os::Printer::log("Name", entry.Name);
#endif
addItem(isDir?dirName:dirName+entry.Name, entry.Length, isDir, Offsets.size());
addItem((isDir?dirName:dirName+entry.Name), entry.Length, isDir, Offsets.size());
Offsets.push_back(entry.Offset+header.Offset);
}
return true;

View File

@ -728,7 +728,7 @@ void CNullDriver::draw2DImage(const video::ITexture* texture, const core::rect<s
const video::SColor* const colors, bool useAlphaChannelOfTexture)
{
draw2DImage(texture, core::position2d<s32>(destRect.UpperLeftCorner),
sourceRect, clipRect, colors?colors[0]:0xffffffff,
sourceRect, clipRect, colors?colors[0]:video::SColor(0xffffffff),
useAlphaChannelOfTexture);
}

View File

@ -813,7 +813,7 @@ u32 COBJMeshFileLoader::copyWord(c8* outBuf, const c8* const inBuf, u32 outBufLe
for (u32 j=0; j<length; ++j)
outBuf[j] = inBuf[j];
outBuf[i] = 0;
outBuf[length] = 0;
return length;
}

View File

@ -926,6 +926,8 @@ void COgreMeshFileLoader::readPass(io::IReadFile* file, OgreTechnique& technique
getMaterialToken(file, token); //open brace
getMaterialToken(file, token);
if (token == "}")
return;
u32 inBlocks=1;
u32 textureUnit=0;
while(inBlocks)

View File

@ -381,10 +381,10 @@ void* COpenGLTexture::lock(bool readOnly, u32 mipmapLevel)
++i;
}
while (i != mipmapLevel);
image = new CImage(ECF_A8R8G8B8, core::dimension2du(width,height));
MipImage = image = new CImage(ECF_A8R8G8B8, core::dimension2du(width,height));
}
else
image = new CImage(ECF_A8R8G8B8, ImageSize);
Image = image = new CImage(ECF_A8R8G8B8, ImageSize);
ColorFormat = ECF_A8R8G8B8;
}
if (!image)

View File

@ -100,7 +100,7 @@ bool CArchiveLoaderPAK::isALoadableFileFormat(io::IReadFile* file) const
PAK Reader
*/
CPakReader::CPakReader(IReadFile* file, bool ignoreCase, bool ignorePaths)
: CFileList(file ? file->getFileName() : "", ignoreCase, ignorePaths), File(file)
: CFileList((file ? file->getFileName() : io::path("")), ignoreCase, ignorePaths), File(file)
{
#ifdef _DEBUG
setDebugName("CPakReader");
@ -130,13 +130,13 @@ const IFileList* CPakReader::getFileList() const
bool CPakReader::scanLocalHeader()
{
SPAKFileHeader header;
// Read and validate the header
File->read(&header, sizeof(header));
if (!isHeaderValid(header))
return false;
// Seek to the table of contents
// Seek to the table of contents
#ifdef __BIG_ENDIAN__
header.offset = os::Byteswap::byteswap(header.offset);
header.length = os::Byteswap::byteswap(header.length);

View File

@ -252,7 +252,8 @@ ISceneNode* CSkyBoxSceneNode::clone(ISceneNode* newParent, ISceneManager* newMan
for (u32 i=0; i<6; ++i)
nb->Material[i] = Material[i];
nb->drop();
if ( newParent )
nb->drop();
return nb;
}

View File

@ -33,7 +33,7 @@ namespace scene
CSkyDomeSceneNode::CSkyDomeSceneNode(video::ITexture* sky, u32 horiRes, u32 vertRes,
f32 texturePercentage, f32 spherePercentage, f32 radius,
ISceneNode* parent, ISceneManager* mgr, s32 id)
: ISceneNode(parent, mgr, id), Buffer(0),
: ISceneNode(parent, mgr, id), Buffer(0),
HorizontalResolution(horiRes), VerticalResolution(vertRes),
TexturePercentage(texturePercentage),
SpherePercentage(spherePercentage), Radius(radius)
@ -264,7 +264,7 @@ void CSkyDomeSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttribut
Radius = in->getAttributeAsFloat("Radius");
ISceneNode::deserializeAttributes(in, options);
// regenerate the mesh
generateMesh();
}
@ -272,17 +272,18 @@ void CSkyDomeSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttribut
//! Creates a clone of this scene node and its children.
ISceneNode* CSkyDomeSceneNode::clone(ISceneNode* newParent, ISceneManager* newManager)
{
if (!newParent)
if (!newParent)
newParent = Parent;
if (!newManager)
if (!newManager)
newManager = SceneManager;
CSkyDomeSceneNode* nb = new CSkyDomeSceneNode(Buffer->Material.TextureLayer[0].Texture, HorizontalResolution, VerticalResolution, TexturePercentage,
CSkyDomeSceneNode* nb = new CSkyDomeSceneNode(Buffer->Material.TextureLayer[0].Texture, HorizontalResolution, VerticalResolution, TexturePercentage,
SpherePercentage, Radius, newParent, newManager, ID);
nb->cloneMembers(this, newManager);
nb->drop();
if ( newParent )
nb->drop();
return nb;
}

View File

@ -141,13 +141,14 @@ ISceneNode* CSphereSceneNode::clone(ISceneNode* newParent, ISceneManager* newMan
if (!newManager)
newManager = SceneManager;
CSphereSceneNode* nb = new CSphereSceneNode(Radius, PolyCountX, PolyCountY, newParent,
CSphereSceneNode* nb = new CSphereSceneNode(Radius, PolyCountX, PolyCountY, newParent,
newManager, ID, RelativeTranslation);
nb->cloneMembers(this, newManager);
nb->getMaterial(0) = Mesh->getMeshBuffer(0)->getMaterial();
nb->drop();
if ( newParent )
nb->drop();
return nb;
}

View File

@ -125,7 +125,7 @@ bool CArchiveLoaderTAR::isALoadableFileFormat(io::IReadFile* file) const
TAR Archive
*/
CTarReader::CTarReader(IReadFile* file, bool ignoreCase, bool ignorePaths)
: CFileList(file ? file->getFileName() : "", ignoreCase, ignorePaths), File(file)
: CFileList((file ? file->getFileName() : io::path("")), ignoreCase, ignorePaths), File(file)
{
#ifdef _DEBUG
setDebugName("CTarReader");

View File

@ -1515,7 +1515,8 @@ namespace scene
// finish
nb->drop();
if ( newParent )
nb->drop();
return nb;
}

View File

@ -191,7 +191,8 @@ ISceneNode* CVolumeLightSceneNode::clone(ISceneNode* newParent, ISceneManager* n
nb->cloneMembers(this, newManager);
nb->getMaterial(0) = Mesh->getMeshBuffer(0)->getMaterial();
nb->drop();
if ( newParent )
nb->drop();
return nb;
}

View File

@ -4,11 +4,18 @@
#include "CZipReader.h"
#include "os.h"
// This method is used for error output from bzip2.
extern "C" void bz_internal_error(int errorCode)
{
irr::os::Printer::log("Error in bzip2 handling", irr::core::stringc(errorCode), irr::ELL_ERROR);
}
#ifdef __IRR_COMPILE_WITH_ZIP_ARCHIVE_LOADER_
#include "CFileList.h"
#include "CReadFile.h"
#include "os.h"
#include "coreutil.h"
#include "IrrCompileConfig.h"
@ -34,14 +41,6 @@
#endif
#endif
#ifdef BZ_NO_STDIO
// This method is used for error output from bzip2.
extern "C" void bz_internal_error(int errorCode)
{
irr::os::Printer::log("Error in bzip2 handling", irr::core::stringc(errorCode), irr::ELL_ERROR);
}
#endif
namespace irr
{
namespace io
@ -139,7 +138,7 @@ bool CArchiveLoaderZIP::isALoadableFileFormat(io::IReadFile* file) const
// -----------------------------------------------------------------------------
CZipReader::CZipReader(IReadFile* file, bool ignoreCase, bool ignorePaths, bool isGZip)
: CFileList(file ? file->getFileName() : "", ignoreCase, ignorePaths), File(file), IsGZip(isGZip)
: CFileList((file ? file->getFileName() : io::path("")), ignoreCase, ignorePaths), File(file), IsGZip(isGZip)
{
#ifdef _DEBUG
setDebugName("CZipReader");

View File

@ -532,6 +532,7 @@
<Unit filename="../../include/SMeshBufferTangents.h" />
<Unit filename="../../include/SParticle.h" />
<Unit filename="../../include/SSkinMeshBuffer.h" />
<Unit filename="../../include/SVertexManipulator.h" />
<Unit filename="../../include/SViewFrustum.h" />
<Unit filename="../../include/SceneParameters.h" />
<Unit filename="../../include/aabbox3d.h" />

View File

@ -2190,7 +2190,7 @@ OverrideBuildCmd=0
BuildCmd=
[Unit217]
FileName=COctTreeSceneNode.cpp
FileName=COctreeSceneNode.cpp
Folder=Irrlicht/scene/nodes
Compile=1
CompileCpp=1
@ -2200,7 +2200,7 @@ OverrideBuildCmd=0
BuildCmd=
[Unit218]
FileName=COctTreeSceneNode.h
FileName=COctreeSceneNode.h
Folder=Irrlicht/scene/nodes
Compile=1
CompileCpp=1
@ -2210,7 +2210,7 @@ OverrideBuildCmd=0
BuildCmd=
[Unit219]
FileName=COctTreeTriangleSelector.cpp
FileName=COctreeTriangleSelector.cpp
Folder=Irrlicht/scene/collision
Compile=1
CompileCpp=1
@ -2220,7 +2220,7 @@ OverrideBuildCmd=0
BuildCmd=
[Unit220]
FileName=COctTreeTriangleSelector.h
FileName=COctreeTriangleSelector.h
Folder=Irrlicht/scene/collision
Compile=1
CompileCpp=1
@ -2770,7 +2770,7 @@ OverrideBuildCmd=0
BuildCmd=
[Unit275]
FileName=OctTree.h
FileName=Octree.h
Folder=Irrlicht/scene/mesh
Compile=1
CompileCpp=1

View File

@ -319,34 +319,22 @@ private:
if ( parentTest != 2 )
#endif
{
core::vector3df edges[8];
Box.getEdges(edges);
#if defined (OCTREE_PARENTTEST )
parentTest = 2;
#endif
for (i=0; i!=scene::SViewFrustum::VF_PLANE_COUNT; ++i)
{
u32 boxInFrustum=0;
for (u32 j=0; j!=8; ++j)
{
if (frustum.planes[i].classifyPointRelation(edges[j]) != core::ISREL3D_FRONT)
{
boxInFrustum += 1;
#if !defined (OCTREE_PARENTTEST )
break;
#endif
}
}
if ( 0 == boxInFrustum) // all edges outside
core::EIntersectionRelation3D r = Box.classifyPlaneRelation(frustum.planes[i]);
if ( r == core::ISREL3D_FRONT )
return;
#if defined (OCTREE_PARENTTEST )
if ( 8 == boxInFrustum) // all edges in, all children in
parentTest = 2;
if ( r == core::ISREL3D_CLIPPED )
parentTest = 1; // must still check childs
#endif
}
}
const u32 cnt = IndexData->size();
for (i=0; i!=cnt; ++i)

View File

@ -27,7 +27,7 @@ IRRMESHWRITER = ['CColladaMeshWriter.cpp', 'CIrrMeshWriter.cpp', 'COBJMeshWriter
IRRMESHOBJ = IRRMESHLOADER + IRRMESHWRITER + ['CSkinnedMesh.cpp', 'CBoneSceneNode.cpp', 'CMeshSceneNode.cpp', 'CAnimatedMeshSceneNode.cpp', 'CAnimatedMeshMD2.cpp', 'CAnimatedMeshMD3.cpp', 'CQ3LevelMesh.cpp', 'CQuake3ShaderSceneNode.cpp'];
IRROBJ = ['CBillboardSceneNode.cpp', 'CCameraSceneNode.cpp', 'CDummyTransformationSceneNode.cpp', 'CEmptySceneNode.cpp', 'CGeometryCreator.cpp', 'CLightSceneNode.cpp', 'CMeshManipulator.cpp', 'CMetaTriangleSelector.cpp', 'COctTreeSceneNode.cpp', 'COctTreeTriangleSelector.cpp', 'CSceneCollisionManager.cpp', 'CSceneManager.cpp', 'CShadowVolumeSceneNode.cpp', 'CSkyBoxSceneNode.cpp', 'CSkyDomeSceneNode.cpp', 'CTerrainSceneNode.cpp', 'CTerrainTriangleSelector.cpp', 'CVolumeLightSceneNode.cpp', 'CCubeSceneNode.cpp', 'CSphereSceneNode.cpp', 'CTextSceneNode.cpp', 'CTriangleBBSelector.cpp', 'CTriangleSelector.cpp', 'CWaterSurfaceSceneNode.cpp', 'CMeshCache.cpp', 'CDefaultSceneNodeAnimatorFactory.cpp', 'CDefaultSceneNodeFactory.cpp'];
IRROBJ = ['CBillboardSceneNode.cpp', 'CCameraSceneNode.cpp', 'CDummyTransformationSceneNode.cpp', 'CEmptySceneNode.cpp', 'CGeometryCreator.cpp', 'CLightSceneNode.cpp', 'CMeshManipulator.cpp', 'CMetaTriangleSelector.cpp', 'COctreeSceneNode.cpp', 'COctreeTriangleSelector.cpp', 'CSceneCollisionManager.cpp', 'CSceneManager.cpp', 'CShadowVolumeSceneNode.cpp', 'CSkyBoxSceneNode.cpp', 'CSkyDomeSceneNode.cpp', 'CTerrainSceneNode.cpp', 'CTerrainTriangleSelector.cpp', 'CVolumeLightSceneNode.cpp', 'CCubeSceneNode.cpp', 'CSphereSceneNode.cpp', 'CTextSceneNode.cpp', 'CTriangleBBSelector.cpp', 'CTriangleSelector.cpp', 'CWaterSurfaceSceneNode.cpp', 'CMeshCache.cpp', 'CDefaultSceneNodeAnimatorFactory.cpp', 'CDefaultSceneNodeFactory.cpp'];
IRRPARTICLEOBJ = ['CParticleAnimatedMeshSceneNodeEmitter.cpp', 'CParticleBoxEmitter.cpp', 'CParticleCylinderEmitter.cpp', 'CParticleMeshEmitter.cpp', 'CParticlePointEmitter.cpp', 'CParticleRingEmitter.cpp', 'CParticleSphereEmitter.cpp', 'CParticleAttractionAffector.cpp', 'CParticleFadeOutAffector.cpp', 'CParticleGravityAffector.cpp', 'CParticleRotationAffector.cpp', 'CParticleSystemSceneNode.cpp', 'CParticleScaleAffector.cpp'];

21
tests/color.cpp Normal file
View File

@ -0,0 +1,21 @@
#include "testUtils.h"
using namespace irr;
using namespace video;
bool rounding()
{
SColorf colf(0.003922, 0.007843, 0.011765); // test-values by virion which once failed
SColor col = colf.toSColor();
return col.getRed() == 1 && col.getGreen() == 2 && col.getBlue() == 3;
}
//! Test SColor and SColorf
bool color(void)
{
bool ok = true;
ok &= rounding();
return ok;
}

View File

@ -66,6 +66,7 @@ int main(int argumentCount, char * arguments[])
TEST(testQuaternion);
TEST(testS3DVertex);
TEST(testaabbox3d);
TEST(color);
// TODO: Needs to be fixed first
// TEST(testTriangle3d);
TEST(vectorPositionDimension2d);