From 51e6ac4493334c7625843694efdab1fdb3d2de88 Mon Sep 17 00:00:00 2001 From: cutealien Date: Wed, 8 Jan 2014 00:00:33 +0000 Subject: [PATCH] Merge r4616-4617 from trunk: Merged updates from 1.8.1 release to trunk, revisions 4579-4615. git-svn-id: http://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@4650 dfc29bdd-3216-0410-991c-e03cc46cb475 --- changes.txt | 14 ++++++++++++-- examples/16.Quake3MapShader/main.cpp | 3 ++- examples/21.Quake3Explorer/main.cpp | 10 ++++++++++ include/IrrCompileConfig.h | 14 ++++++++++++++ include/irrMath.h | 2 +- include/quaternion.h | 2 +- readme.txt | 9 ++++----- source/Irrlicht/CIrrDeviceSDL.cpp | 2 +- source/Irrlicht/COpenGLDriver.cpp | 4 ++++ source/Irrlicht/COpenGLExtensionHandler.h | 6 +++--- source/Irrlicht/COpenGLSLMaterialRenderer.cpp | 19 +++++-------------- source/Irrlicht/CSceneManager.cpp | 19 ++++++++++++------- source/Irrlicht/CSceneManager.h | 1 + source/Irrlicht/MacOSX/CIrrDeviceMacOSX.h | 14 ++++---------- source/Irrlicht/MacOSX/CIrrDeviceMacOSX.mm | 2 +- .../MacOSX/MacOSX.xcodeproj/project.pbxproj | 7 +------ 16 files changed, 76 insertions(+), 52 deletions(-) diff --git a/changes.txt b/changes.txt index e3745cab..1b66efb1 100644 --- a/changes.txt +++ b/changes.txt @@ -31,13 +31,23 @@ Changes in 1.9 (not yet released) - Add getters IGUIButton::isDrawBorderEnabled and IGUIButton::isDrawBackgroundEnabled -------------------------- -Changes in 1.8.1 (not yet released) +Changes in 1.8.1 (17.11.2013) + - Improved OpenGL performance under OSX (Thanks devonsoft for reporting). + - Fixed OSX compilation issues. + - [KNOWN BUG] Software driver doesn't work properly under OSX 10.9. + - For speed improvement the following attributes accessible by ISceneManager::getParameters() are no longer updated in release: + "culled", "calls", "drawn_solid", "drawn_transparent", "drawn_transparent_effect". + They can be enabled by compiling Irrlicht with the define _IRR_SCENEMANAGER_DEBUG. + Thanks @hendu for reporting, see http://irrlicht.sourceforge.net/forum/viewtopic.php?f=2&t=48211 for the discussion. + - Fix compile problem with CIrrDeviceSDL on VS2008 (and maybe other systems). Thanks @HellFlip for reporting. + - Fix quaternion::rotationFromTo() (Thanks @takamoto for reporting) + - Fix iszero for s64 (Thanks @chronologicaldot for reporting) - Fix crash in SoftwareDriver2 when Material was EMT_DETAIL_MAP but texture[1] was not set (Thanks for fix by chronologicaldot) - Fix buffer overrun in x-loader (Thanks for fix by Otaka) - Fix cursor visibility update problem under Windows 8 (Thanks @luthyr for reporting) - Fix irredit links in loadScene/saveScene docs. - - Fix issue in CAnimatedMeshSceneNode::clone which cause crash. (reported and fixed by luthyr) + - Fix issue in CAnimatedMeshSceneNode::clone which caused a crash. (reported and fixed by luthyr) - Fix compiling errors for c++ builder (thx @Greatwolf for many patches and @cfanderek for reminding) - Initialized IColladaMeshWriter::GeometryWriting which was uninitialized. - Fix linker trouble with irr::core::equalsByUl when compiling Irrlicht as managed code (thx @ Memorial76 for a report + testcase) diff --git a/examples/16.Quake3MapShader/main.cpp b/examples/16.Quake3MapShader/main.cpp index 1e5d55ee..63917053 100644 --- a/examples/16.Quake3MapShader/main.cpp +++ b/examples/16.Quake3MapShader/main.cpp @@ -360,6 +360,7 @@ int IRRCALLCONV main(int argc, char* argv[]) str += driver->getName(); str += "] FPS:"; str += fps; +#ifdef _IRR_SCENEMANAGER_DEBUG str += " Cull:"; str += attr->getAttributeAsInt("calls"); str += "/"; @@ -370,7 +371,7 @@ int IRRCALLCONV main(int argc, char* argv[]) str += attr->getAttributeAsInt("drawn_transparent"); str += "/"; str += attr->getAttributeAsInt("drawn_transparent_effect"); - +#endif device->setWindowCaption(str.c_str()); lastFPS = fps; } diff --git a/examples/21.Quake3Explorer/main.cpp b/examples/21.Quake3Explorer/main.cpp index 4b5a4209..822611b2 100644 --- a/examples/21.Quake3Explorer/main.cpp +++ b/examples/21.Quake3Explorer/main.cpp @@ -2028,6 +2028,7 @@ void CQuake3EventHandler::Animate() IVideoDriver * driver = Game->Device->getVideoDriver(); IAttributes * attr = smgr->getParameters(); +#ifdef _IRR_SCENEMANAGER_DEBUG swprintf ( msg, 128, L"Q3 %s [%ls], FPS:%03d Tri:%.03fm Cull %d/%d nodes (%d,%d,%d)", Game->CurrentMapName.c_str(), @@ -2040,6 +2041,15 @@ void CQuake3EventHandler::Animate() attr->getAttributeAsInt ( "drawn_transparent" ), attr->getAttributeAsInt ( "drawn_transparent_effect" ) ); +#else +swprintf ( msg, 128, + L"Q3 %s [%ls], FPS:%03d Tri:%.03fm", + Game->CurrentMapName.c_str(), + driver->getName(), + driver->getFPS (), + (f32) driver->getPrimitiveCountDrawn( 0 ) * ( 1.f / 1000000.f ) + ); +#endif Game->Device->setWindowCaption( msg ); swprintf ( msg, 128, diff --git a/include/IrrCompileConfig.h b/include/IrrCompileConfig.h index 6d415af9..c72181cd 100644 --- a/include/IrrCompileConfig.h +++ b/include/IrrCompileConfig.h @@ -935,5 +935,19 @@ precision will be lower but speed higher. currently X86 only #endif #endif +#ifdef _DEBUG + //! A few attributes are written in CSceneManager when _IRR_SCENEMANAGER_DEBUG is enabled + // NOTE: Those attributes were used always until 1.8.0 and became a global define for 1.8.1 + // which is only enabled in debug because it had a large (sometimes >5%) impact on speed. + // A better solution in the long run is to break the interface and remove _all_ attribute + // access in functions like CSceneManager::drawAll and instead put that information in some + // own struct/class or in CSceneManager. + // See http://irrlicht.sourceforge.net/forum/viewtopic.php?f=2&t=48211 for the discussion. + #define _IRR_SCENEMANAGER_DEBUG + #ifdef NO_IRR_SCENEMANAGER_DEBUG + #undef _IRR_SCENEMANAGER_DEBUG + #endif +#endif + #endif // __IRR_COMPILE_CONFIG_H_INCLUDED__ diff --git a/include/irrMath.h b/include/irrMath.h index fec97cb0..ccebcefc 100644 --- a/include/irrMath.h +++ b/include/irrMath.h @@ -300,7 +300,7 @@ namespace core //! returns if a equals zero, taking rounding errors into account inline bool iszero(const s64 a, const s64 tolerance = 0) { - return abs_(a) > tolerance; + return abs_(a) <= tolerance; } #endif diff --git a/include/quaternion.h b/include/quaternion.h index 6204c1ca..a7392c70 100644 --- a/include/quaternion.h +++ b/include/quaternion.h @@ -676,7 +676,7 @@ inline core::quaternion& quaternion::rotationFromTo(const vector3df& from, const if (axis.getLength()==0) { axis.set(0.f,1.f,0.f); - axis.crossProduct(v0); + axis = axis.crossProduct(v0); } // same as fromAngleAxis(core::PI, axis).normalize(); return set(axis.X, axis.Y, axis.Z, 0).normalize(); diff --git a/readme.txt b/readme.txt index 5c1610e1..5ee9fbe6 100644 --- a/readme.txt +++ b/readme.txt @@ -54,11 +54,10 @@ The Irrlicht Engine SDK version 1.9 easily comprehensible. The Irrlicht Engine is a static lib under linux. A precompiled version can be - generated from the sources using the Makefile in source/Irrlicht. Unzip the - file source.zip in the /source directory. Run 'make' in the newly created - 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. + generated from the sources using the Makefile in source/Irrlicht. Run 'make' in + that subfolder. After this you should be able to 'make' all + example applications in /examples by calling the buildAllExamples script. You + can run the examples then from the bin folder. It is also possible to use Irrlicht as shared object (libIrrlicht.so.versionNumber). Use the proper makefile target for this by diff --git a/source/Irrlicht/CIrrDeviceSDL.cpp b/source/Irrlicht/CIrrDeviceSDL.cpp index e64d28aa..3a0a2561 100644 --- a/source/Irrlicht/CIrrDeviceSDL.cpp +++ b/source/Irrlicht/CIrrDeviceSDL.cpp @@ -478,7 +478,7 @@ bool CIrrDeviceSDL::run() joyevent.JoystickEvent.ButtonStates |= (SDL_JoystickGetButton(joystick, j)< #endif diff --git a/source/Irrlicht/COpenGLExtensionHandler.h b/source/Irrlicht/COpenGLExtensionHandler.h index 4d8ba9a2..25722e73 100644 --- a/source/Irrlicht/COpenGLExtensionHandler.h +++ b/source/Irrlicht/COpenGLExtensionHandler.h @@ -1227,7 +1227,7 @@ class COpenGLExtensionHandler void extGlDisableIndexed(GLenum target, GLuint index); void extGlBlendFuncIndexed(GLuint buf, GLenum src, GLenum dst); void extGlBlendEquationIndexed(GLuint buf, GLenum mode); - void extGlProgramParameteri(GLhandleARB program, GLenum pname, GLint value); + void extGlProgramParameteri(GLuint program, GLenum pname, GLint value); // occlusion query void extGlGenQueries(GLsizei n, GLuint *ids); @@ -2527,7 +2527,7 @@ inline void COpenGLExtensionHandler::extGlBlendEquationIndexed(GLuint buf, GLenu #endif } -inline void COpenGLExtensionHandler::extGlProgramParameteri(GLhandleARB program, GLenum pname, GLint value) +inline void COpenGLExtensionHandler::extGlProgramParameteri(GLuint program, GLenum pname, GLint value) { #if defined(_IRR_OPENGL_USE_EXTPOINTER_) if (queryFeature(EVDF_GEOMETRY_SHADER)) @@ -2540,7 +2540,7 @@ inline void COpenGLExtensionHandler::extGlProgramParameteri(GLhandleARB program, #elif defined(GL_ARB_geometry_shader4) glProgramParameteriARB(program, pname, value); #elif defined(GL_EXT_geometry_shader4) - glProgramParameteriEXT((long unsigned int)program, pname, value); + glProgramParameteriEXT(program, pname, value); #elif defined(GL_NV_geometry_program4) || defined(GL_NV_geometry_shader4) glProgramParameteriNV(program, pname, value); #else diff --git a/source/Irrlicht/COpenGLSLMaterialRenderer.cpp b/source/Irrlicht/COpenGLSLMaterialRenderer.cpp index 8e8787ee..3dbdb784 100644 --- a/source/Irrlicht/COpenGLSLMaterialRenderer.cpp +++ b/source/Irrlicht/COpenGLSLMaterialRenderer.cpp @@ -163,23 +163,14 @@ void COpenGLSLMaterialRenderer::init(s32& outMaterialTypeNr, if (!createShader(GL_GEOMETRY_SHADER_EXT, geometryShaderProgram)) return; #if defined(GL_ARB_geometry_shader4) || defined(GL_EXT_geometry_shader4) || defined(GL_NV_geometry_shader4) - if (Program2) + if (Program2) // Geometry shaders are supported only in OGL2.x+ drivers. { - Driver->extGlProgramParameteri((GLhandleARB)Program2, GL_GEOMETRY_INPUT_TYPE_EXT, Driver->primitiveTypeToGL(inType)); - Driver->extGlProgramParameteri((GLhandleARB)Program2, GL_GEOMETRY_OUTPUT_TYPE_EXT, Driver->primitiveTypeToGL(outType)); + Driver->extGlProgramParameteri(Program2, GL_GEOMETRY_INPUT_TYPE_EXT, Driver->primitiveTypeToGL(inType)); + Driver->extGlProgramParameteri(Program2, GL_GEOMETRY_OUTPUT_TYPE_EXT, Driver->primitiveTypeToGL(outType)); if (verticesOut==0) - Driver->extGlProgramParameteri((GLhandleARB)Program2, GL_GEOMETRY_VERTICES_OUT_EXT, Driver->MaxGeometryVerticesOut); + Driver->extGlProgramParameteri(Program2, GL_GEOMETRY_VERTICES_OUT_EXT, Driver->MaxGeometryVerticesOut); else - Driver->extGlProgramParameteri((GLhandleARB)Program2, GL_GEOMETRY_VERTICES_OUT_EXT, core::min_(verticesOut, Driver->MaxGeometryVerticesOut)); - } - else - { - Driver->extGlProgramParameteri(Program, GL_GEOMETRY_INPUT_TYPE_EXT, Driver->primitiveTypeToGL(inType)); - Driver->extGlProgramParameteri(Program, GL_GEOMETRY_OUTPUT_TYPE_EXT, Driver->primitiveTypeToGL(outType)); - if (verticesOut==0) - Driver->extGlProgramParameteri(Program, GL_GEOMETRY_VERTICES_OUT_EXT, Driver->MaxGeometryVerticesOut); - else - Driver->extGlProgramParameteri(Program, GL_GEOMETRY_VERTICES_OUT_EXT, core::min_(verticesOut, Driver->MaxGeometryVerticesOut)); + Driver->extGlProgramParameteri(Program2, GL_GEOMETRY_VERTICES_OUT_EXT, core::min_(verticesOut, Driver->MaxGeometryVerticesOut)); } #elif defined(GL_NV_geometry_program4) if (verticesOut==0) diff --git a/source/Irrlicht/CSceneManager.cpp b/source/Irrlicht/CSceneManager.cpp index 01963b6a..62207d70 100644 --- a/source/Irrlicht/CSceneManager.cpp +++ b/source/Irrlicht/CSceneManager.cpp @@ -173,9 +173,6 @@ #include "CGeometryCreator.h" -//! Enable debug features -#define SCENEMANAGER_DEBUG - namespace irr { namespace scene @@ -1329,7 +1326,7 @@ u32 CSceneManager::registerNodeForRendering(ISceneNode* node, E_SCENE_NODE_RENDE break; } -#ifdef SCENEMANAGER_DEBUG +#ifdef _IRR_SCENEMANAGER_DEBUG s32 index = Parameters->findAttribute("calls"); Parameters->setAttribute(index, Parameters->getAttributeAsInt(index)+1); @@ -1351,12 +1348,14 @@ void CSceneManager::drawAll() if (!Driver) return; +#ifdef _IRR_SCENEMANAGER_DEBUG // reset attributes Parameters->setAttribute("culled", 0); Parameters->setAttribute("calls", 0); Parameters->setAttribute("drawn_solid", 0); Parameters->setAttribute("drawn_transparent", 0); Parameters->setAttribute("drawn_transparent_effect", 0); +#endif u32 i; // new ISO for scoping problem in some compilers @@ -1367,6 +1366,7 @@ void CSceneManager::drawAll() Driver->setTransform ( video::ETS_WORLD, core::IdentityMatrix ); for (i=video::ETS_COUNT-1; i>=video::ETS_TEXTURE_0; --i) Driver->setTransform ( (video::E_TRANSFORMATION_STATE)i, core::IdentityMatrix ); + // TODO: This should not use an attribute here but a real parameter when necessary (too slow!) Driver->setAllowZWriteOnTransparent(Parameters->getAttributeAsBool(ALLOW_ZWRITE_ON_TRANSPARENT)); // do animations and other stuff. @@ -1503,7 +1503,9 @@ void CSceneManager::drawAll() SolidNodeList[i].Node->render(); } - Parameters->setAttribute("drawn_solid", (s32) SolidNodeList.size()); +#ifdef _IRR_SCENEMANAGER_DEBUG + Parameters->setAttribute("drawn_solid", (s32) SolidNodeList.size() ); +#endif SolidNodeList.set_used(0); if (LightManager) @@ -1566,7 +1568,9 @@ void CSceneManager::drawAll() TransparentNodeList[i].Node->render(); } - Parameters->setAttribute("drawn_transparent", (s32) TransparentNodeList.size()); +#ifdef _IRR_SCENEMANAGER_DEBUG + Parameters->setAttribute ( "drawn_transparent", (s32) TransparentNodeList.size() ); +#endif TransparentNodeList.set_used(0); if (LightManager) @@ -1597,8 +1601,9 @@ void CSceneManager::drawAll() for (i=0; irender(); } - +#ifdef _IRR_SCENEMANAGER_DEBUG Parameters->setAttribute("drawn_transparent_effect", (s32) TransparentEffectNodeList.size()); +#endif TransparentEffectNodeList.set_used(0); } diff --git a/source/Irrlicht/CSceneManager.h b/source/Irrlicht/CSceneManager.h index 6d91b8e7..00903f63 100644 --- a/source/Irrlicht/CSceneManager.h +++ b/source/Irrlicht/CSceneManager.h @@ -632,6 +632,7 @@ namespace scene video::SColorf AmbientLight; //! String parameters + // NOTE: Attributes are slow and should only be used for debug-info and not in release io::CAttributes* Parameters; //! Mesh cache diff --git a/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.h b/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.h index 24a6e8b7..d13103fb 100644 --- a/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.h +++ b/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.h @@ -10,6 +10,10 @@ #ifdef _IRR_COMPILE_WITH_OSX_DEVICE_ +#import +#import +#import + #include "CIrrDeviceStub.h" #include "IrrlichtDevice.h" #include "IImagePresenter.h" @@ -19,16 +23,6 @@ #include #include -#ifdef __MAC_10_6 -@class NSWindow; -@class NSOpenGLContext; -@class NSBitmapImageRep; -#else -class NSWindow; -class NSOpenGLContext; -class NSBitmapImageRep; -#endif - namespace irr { class CIrrDeviceMacOSX : public CIrrDeviceStub, video::IImagePresenter diff --git a/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.mm b/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.mm index 9c05e619..be6b9dc2 100644 --- a/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.mm +++ b/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.mm @@ -506,7 +506,7 @@ CIrrDeviceMacOSX::CIrrDeviceMacOSX(const SIrrlichtCreationParameters& param) chdir([path fileSystemRepresentation]); [path release]; } - + NSWindow* a; uname(&name); Operator = new COSOperator(name.version); os::Printer::log(name.version,ELL_INFORMATION); diff --git a/source/Irrlicht/MacOSX/MacOSX.xcodeproj/project.pbxproj b/source/Irrlicht/MacOSX/MacOSX.xcodeproj/project.pbxproj index df7751bf..685abe00 100644 --- a/source/Irrlicht/MacOSX/MacOSX.xcodeproj/project.pbxproj +++ b/source/Irrlicht/MacOSX/MacOSX.xcodeproj/project.pbxproj @@ -4383,11 +4383,11 @@ 0867D690FE84028FC02AAC07 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0450; }; buildConfigurationList = 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "MacOSX" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; + developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( English, @@ -6054,7 +6054,6 @@ 1DEB921F08733DC00010E9CD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(NATIVE_ARCH_ACTUAL)"; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; @@ -6064,8 +6063,6 @@ GCC_PREFIX_HEADER = MacOSX_Prefix.pch; INSTALL_PATH = /usr/local/lib; PRODUCT_NAME = Irrlicht; - SHARED_PRECOMPS_DIR = ""; - SYMROOT = build; ZERO_LINK = NO; }; name = Debug; @@ -6073,7 +6070,6 @@ 1DEB922008733DC00010E9CD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(NATIVE_ARCH_ACTUAL)"; COMBINE_HIDPI_IMAGES = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_MODEL_TUNING = G5; @@ -6082,7 +6078,6 @@ INSTALL_PATH = /usr/local/lib; PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; PRODUCT_NAME = Irrlicht; - SHARED_PRECOMPS_DIR = ""; }; name = Release; };