diff --git a/changes.txt b/changes.txt index ae97ea15..7ecf348a 100644 --- a/changes.txt +++ b/changes.txt @@ -6,7 +6,11 @@ Changes in version 1.6 - D3D devices use DISCARD for windowed renderbuffers now, can be faster. - - position2d is now a synonym for vector2d. position2d is therefore marked as deprecated, although it's unlikely to be removed. + - Changed behaviour of PixelBlend16() / PixelBlend16_simd() so that they treat the 1 bit alpha of the source pixel as boolean, i.e. they draw either the source pixel, or the destination pixel, rather than "blending". (Issue revealed by the fix to IVideoDriver::makeColorKeyTexture()). + + - IVideoDriver::makeColorKeyTexture() bug fixed so that only alphas, not whole texel colors, are zeroed. An optional parameter allows using the old (buggy) behaviour for backwards compatibility. + + - position2d is now a synonym for vector2d. position2d is therefore marked as deprecated, although it's unlikely to be removed. - ISceneNodeAnimator now has a hasFinished() method. @@ -17,9 +21,7 @@ Changes in version 1.6 ------------------------------------- Changes in version 1.5.1 (??.?? 2009) - - Changed behaviour of PixelBlend16() / PixelBlend16_simd() so that they treat the 1 bit alpha of the source pixel as boolean, i.e. they draw either the source pixel, or the destination pixel, rather than "blending". (Issue revealed by the fix to IVideoDriver::makeColorKeyTexture()). - - - IVideoDriver::makeColorKeyTexture() bug fixed so that only alphas, not whole texel colors, are zeroed. An optional parameter allows using the old (buggy) behaviour for backwards compatibility. + - OSX device now supports shift and ctrl keys. - MD2 mesh loader: Now uses much less memory, reduced number of allocations when loading meshes. @@ -28,9 +30,9 @@ Changes in version 1.5 (15.12.2008) - Construction calls for FPS camera changed to take speed in units/milliseconds, just as the setSpeed method does. - - Code::Blocks workspaces added. C::B projects (using gcc) now output to /lib/gcc and /bin/gcc, when built on either Windows or Linux. + - Code::Blocks workspaces added. C::B projects (using gcc) now output to /lib/gcc and /bin/gcc, when built on either Windows or Linux. - - Added a test suite in the /tests directory. This can be used to perform regression tests, and should be updated with new tests to verify fixes or validate new features. + - Added a test suite in the /tests directory. This can be used to perform regression tests, and should be updated with new tests to verify fixes or validate new features. - Changed the preferred way of altering light node's radius: Use the new member methods of ILightSceneNode instead of directly modifying the SLight structure. @@ -40,7 +42,7 @@ Changes in version 1.5 (15.12.2008) - Terrain heightmap and texture were flipped in order to draw them as expected (looking onto the terrain from high above will just look like the actual texture/heightmap). - - Significant internal change to the way that FPS camera jump speed and collision response animator gravity interact. The behaviour is now much more realistic, but it will require you to adjust your jump speed and gravity. + - Significant internal change to the way that FPS camera jump speed and collision response animator gravity interact. The behaviour is now much more realistic, but it will require you to adjust your jump speed and gravity. - Skybox won't be culled anymore by nearplane or farplane. @@ -68,7 +70,7 @@ Changes in version 1.5 (15.12.2008) - ISceneNode::setParent and addChild now updates node SceneManager pointers if the node was from another SceneManager. - - Basic support for joystick input events on Windows, Linux, SDL and OSX. Tested with wired Logitech and Thrustmaster wired controllers and XBox 360 wireless controller ( http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/OsxDriver ) + - Basic support for joystick input events on Windows, Linux, SDL and OSX. Tested with wired Logitech and Thrustmaster wired controllers and XBox 360 wireless controller ( http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/OsxDriver ) - Fixed scaled octree nodes being incorrectly frustum culled. diff --git a/examples/09.Meshviewer/main.cpp b/examples/09.Meshviewer/main.cpp index 4df2785e..f2cf7d81 100644 --- a/examples/09.Meshviewer/main.cpp +++ b/examples/09.Meshviewer/main.cpp @@ -758,7 +758,7 @@ int main(int argc, char* argv[]) // create fps text IGUIStaticText* fpstext = env->addStaticText(L"", - core::rect(GUI_ID_TOGGLE_DEBUG_INFO,4,570,23), true, false, bar); + core::rect(400,4,570,23), true, false, bar); IGUIStaticText* postext = env->addStaticText(L"", core::rect(10,50,470,80),false, false, 0, GUI_ID_POSITION_TEXT); diff --git a/source/Irrlicht/CNullDriver.cpp b/source/Irrlicht/CNullDriver.cpp index fd2cd6a7..8cc10d73 100644 --- a/source/Irrlicht/CNullDriver.cpp +++ b/source/Irrlicht/CNullDriver.cpp @@ -1224,7 +1224,6 @@ IImage* CNullDriver::createImageFromFile(io::IReadFile* file) } - //! Writes the provided image to disk file bool CNullDriver::writeImageToFile(IImage* image, const char* filename,u32 param) { @@ -1246,7 +1245,6 @@ bool CNullDriver::writeImageToFile(IImage* image, const char* filename,u32 param } - //! Creates a software image from a byte array. IImage* CNullDriver::createImageFromData(ECOLOR_FORMAT format, const core::dimension2d& size, @@ -1307,6 +1305,7 @@ void CNullDriver::drawMeshBuffer(const scene::IMeshBuffer* mb) drawVertexPrimitiveList(mb->getVertices(), mb->getVertexCount(), mb->getIndices(), mb->getIndexCount()/3, mb->getVertexType(), scene::EPT_TRIANGLES, mb->getIndexType()); } + CNullDriver::SHWBufferLink *CNullDriver::getBufferLink(const scene::IMeshBuffer* mb) { if (!mb || !isHardwareBufferRecommend(mb)) @@ -1314,11 +1313,13 @@ CNullDriver::SHWBufferLink *CNullDriver::getBufferLink(const scene::IMeshBuffer* //search for hardware links core::map< const scene::IMeshBuffer*,SHWBufferLink* >::Node* node = HWBufferMap.find(mb); - if (node) return node->getValue(); + if (node) + return node->getValue(); return createHardwareBuffer(mb); //no hardware links, and mesh wants one, create it } + //! Update all hardware buffers, remove unused ones void CNullDriver::updateAllHardwareBuffers() { @@ -1342,18 +1343,22 @@ void CNullDriver::updateAllHardwareBuffers() void CNullDriver::deleteHardwareBuffer(SHWBufferLink *HWBuffer) { - if (!HWBuffer) return; - HWBufferMap.remove( HWBuffer->MeshBuffer ); + if (!HWBuffer) + return; + HWBufferMap.remove(HWBuffer->MeshBuffer); delete HWBuffer; } + //! Remove hardware buffer void CNullDriver::removeHardwareBuffer(const scene::IMeshBuffer* mb) { core::map::Node* node = HWBufferMap.find(mb); - if (node) deleteHardwareBuffer( node->getValue() ); + if (node) + deleteHardwareBuffer(node->getValue()); } + //! Remove all hardware buffers void CNullDriver::removeAllHardwareBuffers() { @@ -1361,6 +1366,7 @@ void CNullDriver::removeAllHardwareBuffers() deleteHardwareBuffer(HWBufferMap.getRoot()->getValue()); } + bool CNullDriver::isHardwareBufferRecommend(const scene::IMeshBuffer* mb) { if (!mb || (mb->getHardwareMappingHint_Index()==scene::EHM_NEVER && mb->getHardwareMappingHint_Vertex()==scene::EHM_NEVER)) @@ -1372,6 +1378,7 @@ bool CNullDriver::isHardwareBufferRecommend(const scene::IMeshBuffer* mb) return true; } + //! Only used by the internal engine. Used to notify the driver that //! the window was resized. void CNullDriver::OnResize(const core::dimension2d& size) @@ -1383,6 +1390,7 @@ void CNullDriver::OnResize(const core::dimension2d& size) ScreenSize = size; } + // adds a material renderer and drops it afterwards. To be used for internal creation s32 CNullDriver::addAndDropMaterialRenderer(IMaterialRenderer* m) { @@ -1556,6 +1564,7 @@ E_DRIVER_TYPE CNullDriver::getDriverType() const return EDT_NULL; } + //! deletes all material renderers void CNullDriver::deleteMaterialRenders() { @@ -1601,6 +1610,7 @@ IGPUProgrammingServices* CNullDriver::getGPUProgrammingServices() return 0; } + //! Adds a new material renderer to the VideoDriver, based on a high level shading //! language. Currently only HLSL in D3D9 is supported. s32 CNullDriver::addHighLevelShaderMaterial( @@ -1618,6 +1628,7 @@ s32 CNullDriver::addHighLevelShaderMaterial( return -1; } + //! Like IGPUProgrammingServices::addShaderMaterial() (look there for a detailed description), //! but tries to load the programs from files. s32 CNullDriver::addHighLevelShaderMaterialFromFiles( @@ -1672,6 +1683,7 @@ s32 CNullDriver::addHighLevelShaderMaterialFromFiles( return result; } + //! Like IGPUProgrammingServices::addShaderMaterial() (look there for a detailed description), //! but tries to load the programs from files. s32 CNullDriver::addHighLevelShaderMaterialFromFiles( @@ -1724,6 +1736,7 @@ s32 CNullDriver::addHighLevelShaderMaterialFromFiles( return result; } + //! Adds a new material renderer to the VideoDriver, using pixel and/or //! vertex shaders to render geometry. s32 CNullDriver::addShaderMaterial(const c8* vertexShaderProgram, @@ -1736,6 +1749,7 @@ s32 CNullDriver::addShaderMaterial(const c8* vertexShaderProgram, return -1; } + //! Like IGPUProgrammingServices::addShaderMaterial(), but tries to load the //! programs from files. s32 CNullDriver::addShaderMaterialFromFiles(io::IReadFile* vertexShaderProgram, @@ -1778,7 +1792,6 @@ s32 CNullDriver::addShaderMaterialFromFiles(io::IReadFile* vertexShaderProgram, } - //! Like IGPUProgrammingServices::addShaderMaterial(), but tries to load the //! programs from files. s32 CNullDriver::addShaderMaterialFromFiles(const c8* vertexShaderProgramFileName, @@ -1891,6 +1904,7 @@ bool CNullDriver::setClipPlane(u32 index, const core::plane3df& plane, bool enab return false; } + //! Enable/disable a clipping plane. //! There are at least 6 clipping planes available for the user to set at will. //! \param index: The plane index. Must be between 0 and MaxUserClipPlanes. @@ -1912,5 +1926,3 @@ ITexture* CNullDriver::createRenderTargetTexture(const core::dimension2d& s } // end namespace } // end namespace - - diff --git a/source/Irrlicht/COpenGLDriver.cpp b/source/Irrlicht/COpenGLDriver.cpp index 0fdbb8d7..e2831445 100644 --- a/source/Irrlicht/COpenGLDriver.cpp +++ b/source/Irrlicht/COpenGLDriver.cpp @@ -116,7 +116,7 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params) HWND temporary_wnd=CreateWindow(ClassName, "", style, windowLeft, windowTop, realWidth, realHeight, NULL, NULL, lhInstance, NULL); - if(!temporary_wnd) + if (!temporary_wnd) { os::Printer::log("Cannot create a temporary window.", ELL_ERROR); return false; @@ -165,7 +165,7 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params) SetPixelFormat(HDc, PixelFormat, &pfd); HRc=wglCreateContext(HDc); - if(!HRc) + if (!HRc) { os::Printer::log("Cannot create a temporary GL rendering context.", ELL_ERROR); ReleaseDC(temporary_wnd, HDc); @@ -173,7 +173,7 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params) return false; } - if(!wglMakeCurrent(HDc, HRc)) + if (!wglMakeCurrent(HDc, HRc)) { os::Printer::log("Cannot activate a temporary GL rendering context.", ELL_ERROR); wglDeleteContext(HRc); @@ -183,7 +183,7 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params) } PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormat_ARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB"); - if(wglChoosePixelFormat_ARB) + if (wglChoosePixelFormat_ARB) { // This value determines the number of samples used for antialiasing // My experience is that 8 does not show a big @@ -217,12 +217,12 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params) u32 numFormats=0; const s32 valid = wglChoosePixelFormat_ARB(HDc,iAttributes,fAttributes,1,&pixelFormat,&numFormats); - if(valid && numFormats>0) + if (valid && numFormats>0) rv = pixelFormat; else iAttributes[19] -= 1; } - if(rv) + if (rv) { PixelFormat=rv; AntiAlias=iAttributes[19]; @@ -288,7 +288,7 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params) } // set pixel format - if(!SetPixelFormat(HDc, PixelFormat, &pfd)) + if (!SetPixelFormat(HDc, PixelFormat, &pfd)) { os::Printer::log("Cannot set the pixel format.", ELL_ERROR); return false; @@ -303,7 +303,7 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params) } // activate rendering context - if(!wglMakeCurrent(HDc, HRc)) + if (!wglMakeCurrent(HDc, HRc)) { os::Printer::log("Cannot activate GL rendering context", ELL_ERROR); wglDeleteContext(HRc); @@ -507,7 +507,7 @@ bool COpenGLDriver::genericDriverInit(const core::dimension2d& screenSize, glClearDepth(1.0); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glDepthFunc(GL_LEQUAL); - glFrontFace( GL_CW ); + glFrontFace(GL_CW); if (AntiAlias >= 2) { @@ -664,7 +664,7 @@ void COpenGLDriver::setTransform(E_TRANSFORMATION_STATE state, const core::matri Matrices[state] = mat; Transformation3DChanged = true; - switch(state) + switch (state) { case ETS_VIEW: case ETS_WORLD: @@ -719,6 +719,7 @@ void COpenGLDriver::setTransform(E_TRANSFORMATION_STATE state, const core::matri } } + bool COpenGLDriver::updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer) { if (!HWBuffer) @@ -782,7 +783,8 @@ bool COpenGLDriver::updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer) if (!HWBuffer->vbo_verticesID) { extGlGenBuffers(1, &HWBuffer->vbo_verticesID); - if (!HWBuffer->vbo_verticesID) return false; + if (!HWBuffer->vbo_verticesID) + return false; newBuffer=true; } else if (HWBuffer->vbo_verticesSize < vertexCount*vertexSize) @@ -790,7 +792,7 @@ bool COpenGLDriver::updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer) newBuffer=true; } - extGlBindBuffer(GL_ARRAY_BUFFER, HWBuffer->vbo_verticesID ); + extGlBindBuffer(GL_ARRAY_BUFFER, HWBuffer->vbo_verticesID); //copy data to graphics card glGetError(); // clear error storage @@ -822,7 +824,7 @@ bool COpenGLDriver::updateIndexHardwareBuffer(SHWBufferLink_opengl *HWBuffer) if (!HWBuffer) return false; - if(!FeatureAvailable[IRR_ARB_vertex_buffer_object]) + if (!FeatureAvailable[IRR_ARB_vertex_buffer_object]) return false; #if defined(GL_ARB_vertex_buffer_object) @@ -834,12 +836,12 @@ bool COpenGLDriver::updateIndexHardwareBuffer(SHWBufferLink_opengl *HWBuffer) GLenum indexSize; switch (mb->getIndexType()) { - case (EIT_16BIT): + case EIT_16BIT: { indexSize=sizeof(u16); break; } - case (EIT_32BIT): + case EIT_32BIT: { indexSize=sizeof(u32); break; @@ -856,7 +858,8 @@ bool COpenGLDriver::updateIndexHardwareBuffer(SHWBufferLink_opengl *HWBuffer) if (!HWBuffer->vbo_indicesID) { extGlGenBuffers(1, &HWBuffer->vbo_indicesID); - if (!HWBuffer->vbo_indicesID) return false; + if (!HWBuffer->vbo_indicesID) + return false; newBuffer=true; } else if (HWBuffer->vbo_indicesSize < indexCount*indexSize) @@ -964,8 +967,8 @@ COpenGLDriver::SHWBufferLink *COpenGLDriver::createHardwareBuffer(const scene::I void COpenGLDriver::deleteHardwareBuffer(SHWBufferLink *_HWBuffer) { - if (!_HWBuffer) return; - + if (!_HWBuffer) + return; #if defined(GL_ARB_vertex_buffer_object) SHWBufferLink_opengl *HWBuffer=(SHWBufferLink_opengl*)_HWBuffer; @@ -982,7 +985,6 @@ void COpenGLDriver::deleteHardwareBuffer(SHWBufferLink *_HWBuffer) #endif CNullDriver::deleteHardwareBuffer(_HWBuffer); - } @@ -992,16 +994,13 @@ void COpenGLDriver::drawHardwareBuffer(SHWBufferLink *_HWBuffer) if (!_HWBuffer) return; - SHWBufferLink_opengl *HWBuffer=(SHWBufferLink_opengl*)_HWBuffer; - - updateHardwareBuffer(HWBuffer); //check if update is needed - - HWBuffer->LastUsed=0;//reset count + updateHardwareBuffer(_HWBuffer); //check if update is needed + _HWBuffer->LastUsed=0; //reset count #if defined(GL_ARB_vertex_buffer_object) + SHWBufferLink_opengl *HWBuffer=(SHWBufferLink_opengl*)_HWBuffer; + const scene::IMeshBuffer* mb = HWBuffer->MeshBuffer; - - const void *vertices=mb->getVertices(); const void *indexList=mb->getIndices(); @@ -1017,17 +1016,12 @@ void COpenGLDriver::drawHardwareBuffer(SHWBufferLink *_HWBuffer) indexList=0; } - drawVertexPrimitiveList(vertices, mb->getVertexCount(), indexList, mb->getIndexCount()/3, mb->getVertexType(), scene::EPT_TRIANGLES, mb->getIndexType()); if (HWBuffer->Mapped_Vertex!=scene::EHM_NEVER) extGlBindBuffer(GL_ARRAY_BUFFER, 0); - if (HWBuffer->Mapped_Index!=scene::EHM_NEVER) extGlBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); - - - #endif } @@ -1064,7 +1058,7 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun case EVT_STANDARD: { const S3DVertex* p = static_cast(vertices); - for ( i=0; iColor.toOpenGLColor(&ColorBuffer[i]); ++p; @@ -1074,7 +1068,7 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun case EVT_2TCOORDS: { const S3DVertex2TCoords* p = static_cast(vertices); - for ( i=0; iColor.toOpenGLColor(&ColorBuffer[i]); ++p; @@ -1084,7 +1078,7 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun case EVT_TANGENTS: { const S3DVertexTangents* p = static_cast(vertices); - for ( i=0; iColor.toOpenGLColor(&ColorBuffer[i]); ++p; @@ -1188,7 +1182,7 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun glTexCoordPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), buffer_offset(36)); extGlClientActiveTexture(GL_TEXTURE2_ARB); - glEnableClientState ( GL_TEXTURE_COORD_ARRAY ); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); if (vertices) glTexCoordPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), &(static_cast(vertices))[0].Binormal); else @@ -1201,12 +1195,12 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun switch (iType) { - case (EIT_16BIT): + case EIT_16BIT: { indexSize=GL_UNSIGNED_SHORT; break; } - case (EIT_32BIT): + case EIT_32BIT: { indexSize=GL_UNSIGNED_INT; break; @@ -1655,7 +1649,7 @@ void COpenGLDriver::draw2DLine(const core::position2d& start, void COpenGLDriver::drawPixel(u32 x, u32 y, const SColor &color) { const core::dimension2d& renderTargetSize = getCurrentRenderTargetSize(); - if(x > (u32)renderTargetSize.Width || y > (u32)renderTargetSize.Height) + if (x > (u32)renderTargetSize.Width || y > (u32)renderTargetSize.Height) return; disableTextures(); @@ -1761,7 +1755,7 @@ void COpenGLDriver::setMaterial(const SMaterial& material) for (s32 i = MaxTextureUnits-1; i>= 0; --i) { - setTransform ((E_TRANSFORMATION_STATE) ( ETS_TEXTURE_0 + i ), + setTransform ((E_TRANSFORMATION_STATE) (ETS_TEXTURE_0 + i), material.getTextureMatrix(i)); } } @@ -1772,7 +1766,7 @@ bool COpenGLDriver::testGLError() { #ifdef _DEBUG GLenum g = glGetError(); - switch(g) + switch (g) { case GL_NO_ERROR: return false; @@ -1825,7 +1819,7 @@ void COpenGLDriver::setRenderStates3DMode() ResetRenderStates = true; } - if ( ResetRenderStates || LastMaterial != Material) + if (ResetRenderStates || LastMaterial != Material) { // unset old material @@ -1997,16 +1991,16 @@ void COpenGLDriver::setBasicRenderStates(const SMaterial& material, const SMater else if (i>0) break; - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (material.TextureLayer[i].BilinearFilter || material.TextureLayer[i].TrilinearFilter) ? GL_LINEAR : GL_NEAREST); if (material.getTexture(i) && material.getTexture(i)->hasMipMaps()) - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, material.TextureLayer[i].TrilinearFilter ? GL_LINEAR_MIPMAP_LINEAR : material.TextureLayer[i].BilinearFilter ? GL_LINEAR_MIPMAP_NEAREST : - GL_NEAREST_MIPMAP_NEAREST ); + GL_NEAREST_MIPMAP_NEAREST); else - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (material.TextureLayer[i].BilinearFilter || material.TextureLayer[i].TrilinearFilter) ? GL_LINEAR : GL_NEAREST); #ifdef GL_EXT_texture_filter_anisotropic @@ -2048,11 +2042,11 @@ void COpenGLDriver::setBasicRenderStates(const SMaterial& material, const SMater break; case 1: glEnable(GL_DEPTH_TEST); - glDepthFunc ( GL_LEQUAL ); + glDepthFunc(GL_LEQUAL); break; case 2: glEnable(GL_DEPTH_TEST); - glDepthFunc ( GL_EQUAL ); + glDepthFunc(GL_EQUAL); break; } } @@ -2176,8 +2170,8 @@ void COpenGLDriver::setRenderStates2DMode(bool alpha, bool texture, bool alphaCh if (texture) { - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); @@ -2389,7 +2383,7 @@ void COpenGLDriver::drawStencilShadowVolume(const core::vector3df* triangles, s3 glDisable(GL_FOG); glDepthFunc(GL_LEQUAL); glDepthMask(GL_FALSE); // no depth buffer writing - glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE ); // no color buffer drawing + 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); @@ -2527,19 +2521,19 @@ void COpenGLDriver::drawStencilShadow(bool clearStencilBuffer, video::SColor lef disableTextures(); // store attributes - glPushAttrib( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT | GL_POLYGON_BIT | GL_STENCIL_BUFFER_BIT ); + glPushAttrib(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT | GL_POLYGON_BIT | GL_STENCIL_BUFFER_BIT); - glDisable( GL_LIGHTING ); + glDisable(GL_LIGHTING); glDisable(GL_FOG); glDepthMask(GL_FALSE); - glShadeModel( GL_FLAT ); - glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); + glShadeModel(GL_FLAT); + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable( GL_STENCIL_TEST ); + glEnable(GL_STENCIL_TEST); glStencilFunc(GL_NOTEQUAL, 0, ~0); glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); @@ -2550,17 +2544,17 @@ void COpenGLDriver::drawStencilShadow(bool clearStencilBuffer, video::SColor lef glBegin(GL_QUADS); - glColor4ub (leftDownEdge.getRed(), leftDownEdge.getGreen(), leftDownEdge.getBlue(), leftDownEdge.getAlpha() ); + glColor4ub(leftDownEdge.getRed(), leftDownEdge.getGreen(), leftDownEdge.getBlue(), leftDownEdge.getAlpha()); glVertex3f(-1.1f,-1.1f,0.9f); - glColor4ub (leftUpEdge.getRed(), leftUpEdge.getGreen(), leftUpEdge.getBlue(), leftUpEdge.getAlpha() ); + glColor4ub(leftUpEdge.getRed(), leftUpEdge.getGreen(), leftUpEdge.getBlue(), leftUpEdge.getAlpha()); glVertex3f(-1.1f, 1.1f,0.9f); - glColor4ub (rightUpEdge.getRed(), rightUpEdge.getGreen(), rightUpEdge.getBlue(), rightUpEdge.getAlpha() ); - glVertex3f( 1.1f, 1.1f,0.9f); + glColor4ub(rightUpEdge.getRed(), rightUpEdge.getGreen(), rightUpEdge.getBlue(), rightUpEdge.getAlpha()); + glVertex3f(1.1f, 1.1f,0.9f); - glColor4ub (rightDownEdge.getRed(), rightDownEdge.getGreen(), rightDownEdge.getBlue(), rightDownEdge.getAlpha() ); - glVertex3f( 1.1f,-1.1f,0.9f); + glColor4ub(rightDownEdge.getRed(), rightDownEdge.getGreen(), rightDownEdge.getBlue(), rightDownEdge.getAlpha()); + glVertex3f(1.1f,-1.1f,0.9f); glEnd(); @@ -2585,7 +2579,7 @@ void COpenGLDriver::setFog(SColor c, bool linearFog, f32 start, glFogi(GL_FOG_COORDINATE_SOURCE, GL_FRAGMENT_DEPTH); #endif - if(linearFog) + if (linearFog) { glFogf(GL_FOG_START, start); glFogf(GL_FOG_END, end); @@ -2850,7 +2844,7 @@ bool COpenGLDriver::setRenderTarget(video::ITexture* texture, bool clearBackBuff // returns the current size of the screen or rendertarget const core::dimension2d& COpenGLDriver::getCurrentRenderTargetSize() const { - if ( CurrentRendertargetSize.Width == 0 ) + if (CurrentRendertargetSize.Width == 0) return ScreenSize; else return CurrentRendertargetSize; diff --git a/source/Irrlicht/COpenGLDriver.h b/source/Irrlicht/COpenGLDriver.h index a226ab9f..35acd41b 100644 --- a/source/Irrlicht/COpenGLDriver.h +++ b/source/Irrlicht/COpenGLDriver.h @@ -116,7 +116,6 @@ namespace video GLuint vbo_verticesSize; //tmp GLuint vbo_indicesSize; //tmp - }; //! updates hardware buffer if needed diff --git a/source/Irrlicht/COpenGLExtensionHandler.cpp b/source/Irrlicht/COpenGLExtensionHandler.cpp index f402eb02..86cc55a0 100644 --- a/source/Irrlicht/COpenGLExtensionHandler.cpp +++ b/source/Irrlicht/COpenGLExtensionHandler.cpp @@ -66,7 +66,7 @@ void COpenGLExtensionHandler::dump() const void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) { const f32 ogl_ver = core::fast_atof(reinterpret_cast(glGetString(GL_VERSION))); - Version = core::floor32(ogl_ver)*100+core::ceil32(core::fract(ogl_ver)*10.0f); + Version = core::floor32(ogl_ver)*100+core::round32(core::fract(ogl_ver)*10.0f); if ( Version >= 102) os::Printer::log("OpenGL driver version is 1.2 or better.", ELL_INFORMATION); else @@ -423,7 +423,7 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) else { const f32 sl_ver = core::fast_atof(reinterpret_cast(shaderVersion)); - ShaderLanguageVersion = core::floor32(sl_ver)*100+core::ceil32(core::fract(sl_ver)*10.0f); + ShaderLanguageVersion = core::floor32(sl_ver)*100+core::round32(core::fract(sl_ver)*10.0f); } } #endif diff --git a/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.h b/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.h index c0d62b90..7d862243 100644 --- a/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.h +++ b/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.h @@ -61,7 +61,7 @@ namespace irr //! Sets if the window should be resizeable in windowed mode. virtual void setResizeAble(bool resize); - //! Activate any joysticks, and generate events for them. + //! Activate any joysticks, and generate events for them. virtual bool activateJoysticks(core::array & joystickInfo); //! \return Returns a pointer to a list with all video modes @@ -207,6 +207,7 @@ namespace irr int _screenWidth; int _screenHeight; bool _active; + bool IsShiftDown, IsControlDown; void pollJoysticks(); }; diff --git a/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.mm b/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.mm index 403e9010..6de37194 100644 --- a/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.mm +++ b/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.mm @@ -329,7 +329,8 @@ namespace irr { //! constructor CIrrDeviceMacOSX::CIrrDeviceMacOSX(const SIrrlichtCreationParameters& param) - : CIrrDeviceStub(param), _window(NULL), _active(true), _oglcontext(NULL), _cglcontext(NULL) + : CIrrDeviceStub(param), _window(NULL), _active(true), _oglcontext(NULL), _cglcontext(NULL), + IsShiftDown(false), IsControlDown(false) { struct utsname name; NSString *path; @@ -659,6 +660,36 @@ bool CIrrDeviceMacOSX::run() postKeyEvent(event,ievent,false); break; + case NSFlagsChanged: + ievent.EventType = irr::EET_KEY_INPUT_EVENT; + ievent.KeyInput.Shift = ([(NSEvent *)event modifierFlags] & NSShiftKeyMask) != 0; + ievent.KeyInput.Control = ([(NSEvent *)event modifierFlags] & NSControlKeyMask) != 0; + + if (IsShiftDown != ievent.KeyInput.Shift) + { + ievent.KeyInput.Char = irr::KEY_SHIFT; + ievent.KeyInput.Key = irr::KEY_SHIFT; + ievent.KeyInput.PressedDown = ievent.KeyInput.Shift; + + IsShiftDown = ievent.KeyInput.Shift; + + postEventFromUser(ievent); + } + + if (IsControlDown != ievent.KeyInput.Control) + { + ievent.KeyInput.Char = irr::KEY_CONTROL; + ievent.KeyInput.Key = irr::KEY_CONTROL; + ievent.KeyInput.PressedDown = ievent.KeyInput.Control; + + IsControlDown = ievent.KeyInput.Control; + + postEventFromUser(ievent); + } + + [NSApp sendEvent:event]; + break; + case NSLeftMouseDown: ievent.EventType = irr::EET_MOUSE_INPUT_EVENT; ievent.MouseInput.Event = irr::EMIE_LMOUSE_PRESSED_DOWN; diff --git a/source/Irrlicht/MacOSX/MacOSX.xcodeproj/project.pbxproj b/source/Irrlicht/MacOSX/MacOSX.xcodeproj/project.pbxproj index 89078575..18c7b045 100644 --- a/source/Irrlicht/MacOSX/MacOSX.xcodeproj/project.pbxproj +++ b/source/Irrlicht/MacOSX/MacOSX.xcodeproj/project.pbxproj @@ -907,7 +907,7 @@ 093973BD0E0458B200E0C987 /* CSceneNodeAnimatorCameraFPS.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSceneNodeAnimatorCameraFPS.h; sourceTree = ""; }; 093973BE0E0458B200E0C987 /* CSceneNodeAnimatorCameraMaya.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSceneNodeAnimatorCameraMaya.cpp; sourceTree = ""; }; 093973BF0E0458B200E0C987 /* CSceneNodeAnimatorCameraMaya.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSceneNodeAnimatorCameraMaya.h; sourceTree = ""; }; - 0946CCB40EC99BBE00D945A5 /* MouseAndJoystick.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = MouseAndJoystick.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 0946CCB40EC99BBE00D945A5 /* MouseAndJoystick.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MouseAndJoystick.app; sourceTree = BUILT_PRODUCTS_DIR; }; 0946CCCA0EC99C6E00D945A5 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = 19.MouseAndJoystick/main.cpp; sourceTree = ""; }; 0968401E0D0F1A2300333EFD /* CB3DMeshFileLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CB3DMeshFileLoader.cpp; sourceTree = ""; }; 0968401F0D0F1A2300333EFD /* CB3DMeshFileLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CB3DMeshFileLoader.h; sourceTree = ""; }; @@ -1284,7 +1284,7 @@ 4C53E2520A4850550014E966 /* Quake3Map.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Quake3Map.app; sourceTree = BUILT_PRODUCTS_DIR; }; 4C53E26D0A4850D60014E966 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 4C53E26E0A4850D60014E966 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; - 4C53E38E0A4855BA0014E966 /* DemoApp-Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = "DemoApp-Info.plist"; sourceTree = ""; }; + 4C53E38E0A4855BA0014E966 /* DemoApp-Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = "DemoApp-Info.plist"; sourceTree = ""; }; 4C53E6F10A485CD80014E966 /* jcapimin.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = jcapimin.c; sourceTree = ""; }; 4C53E6F20A485CD80014E966 /* jcapistd.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = jcapistd.c; sourceTree = ""; }; 4C53E6F30A485CD80014E966 /* jccoefct.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = jccoefct.c; sourceTree = ""; }; @@ -3364,10 +3364,12 @@ 0867D690FE84028FC02AAC07 /* Project object */ = { isa = PBXProject; buildConfigurationList = 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "MacOSX" */; + compatibilityVersion = "Xcode 2.4"; hasScannedForEncodings = 1; mainGroup = 0867D691FE84028FC02AAC07 /* MacOSX */; productRefGroup = 0867D691FE84028FC02AAC07 /* MacOSX */; projectDirPath = ""; + projectRoot = ""; targets = ( D2AAC07D0554694100DB518D /* libIrrlicht.a */, B81CFF33097FE25F0057C06F /* Quake3Map */, diff --git a/tests/main.cpp b/tests/main.cpp index 3ee53e82..733acc62 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -74,6 +74,7 @@ int main(int argumentCount, char * arguments[]) TEST(textureRenderStates); TEST(terrainSceneNode); TEST(burningsVideo); + TEST(makeColorKeyTexture); // Tests available on 1.6+ TEST(collisionResponseAnimator); diff --git a/tests/terrainSceneNode.cpp b/tests/terrainSceneNode.cpp index 6ac119a4..1d2855f4 100644 --- a/tests/terrainSceneNode.cpp +++ b/tests/terrainSceneNode.cpp @@ -45,7 +45,8 @@ bool terrainSceneNode(void) smgr->drawAll(); driver->endScene(); - bool result = takeScreenshotAndCompareAgainstReference(driver, "-terrainSceneNode-1.png"); + // Note that this has to be a slightly fuzzier than usual compare to satisfy multiple OpenGL environments + bool result = takeScreenshotAndCompareAgainstReference(driver, "-terrainSceneNode-1.png", 98.3f); if(!result) { logTestString("Small camera up rotation caused bad recalc.\n"); @@ -60,7 +61,7 @@ bool terrainSceneNode(void) smgr->drawAll(); driver->endScene(); - result &= takeScreenshotAndCompareAgainstReference(driver, "-terrainSceneNode-2.png"); + result &= takeScreenshotAndCompareAgainstReference(driver, "-terrainSceneNode-2.png", 98.9f); if(!result) { logTestString("Large camera up rotation caused bad recalc.\n"); diff --git a/tests/testUtils.cpp b/tests/testUtils.cpp index 2f1339be..a6363623 100644 --- a/tests/testUtils.cpp +++ b/tests/testUtils.cpp @@ -227,7 +227,10 @@ bool openTestLog(bool startNewLog, const char * filename) void closeTestLog(void) { if(logFile) + { (void)fclose(logFile); + logFile = 0; + } } diff --git a/tests/tests-last-passed-at.txt b/tests/tests-last-passed-at.txt index bd0fe758..4e7b7944 100644 --- a/tests/tests-last-passed-at.txt +++ b/tests/tests-last-passed-at.txt @@ -1,2 +1,2 @@ -Test suite pass at GMT Mon Jan 05 14:45:04 2009 - +Test suite pass at GMT Mon Jan 5 15:14:30 2009 + diff --git a/tests/vectorPositionDimension2d.cpp b/tests/vectorPositionDimension2d.cpp index 11eadc25..ecdbda1a 100644 --- a/tests/vectorPositionDimension2d.cpp +++ b/tests/vectorPositionDimension2d.cpp @@ -69,4 +69,5 @@ bool vectorPositionDimension2d(void) assert(false); return result; -} \ No newline at end of file +} +