From 5bc1bdc13eb62322364a5c13971945d2bc1569b1 Mon Sep 17 00:00:00 2001 From: hybrid Date: Wed, 30 Jan 2008 00:07:52 +0000 Subject: [PATCH] Merged from 1.4 branch revisions 1198:1217 git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1218 dfc29bdd-3216-0410-991c-e03cc46cb475 --- changes.txt | 47 +- include/EGUIElementTypes.h | 2 + include/EMeshWriterEnums.h | 2 + include/ISceneManager.h | 15 +- include/dimension2d.h | 5 + source/Irrlicht/CNullDriver.cpp | 12 +- source/Irrlicht/COpenGLDriver.cpp | 2 + .../CSceneNodeAnimatorFollowSpline.cpp | 10 +- source/Irrlicht/CTerrainSceneNode.cpp | 2 +- source/Irrlicht/CXMeshFileLoader.cpp | 4 +- source/Irrlicht/Irrlicht_Win32-gcc.cbp | 1158 ++++++++++++++--- 11 files changed, 1044 insertions(+), 215 deletions(-) diff --git a/changes.txt b/changes.txt index 75796a3e..cc349e75 100644 --- a/changes.txt +++ b/changes.txt @@ -1,4 +1,3 @@ -------------------------------------------- Changes in version 1.5 (... 2008) - Added volume light scene node @@ -43,9 +42,52 @@ Changes in version 1.5 (... 2008) - Modal screens no longer flash invisible children when rejecting a focus change. - Finally added StarSonata patch with table element and TabControl additions. Table is based on MultiColor listbox by Acki, and has loads of changes by CuteAlien. +------------------------------------------- +Changes in version 1.4.1 (??? 2008) + + - Fixed the FollowSpline animator to avoid crashes when only one waypoint is given. + + - OpenGL VolumeShadow now uses glPolygonOffset to avoid zbuffer artifacts. + + - Fixed meshbuffer corruption in append methods. + + - Fixed mem leaks in irrArray. + + - Fixed minor bugs in ISceneNode and ISceneManager. + + - Fixed the MeshCache handling of GeometryCreator meshes. + + - Terrain LOD bugfix. + + - Some Collada 1.3 loader enhancements and bug fixes. + + - Fixed a bug in CGUISpriteBank which caused a crash when a non-looping animated sprite reached the end of its animation. + + - Enhanced the .obj loader with the patch from ryanclark. This allows for recalculation of smoothed normals of the mesh, also should decrease the tri count on some meshes. + + - Avoid the global Logger to be destroyed too early. + + - Function setbit was renamed to setbit_cond to avoid name clashes. + + - Fixed .x animations with multiple references to the same joint from different meshes. + + - Support for Milkshape 1.8 files, also with multiple weights per joint. + + - The config file now also supports _IRR_OSX_PLATFORM_ and _IRR_USE_OSX_DEVICE_. This allows to use the Linux device (X11 support) on OSX. + + - Avoid terrain scene node crash when heightmap cannot be loaded. + + - Speed improvements for WaterSceneNode. + + - FlyCircle animator now also works for upvectors (Direction parameter) which are not (0,1,0). Is also faster now, since most calculations are done on init. Thanks to Dorth for working on this. + + - The 3ds loader correctly creates a texture matrix when texture tiling properties are found in the file. + + - Fix for S3DVertex comparison operators. Used some wrong logic. + + - Bugfix getCurrentRenderTargetSize in D3D drivers. Due to signature differences a wrong virtual method was chosen. Thanks to Jiang for finding it. ------------------------------------------- - Changes in version 1.4 (30.11.2007) - Major API change: All material properties which are available per texture layer (curently texture, texture matrix, texture filters, and texture wrap mode) are separated into a new struct SMaterialLayer. You can access them via the array TextureLayer[] in SMaterial. The texture matrix methods in SMaterial are still alive, and also textures can be accessed via methods in SMaterial now. But still, many places in user code need some update (usually changing material.Textures[i] to material.TextureLayer[i].Texture etc.) @@ -431,7 +473,6 @@ GUI Editor: - Added CGUIPanel, a container with optional scrollbars. Originally submitted by Asger Feldthaus - ------------------------------------------- Changes in version 1.3 (15 Mar 2007) diff --git a/include/EGUIElementTypes.h b/include/EGUIElementTypes.h index 39e3b386..8277b40e 100644 --- a/include/EGUIElementTypes.h +++ b/include/EGUIElementTypes.h @@ -5,6 +5,8 @@ #ifndef __E_GUI_ELEMENT_TYPES_H_INCLUDED__ #define __E_GUI_ELEMENT_TYPES_H_INCLUDED__ +#include "irrTypes.h" + namespace irr { namespace gui diff --git a/include/EMeshWriterEnums.h b/include/EMeshWriterEnums.h index 8028ff48..047fd71c 100644 --- a/include/EMeshWriterEnums.h +++ b/include/EMeshWriterEnums.h @@ -5,6 +5,8 @@ #ifndef __E_MESH_WRITER_ENUMS_H_INCLUDED__ #define __E_MESH_WRITER_ENUMS_H_INCLUDED__ +#include "irrTypes.h" + namespace irr { namespace scene diff --git a/include/ISceneManager.h b/include/ISceneManager.h index 0880082a..cc4bc649 100644 --- a/include/ISceneManager.h +++ b/include/ISceneManager.h @@ -998,11 +998,10 @@ namespace scene //! Creates a follow spline animator. /** The animator modifies the position of the attached scene node to make it follow a hermite spline. - The code of the is based on a scene node - Matthias Gall sent in. Thanks! I adapted the code just a little bit. Matthias - wrote: - Uses a subset of hermite splines: either cardinal splines (tightness != 0.5) or catmull-rom-splines (tightness == 0.5) - but this is just my understanding of this stuff, I'm not a mathematician, so this might be wrong ;) */ + It uses a subset of hermite splines: either cardinal splines + (tightness != 0.5) or catmull-rom-splines (tightness == 0.5). + The animator moves from one control point to the next in + 1/speed seconds. This code was sent in by Matthias Gall. */ virtual ISceneNodeAnimator* createFollowSplineAnimator(s32 startTime, const core::array< core::vector3df >& points, f32 speed = 1.0f, f32 tightness = 0.5f) = 0; @@ -1208,7 +1207,7 @@ namespace scene //! Loads a scene. Note that the current scene is not cleared before. /** The scene is usually load from an .irr file, an xml based format. .irr files can Be edited with the Irrlicht Engine Editor, irrEdit (http://irredit.irrlicht3d.org) or - saved directly by the engine using ISceneManager::saveScene(). + saved directly by the engine using ISceneManager::saveScene(). \param filename: Name of the file. \param userDataSerializer: If you want to load user data possibily saved in that file for some scene nodes in the file, implement the ISceneUserDataSerializer interface and provide it as parameter here. @@ -1219,13 +1218,13 @@ namespace scene //! Loads a scene. Note that the current scene is not cleared before. /** The scene is usually load from an .irr file, an xml based format. .irr files can Be edited with the Irrlicht Engine Editor, irrEdit (http://irredit.irrlicht3d.org) or - saved directly by the engine using ISceneManager::saveScene(). + saved directly by the engine using ISceneManager::saveScene(). \param file: File where the scene is going to be saved into. \param userDataSerializer: If you want to load user data possibily saved in that file for some scene nodes in the file, implement the ISceneUserDataSerializer interface and provide it as parameter here. Otherwise, simply specify 0 as this parameter. \return Returns true if successful. */ - virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0) = 0; + virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0) = 0; //! Returns a mesh writer implementation if available /** Note: You need to drop() the pointer after use again, see IReferenceCounted::drop() diff --git a/include/dimension2d.h b/include/dimension2d.h index 977685c2..59300e2e 100644 --- a/include/dimension2d.h +++ b/include/dimension2d.h @@ -63,6 +63,11 @@ namespace core return dimension2d(Width*scale, Height*scale); } + T getArea() const + { + return Width*Height; + } + T Width, Height; }; diff --git a/source/Irrlicht/CNullDriver.cpp b/source/Irrlicht/CNullDriver.cpp index 814845e2..e1719f6c 100644 --- a/source/Irrlicht/CNullDriver.cpp +++ b/source/Irrlicht/CNullDriver.cpp @@ -324,21 +324,18 @@ ITexture* CNullDriver::getTexture(const c8* filename) addTexture(texture); texture->drop(); // drop it because we created it, one grab too much } + else + os::Printer::log("Could not load texture", filename, ELL_ERROR); + return texture; } else { os::Printer::log("Could not open file of texture", filename, ELL_WARNING); - return texture; + return 0; } - - if (!texture) - os::Printer::log("Could not load texture", filename, ELL_WARNING); - - return texture; } - //! loads a Texture ITexture* CNullDriver::getTexture(io::IReadFile* file) { @@ -367,7 +364,6 @@ ITexture* CNullDriver::getTexture(io::IReadFile* file) } - //! opens the file and loads it into the surface video::ITexture* CNullDriver::loadTextureFromFile(io::IReadFile* file, const c8 *hashName ) { diff --git a/source/Irrlicht/COpenGLDriver.cpp b/source/Irrlicht/COpenGLDriver.cpp index c2dde8bb..ecaf7423 100644 --- a/source/Irrlicht/COpenGLDriver.cpp +++ b/source/Irrlicht/COpenGLDriver.cpp @@ -2068,6 +2068,8 @@ void COpenGLDriver::drawStencilShadowVolume(const core::vector3df* triangles, s3 glDepthMask(GL_FALSE); // no depth buffer writing glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE ); // no color buffer drawing glEnable(GL_STENCIL_TEST); + glEnable(GL_POLYGON_OFFSET_FILL); + glPolygonOffset(0.0f, 1.0f); glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(3,GL_FLOAT,sizeof(core::vector3df),&triangles[0]); diff --git a/source/Irrlicht/CSceneNodeAnimatorFollowSpline.cpp b/source/Irrlicht/CSceneNodeAnimatorFollowSpline.cpp index ebd3f4f5..bc13247c 100644 --- a/source/Irrlicht/CSceneNodeAnimatorFollowSpline.cpp +++ b/source/Irrlicht/CSceneNodeAnimatorFollowSpline.cpp @@ -21,7 +21,6 @@ CSceneNodeAnimatorFollowSpline::CSceneNodeAnimatorFollowSpline(u32 time, } - inline s32 CSceneNodeAnimatorFollowSpline::clamp(s32 idx, s32 size) { return ( idx<0 ? size+idx : ( idx>=size ? idx-size : idx ) ); @@ -34,6 +33,11 @@ void CSceneNodeAnimatorFollowSpline::animateNode(ISceneNode* node, u32 timeMs) const u32 pSize = Points.size(); if (pSize==0) return; + if (pSize==1) + { + node->setPosition(Points[0]); + return; + } const f32 dt = ( (timeMs-StartTime) * Speed * 0.001f ); const f32 u = core::fract ( dt ); @@ -41,8 +45,8 @@ void CSceneNodeAnimatorFollowSpline::animateNode(ISceneNode* node, u32 timeMs) //const f32 u = 0.001f * fmodf( dt, 1000.0f ); const core::vector3df& p0 = Points[ clamp( idx - 1, pSize ) ]; - const core::vector3df& p1 = Points[ clamp( idx + 0, pSize ) ]; - const core::vector3df& p2 = Points[ clamp( idx + 1, pSize ) ]; + const core::vector3df& p1 = Points[ clamp( idx + 0, pSize ) ]; // starting point + const core::vector3df& p2 = Points[ clamp( idx + 1, pSize ) ]; // end point const core::vector3df& p3 = Points[ clamp( idx + 2, pSize ) ]; // hermite polynomials diff --git a/source/Irrlicht/CTerrainSceneNode.cpp b/source/Irrlicht/CTerrainSceneNode.cpp index e5fe7aa9..6f36db95 100644 --- a/source/Irrlicht/CTerrainSceneNode.cpp +++ b/source/Irrlicht/CTerrainSceneNode.cpp @@ -1151,7 +1151,7 @@ namespace scene s32 X(core::floor32( pos.X )); s32 Z(core::floor32( pos.Z )); - if( X >= 0 && X < TerrainData.Size && Z >= 0 && Z <= TerrainData.Size ) + if( X >= 0 && X < TerrainData.Size && Z >= 0 && Z < TerrainData.Size ) { const video::S3DVertex2TCoords* Vertices = (const video::S3DVertex2TCoords*)Mesh.getMeshBuffer( 0 )->getVertices(); const core::vector3df& a = Vertices[ X * TerrainData.Size + Z ].Pos; diff --git a/source/Irrlicht/CXMeshFileLoader.cpp b/source/Irrlicht/CXMeshFileLoader.cpp index 3a652536..6f177f4d 100644 --- a/source/Irrlicht/CXMeshFileLoader.cpp +++ b/source/Irrlicht/CXMeshFileLoader.cpp @@ -1256,7 +1256,7 @@ bool CXMeshFileLoader::parseDataObjectMaterial(video::SMaterial& material) return false; // original name - SceneManager->getVideoDriver()->getTexture ( TextureFileName.c_str() ); + material.setTexture(0, SceneManager->getVideoDriver()->getTexture ( TextureFileName.c_str() )); // mesh path if (!material.getTexture(0)) { @@ -1265,7 +1265,7 @@ bool CXMeshFileLoader::parseDataObjectMaterial(video::SMaterial& material) } // working directory if (!material.getTexture(0)) - SceneManager->getVideoDriver()->getTexture ( stripPathFromString(TextureFileName,false).c_str() ); + material.setTexture(0, SceneManager->getVideoDriver()->getTexture ( stripPathFromString(TextureFileName,false).c_str() )); } else { diff --git a/source/Irrlicht/Irrlicht_Win32-gcc.cbp b/source/Irrlicht/Irrlicht_Win32-gcc.cbp index db6e9c91..e453436d 100644 --- a/source/Irrlicht/Irrlicht_Win32-gcc.cbp +++ b/source/Irrlicht/Irrlicht_Win32-gcc.cbp @@ -1,6 +1,6 @@ - +