From ebb6f460b447e65d7ca901949a237efed1b7ff41 Mon Sep 17 00:00:00 2001 From: hybrid Date: Thu, 2 Aug 2007 09:50:59 +0000 Subject: [PATCH] Use c++ casts instead of plain C ones. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@818 dfc29bdd-3216-0410-991c-e03cc46cb475 --- source/Irrlicht/COpenGLDriver.cpp | 137 +++++++++--------- source/Irrlicht/COpenGLDriver.h | 4 +- source/Irrlicht/COpenGLExtensionHandler.cpp | 24 +-- source/Irrlicht/COpenGLExtensionHandler.h | 2 +- source/Irrlicht/COpenGLMaterialRenderer.h | 3 +- source/Irrlicht/COpenGLNormalMapRenderer.cpp | 2 +- .../Irrlicht/COpenGLParallaxMapRenderer.cpp | 2 +- source/Irrlicht/COpenGLSLMaterialRenderer.cpp | 12 +- .../COpenGLShaderMaterialRenderer.cpp | 6 +- 9 files changed, 98 insertions(+), 94 deletions(-) diff --git a/source/Irrlicht/COpenGLDriver.cpp b/source/Irrlicht/COpenGLDriver.cpp index 5f1e77a0..ade52b7f 100644 --- a/source/Irrlicht/COpenGLDriver.cpp +++ b/source/Irrlicht/COpenGLDriver.cpp @@ -67,7 +67,7 @@ bool COpenGLDriver::initDriver(const core::dimension2d& screenSize, 0, 0, 0 // Layer Masks Ignored }; - for (int i=0; i<5; ++i) + for (u32 i=0; i<5; ++i) { if (i == 1) { @@ -267,7 +267,7 @@ bool COpenGLDriver::genericDriverInit(const core::dimension2d& screenSize, const GLubyte* renderer = glGetString(GL_RENDERER); const GLubyte* vendor = glGetString(GL_VENDOR); if (renderer && vendor) - os::Printer::log((const c8*)renderer, (const c8*)vendor, ELL_INFORMATION); + os::Printer::log(reinterpret_cast(renderer), reinterpret_cast(vendor), ELL_INFORMATION); for (u32 i=0; i(vertices); for ( i=0; iColor.toOpenGLColor(&ColorBuffer[i]); @@ -522,7 +522,7 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun break; case EVT_2TCOORDS: { - const S3DVertex2TCoords* p = (const S3DVertex2TCoords*)vertices; + const S3DVertex2TCoords* p = reinterpret_cast(vertices); for ( i=0; iColor.toOpenGLColor(&ColorBuffer[i]); @@ -532,7 +532,7 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun break; case EVT_TANGENTS: { - const S3DVertexTangents* p = (const S3DVertexTangents*)vertices; + const S3DVertexTangents* p = reinterpret_cast(vertices); for ( i=0; iColor.toOpenGLColor(&ColorBuffer[i]); @@ -560,36 +560,36 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun switch (vType) { case EVT_STANDARD: - glVertexPointer(3, GL_FLOAT, sizeof(S3DVertex), &((S3DVertex*)vertices)[0].Pos); - glNormalPointer(GL_FLOAT, sizeof(S3DVertex), &((S3DVertex*)vertices)[0].Normal); - glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex), &((S3DVertex*)vertices)[0].TCoords); + glVertexPointer(3, GL_FLOAT, sizeof(S3DVertex), &(reinterpret_cast(vertices))[0].Pos); + glNormalPointer(GL_FLOAT, sizeof(S3DVertex), &(reinterpret_cast(vertices))[0].Normal); + glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex), &(reinterpret_cast(vertices))[0].TCoords); break; case EVT_2TCOORDS: - glVertexPointer(3, GL_FLOAT, sizeof(S3DVertex2TCoords), &((S3DVertex2TCoords*)vertices)[0].Pos); - glNormalPointer(GL_FLOAT, sizeof(S3DVertex2TCoords), &((S3DVertex2TCoords*)vertices)[0].Normal); + glVertexPointer(3, GL_FLOAT, sizeof(S3DVertex2TCoords), &(reinterpret_cast(vertices))[0].Pos); + glNormalPointer(GL_FLOAT, sizeof(S3DVertex2TCoords), &(reinterpret_cast(vertices))[0].Normal); // texture coordinates - glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex2TCoords), &((S3DVertex2TCoords*)vertices)[0].TCoords); + glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex2TCoords), &(reinterpret_cast(vertices))[0].TCoords); if (MultiTextureExtension) { extGlClientActiveTexture(GL_TEXTURE1_ARB); - glEnableClientState ( GL_TEXTURE_COORD_ARRAY ); - glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex2TCoords), &((S3DVertex2TCoords*)vertices)[0].TCoords2); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex2TCoords), &(reinterpret_cast(vertices))[0].TCoords2); } break; case EVT_TANGENTS: - glVertexPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), &((S3DVertexTangents*)vertices)[0].Pos); - glNormalPointer(GL_FLOAT, sizeof(S3DVertexTangents), &((S3DVertexTangents*)vertices)[0].Normal); + glVertexPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), &(reinterpret_cast(vertices))[0].Pos); + glNormalPointer(GL_FLOAT, sizeof(S3DVertexTangents), &(reinterpret_cast(vertices))[0].Normal); // texture coordinates - glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertexTangents), &((S3DVertexTangents*)vertices)[0].TCoords); + glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertexTangents), &(reinterpret_cast(vertices))[0].TCoords); if (MultiTextureExtension) { extGlClientActiveTexture(GL_TEXTURE1_ARB); - glEnableClientState ( GL_TEXTURE_COORD_ARRAY ); - glTexCoordPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), &((S3DVertexTangents*)vertices)[0].Tangent); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glTexCoordPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), &(reinterpret_cast(vertices))[0].Tangent); extGlClientActiveTexture(GL_TEXTURE2_ARB); glEnableClientState ( GL_TEXTURE_COORD_ARRAY ); - glTexCoordPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), &((S3DVertexTangents*)vertices)[0].Binormal); + glTexCoordPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), &(reinterpret_cast(vertices))[0].Binormal); } break; } @@ -750,10 +750,10 @@ void COpenGLDriver::draw2DImage(video::ITexture* texture, const core::dimension2d& ss = texture->getOriginalSize(); core::rect tcoords; - tcoords.UpperLeftCorner.X = (f32)sourcePos.X / (f32)ss.Width; - tcoords.UpperLeftCorner.Y = (f32)sourcePos.Y / (f32)ss.Height; - tcoords.LowerRightCorner.X = ((f32)sourcePos.X +(f32)sourceSize.Width) / (f32)ss.Width; - tcoords.LowerRightCorner.Y = ((f32)sourcePos.Y + (f32)sourceSize.Height) / (f32)ss.Height; + tcoords.UpperLeftCorner.X = sourcePos.X / static_cast(ss.Width); + tcoords.UpperLeftCorner.Y = sourcePos.Y / static_cast(ss.Height); + tcoords.LowerRightCorner.X = (sourcePos.X + sourceSize.Width) / static_cast(ss.Width); + tcoords.LowerRightCorner.Y = (sourcePos.Y + sourceSize.Height) / static_cast(ss.Height); core::rect poss(targetPos, sourceSize); core::rect npos; @@ -838,10 +838,10 @@ void COpenGLDriver::draw2DImage(video::ITexture* texture, sourcePos=sourceRects[currentIndex].UpperLeftCorner; sourceSize=sourceRects[currentIndex].getSize(); - tcoords.UpperLeftCorner.X = (f32)sourceRects[currentIndex].UpperLeftCorner.X / (f32)ss.Width; - tcoords.UpperLeftCorner.Y = (f32)sourceRects[currentIndex].UpperLeftCorner.Y / (f32)ss.Height; - tcoords.LowerRightCorner.X = (f32)sourceRects[currentIndex].LowerRightCorner.X / (f32)ss.Width; - tcoords.LowerRightCorner.Y = (f32)sourceRects[currentIndex].LowerRightCorner.Y / (f32)ss.Height; + tcoords.UpperLeftCorner.X = sourceRects[currentIndex].UpperLeftCorner.X / static_cast(ss.Width); + tcoords.UpperLeftCorner.Y = sourceRects[currentIndex].UpperLeftCorner.Y / static_cast(ss.Height); + tcoords.LowerRightCorner.X = sourceRects[currentIndex].LowerRightCorner.X / static_cast(ss.Width); + tcoords.LowerRightCorner.Y = sourceRects[currentIndex].LowerRightCorner.Y / static_cast(ss.Height); core::rect poss(targetPos, sourceSize); core::rect npos; @@ -884,15 +884,15 @@ void COpenGLDriver::draw2DImage(video::ITexture* texture, const core::rect& const core::dimension2d& ss = texture->getOriginalSize(); core::rect tcoords; - tcoords.UpperLeftCorner.X = (f32)sourceRect.UpperLeftCorner.X / (f32)ss.Width; - tcoords.UpperLeftCorner.Y = (f32)sourceRect.UpperLeftCorner.Y / (f32)ss.Height; - tcoords.LowerRightCorner.X = (f32)sourceRect.LowerRightCorner.X / (f32)ss.Width; - tcoords.LowerRightCorner.Y = (f32)sourceRect.LowerRightCorner.Y / (f32)ss.Height; + tcoords.UpperLeftCorner.X = sourceRect.UpperLeftCorner.X / static_cast(ss.Width); + tcoords.UpperLeftCorner.Y = sourceRect.UpperLeftCorner.Y / static_cast(ss.Height); + tcoords.LowerRightCorner.X = sourceRect.LowerRightCorner.X / static_cast(ss.Width); + tcoords.LowerRightCorner.Y = sourceRect.LowerRightCorner.Y / static_cast(ss.Height); const core::dimension2d& renderTargetSize = getCurrentRenderTargetSize(); core::rect npos; - f32 xFact = 2.0f / ( renderTargetSize.Width ); - f32 yFact = 2.0f / ( renderTargetSize.Height ); + const f32 xFact = 2.0f / renderTargetSize.Width; + const f32 yFact = 2.0f / renderTargetSize.Height; npos.UpperLeftCorner.X = ( destRect.UpperLeftCorner.X * xFact ) - 1.0f; npos.UpperLeftCorner.Y = 1.0f - ( destRect.UpperLeftCorner.Y * yFact ); npos.LowerRightCorner.X = ( destRect.LowerRightCorner.X * xFact ) - 1.0f; @@ -965,11 +965,11 @@ void COpenGLDriver::draw2DRectangle(SColor color, const core::rect& positio return; const core::dimension2d& renderTargetSize = getCurrentRenderTargetSize(); - s32 xPlus = renderTargetSize.Width>>1; - f32 xFact = 1.0f / (renderTargetSize.Width>>1); + const s32 xPlus = renderTargetSize.Width/2; + const f32 xFact = 2.0f / renderTargetSize.Width/2; - s32 yPlus = renderTargetSize.Height-(renderTargetSize.Height>>1); - f32 yFact = 1.0f / (renderTargetSize.Height>>1); + const s32 yPlus = renderTargetSize.Height-(renderTargetSize.Height/2); + const f32 yFact = 2.0f / renderTargetSize.Height; glColor4ub(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()); glRectf((pos.UpperLeftCorner.X-xPlus) * xFact, @@ -994,17 +994,17 @@ void COpenGLDriver::draw2DRectangle(const core::rect& position, return; const core::dimension2d& renderTargetSize = getCurrentRenderTargetSize(); - s32 xPlus = renderTargetSize.Width>>1; - f32 xFact = 1.0f / (renderTargetSize.Width>>1); + const s32 xPlus = renderTargetSize.Width/2; + const f32 xFact = 2.0f / renderTargetSize.Width; - s32 yPlus = renderTargetSize.Height-(renderTargetSize.Height>>1); - f32 yFact = 1.0f / (renderTargetSize.Height>>1); + const s32 yPlus = renderTargetSize.Height-(renderTargetSize.Height/2); + const f32 yFact = 2.0f / renderTargetSize.Height; core::rect npos; - npos.UpperLeftCorner.X = (f32)(pos.UpperLeftCorner.X-xPlus) * xFact; - npos.UpperLeftCorner.Y = (f32)(yPlus-pos.UpperLeftCorner.Y) * yFact; - npos.LowerRightCorner.X = (f32)(pos.LowerRightCorner.X-xPlus) * xFact; - npos.LowerRightCorner.Y = (f32)(yPlus-pos.LowerRightCorner.Y) * yFact; + npos.UpperLeftCorner.X = (pos.UpperLeftCorner.X-xPlus) * xFact; + npos.UpperLeftCorner.Y = (yPlus-pos.UpperLeftCorner.Y) * yFact; + npos.LowerRightCorner.X = (pos.LowerRightCorner.X-xPlus) * xFact; + npos.LowerRightCorner.Y = (yPlus-pos.LowerRightCorner.Y) * yFact; setRenderStates2DMode(colorLeftUp.getAlpha() < 255 || colorRightUp.getAlpha() < 255 || @@ -1043,20 +1043,19 @@ void COpenGLDriver::draw2DLine(const core::position2d& start, // thanks to Vash TheStampede who sent in his implementation const core::dimension2d& renderTargetSize = getCurrentRenderTargetSize(); - const s32 xPlus = renderTargetSize.Width>>1; - const f32 xFact = 1.0f / (renderTargetSize.Width>>1); + const s32 xPlus = renderTargetSize.Width/2; + const f32 xFact = 2.0f / renderTargetSize.Width; - const s32 yPlus = - renderTargetSize.Height-(renderTargetSize.Height>>1); - const f32 yFact = 1.0f / (renderTargetSize.Height>>1); + const s32 yPlus = renderTargetSize.Height-(renderTargetSize.Height/2); + const f32 yFact = 2.0f / renderTargetSize.Height; core::position2d npos_start; - npos_start.X = (f32)(start.X - xPlus) * xFact; - npos_start.Y = (f32)(yPlus - start.Y) * yFact; + npos_start.X = (start.X - xPlus) * xFact; + npos_start.Y = (yPlus - start.Y) * yFact; core::position2d npos_end; - npos_end.X = (f32)(end.X - xPlus) * xFact; - npos_end.Y = (f32)(yPlus - end.Y) * yFact; + npos_end.X = (end.X - xPlus) * xFact; + npos_end.Y = (yPlus - end.Y) * yFact; setRenderStates2DMode(color.getAlpha() < 255, false, false); disableTextures(); @@ -1070,7 +1069,7 @@ void COpenGLDriver::draw2DLine(const core::position2d& start, -bool COpenGLDriver::setTexture(s32 stage, video::ITexture* texture) +bool COpenGLDriver::setTexture(u32 stage, video::ITexture* texture) { if (stage >= MaxTextureUnits) return false; @@ -1083,7 +1082,7 @@ bool COpenGLDriver::setTexture(s32 stage, video::ITexture* texture) CurrentTexture[stage]=texture; - if (texture == 0) + if (!texture) { glDisable(GL_TEXTURE_2D); return true; @@ -1099,7 +1098,7 @@ bool COpenGLDriver::setTexture(s32 stage, video::ITexture* texture) glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, - ((COpenGLTexture*)texture)->getOpenGLTextureName()); + static_cast(texture)->getOpenGLTextureName()); } return true; } @@ -1108,10 +1107,10 @@ bool COpenGLDriver::setTexture(s32 stage, video::ITexture* texture) //! disables all textures beginning with the optional fromStage parameter. Otherwise all texture stages are disabled. //! Returns whether disabling was successful or not. -bool COpenGLDriver::disableTextures(s32 fromStage) +bool COpenGLDriver::disableTextures(u32 fromStage) { bool result=true; - for (s32 i=fromStage; i= 0 && LastMaterial.MaterialType < (s32)MaterialRenderers.size()) + LastMaterial.MaterialType >= 0 && LastMaterial.MaterialType < static_cast(MaterialRenderers.size())) MaterialRenderers[LastMaterial.MaterialType].Renderer->OnUnsetMaterial(); // set new material. - if (Material.MaterialType >= 0 && Material.MaterialType < (s32)MaterialRenderers.size()) + if (Material.MaterialType >= 0 && Material.MaterialType < static_cast(MaterialRenderers.size())) MaterialRenderers[Material.MaterialType].Renderer->OnSetMaterial( Material, LastMaterial, ResetRenderStates, this); @@ -1267,7 +1266,7 @@ void COpenGLDriver::setRenderStates3DMode() ResetRenderStates = false; } - if (Material.MaterialType >= 0 && Material.MaterialType < (s32)MaterialRenderers.size()) + if (Material.MaterialType >= 0 && Material.MaterialType < static_cast(MaterialRenderers.size())) MaterialRenderers[Material.MaterialType].Renderer->OnRender(this, video::EVT_STANDARD); CurrentRenderMode = ERM_3D; @@ -1331,7 +1330,7 @@ void COpenGLDriver::setBasicRenderStates(const SMaterial& material, const SMater // Texture filter // Has to be checked always because it depends on the textures // Filtering has to be set for each texture layer - for (s32 i=0; i= 0 && - Material.MaterialType < (s32)MaterialRenderers.size()) + Material.MaterialType < static_cast(MaterialRenderers.size())) MaterialRenderers[Material.MaterialType].Renderer->OnUnsetMaterial(); GLfloat glmat[16]; @@ -1793,7 +1792,7 @@ void COpenGLDriver::drawStencilShadowVolume(const core::vector3df* triangles, s3 // unset last 3d material if (CurrentRenderMode == ERM_3D && - Material.MaterialType >= 0 && Material.MaterialType < (s32)MaterialRenderers.size()) + Material.MaterialType >= 0 && Material.MaterialType < static_cast(MaterialRenderers.size())) { MaterialRenderers[Material.MaterialType].Renderer->OnUnsetMaterial(); ResetRenderStates = true; @@ -2054,7 +2053,7 @@ E_DRIVER_TYPE COpenGLDriver::getDriverType() void COpenGLDriver::setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount) { #ifdef GL_ARB_vertex_program - for (int i=0; ilock(); + u8* pPixels = reinterpret_cast(newImage->lock()); if (!pPixels) { newImage->drop(); diff --git a/source/Irrlicht/COpenGLDriver.h b/source/Irrlicht/COpenGLDriver.h index 34ceedc5..f939a996 100644 --- a/source/Irrlicht/COpenGLDriver.h +++ b/source/Irrlicht/COpenGLDriver.h @@ -239,11 +239,11 @@ namespace video //! sets the current Texture //! Returns whether setting was a success or not. - bool setTexture(s32 stage, video::ITexture* texture); + bool setTexture(u32 stage, video::ITexture* texture); //! disables all textures beginning with the optional fromStage parameter. Otherwise all texture stages are disabled. //! Returns whether disabling was successful or not. - bool disableTextures(s32 fromStage=0); + bool disableTextures(u32 fromStage=0); //! Adds a new material renderer to the VideoDriver, using extGLGetObjectParameterivARB(shaderHandle, GL_OBJECT_COMPILE_STATUS_ARB, &status) pixel and/or //! vertex shaders to render geometry. diff --git a/source/Irrlicht/COpenGLExtensionHandler.cpp b/source/Irrlicht/COpenGLExtensionHandler.cpp index 8210fd84..80486301 100644 --- a/source/Irrlicht/COpenGLExtensionHandler.cpp +++ b/source/Irrlicht/COpenGLExtensionHandler.cpp @@ -59,7 +59,7 @@ void COpenGLExtensionHandler::dump() const void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) { - const f32 ver = core::fast_atof((c8*)glGetString(GL_VERSION)); + const f32 ver = core::fast_atof(reinterpret_cast(glGetString(GL_VERSION))); Version = core::floor32(ver)*100+core::ceil32((ver-floor(ver))*10.0); if ( Version >= 102) os::Printer::log("OpenGL driver version is 1.2 or better.", ELL_INFORMATION); @@ -67,25 +67,25 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) os::Printer::log("OpenGL driver version is not 1.2 or better.", ELL_WARNING); const GLubyte* t = glGetString(GL_EXTENSIONS); -// os::Printer::log((const c8*)t, ELL_INFORMATION); +// os::Printer::log(reinterpret_cast(t), ELL_INFORMATION); #ifdef GLU_VERSION_1_3 const GLubyte* gluVersion = gluGetString(GLU_VERSION); if (gluVersion[0]>1 || gluVersion[3]>2) { for (u32 i=0; i(OpenGLFeatureStrings[i]), t); } else #endif { - s32 len = (s32)strlen((const char*)t); + size_t len = strlen(reinterpret_cast(t)); c8 *str = new c8[len+1]; c8* p = str; - for (s32 i=0; i(t[i]); if (str[i] == ' ') { @@ -170,7 +170,7 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) pGlFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) wglGetProcAddress("glFramebufferRenderbufferEXT"); // vsync extension - wglSwapIntervalEXT = (PFNWGLSWAPINTERVALFARPROC)wglGetProcAddress( "wglSwapIntervalEXT" ); + wglSwapIntervalEXT = (PFNWGLSWAPINTERVALFARPROC) wglGetProcAddress("wglSwapIntervalEXT"); #elif defined(_IRR_USE_LINUX_DEVICE_) || defined (_IRR_USE_SDL_DEVICE_) #ifdef _IRR_OPENGL_USE_EXTPOINTER_ @@ -351,7 +351,11 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) // set some properties #if defined(GL_ARB_multitexture) || defined(GL_VERSION_1_3) if (Version>102 || FeatureAvailable[IRR_ARB_multitexture]) - glGetIntegerv(GL_MAX_TEXTURE_UNITS, &MaxTextureUnits); + { + GLint num; + glGetIntegerv(GL_MAX_TEXTURE_UNITS, &num); + MaxTextureUnits=num; + } #endif glGetIntegerv(GL_MAX_LIGHTS, &MaxLights); #ifdef GL_EXT_texture_filter_anisotropic @@ -371,7 +375,7 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) ShaderLanguageVersion = 100; else { - const f32 ver = core::fast_atof((c8*)shaderVersion); + const f32 ver = core::fast_atof(reinterpret_cast(shaderVersion)); ShaderLanguageVersion = core::floor32(ver)*100+core::ceil32((ver-floor(ver))*10.0); } } @@ -390,7 +394,7 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) MultiTextureExtension = false; os::Printer::log("Warning: OpenGL device only has one texture unit. Disabling multitexturing.", ELL_WARNING); } - MaxTextureUnits = core::min_((u32)MaxTextureUnits,MATERIAL_MAX_TEXTURES); + MaxTextureUnits = core::min_(MaxTextureUnits,MATERIAL_MAX_TEXTURES); } diff --git a/source/Irrlicht/COpenGLExtensionHandler.h b/source/Irrlicht/COpenGLExtensionHandler.h index 31487708..8bc25605 100644 --- a/source/Irrlicht/COpenGLExtensionHandler.h +++ b/source/Irrlicht/COpenGLExtensionHandler.h @@ -670,7 +670,7 @@ class COpenGLExtensionHandler // Some non-boolean properties //! Maxmimum texture layers supported by the fixed pipeline - GLint MaxTextureUnits; + u32 MaxTextureUnits; //! Maximum hardware lights supported GLint MaxLights; //! Optimal number of indices per meshbuffer diff --git a/source/Irrlicht/COpenGLMaterialRenderer.h b/source/Irrlicht/COpenGLMaterialRenderer.h index cb24ca47..8d674ae6 100644 --- a/source/Irrlicht/COpenGLMaterialRenderer.h +++ b/source/Irrlicht/COpenGLMaterialRenderer.h @@ -22,8 +22,7 @@ class COpenGLMaterialRenderer : public IMaterialRenderer public: //! Constructor - COpenGLMaterialRenderer(video::COpenGLDriver* driver) - : Driver(driver) + COpenGLMaterialRenderer(video::COpenGLDriver* driver) : Driver(driver) { } diff --git a/source/Irrlicht/COpenGLNormalMapRenderer.cpp b/source/Irrlicht/COpenGLNormalMapRenderer.cpp index 44fc5c5d..066879d2 100644 --- a/source/Irrlicht/COpenGLNormalMapRenderer.cpp +++ b/source/Irrlicht/COpenGLNormalMapRenderer.cpp @@ -201,7 +201,7 @@ COpenGLNormalMapRenderer::COpenGLNormalMapRenderer(video::COpenGLDriver* driver, if (renderer) { // use the already compiled shaders - video::COpenGLNormalMapRenderer* nmr = (video::COpenGLNormalMapRenderer*)renderer; + video::COpenGLNormalMapRenderer* nmr = reinterpret_cast(renderer); CompiledShaders = false; VertexShader = nmr->VertexShader; diff --git a/source/Irrlicht/COpenGLParallaxMapRenderer.cpp b/source/Irrlicht/COpenGLParallaxMapRenderer.cpp index 9d182bcd..23791009 100644 --- a/source/Irrlicht/COpenGLParallaxMapRenderer.cpp +++ b/source/Irrlicht/COpenGLParallaxMapRenderer.cpp @@ -235,7 +235,7 @@ COpenGLParallaxMapRenderer::COpenGLParallaxMapRenderer(video::COpenGLDriver* dri if (renderer) { // use the already compiled shaders - video::COpenGLParallaxMapRenderer* nmr = (video::COpenGLParallaxMapRenderer*)renderer; + video::COpenGLParallaxMapRenderer* nmr = reinterpret_cast(renderer); CompiledShaders = false; VertexShader = nmr->VertexShader; diff --git a/source/Irrlicht/COpenGLSLMaterialRenderer.cpp b/source/Irrlicht/COpenGLSLMaterialRenderer.cpp index 53001b8c..b8feff8a 100644 --- a/source/Irrlicht/COpenGLSLMaterialRenderer.cpp +++ b/source/Irrlicht/COpenGLSLMaterialRenderer.cpp @@ -192,7 +192,7 @@ bool COpenGLSLMaterialRenderer::createShader(GLenum shaderType, const char* shad #endif GLcharARB *pInfoLog = new GLcharARB[maxLength]; Driver->extGlGetInfoLog(shaderHandle, maxLength, &length, pInfoLog); - os::Printer::log((const c8*)pInfoLog); + os::Printer::log(reinterpret_cast(pInfoLog)); delete [] pInfoLog; return false; @@ -225,7 +225,7 @@ bool COpenGLSLMaterialRenderer::linkProgram() #endif GLcharARB *pInfoLog = new GLcharARB[maxLength]; Driver->extGlGetInfoLog(Program, maxLength, &length, pInfoLog); - os::Printer::log((const c8*)pInfoLog); + os::Printer::log(reinterpret_cast(pInfoLog)); delete [] pInfoLog; return false; @@ -266,7 +266,7 @@ bool COpenGLSLMaterialRenderer::linkProgram() memset(buf, 0, maxlen); GLint size; - Driver->extGlGetActiveUniform(Program, i, maxlen, 0, &size, &ui.type, (GLcharARB*)buf); + Driver->extGlGetActiveUniform(Program, i, maxlen, 0, &size, &ui.type, reinterpret_cast(buf)); ui.name = buf; UniformInfo.push_back(ui); @@ -301,9 +301,9 @@ void COpenGLSLMaterialRenderer::setVertexShaderConstant(const f32* data, s32 sta bool COpenGLSLMaterialRenderer::setPixelShaderConstant(const c8* name, const f32* floats, int count) { - int i = 0, num = (int)UniformInfo.size(); + int i, num = static_cast(UniformInfo.size()); - for (; i < num; i++) + for (i=0; i < num; ++i) { if (UniformInfo[i].name == name) break; @@ -337,7 +337,7 @@ bool COpenGLSLMaterialRenderer::setPixelShaderConstant(const c8* name, const f32 Driver->extGlUniformMatrix4fv(i, count/16, false, floats); break; default: - Driver->extGlUniform1iv(i, count, (GLint*)floats); + Driver->extGlUniform1iv(i, count, reinterpret_cast(floats)); break; } #endif diff --git a/source/Irrlicht/COpenGLShaderMaterialRenderer.cpp b/source/Irrlicht/COpenGLShaderMaterialRenderer.cpp index 9be06e46..a2437c30 100644 --- a/source/Irrlicht/COpenGLShaderMaterialRenderer.cpp +++ b/source/Irrlicht/COpenGLShaderMaterialRenderer.cpp @@ -160,7 +160,8 @@ bool COpenGLShaderMaterialRenderer::createPixelShader(const c8* pxsh) Driver->extGlBindProgram(GL_FRAGMENT_PROGRAM_ARB, PixelShader); // clear error buffer - while(glGetError() != GL_NO_ERROR) {} + while(glGetError() != GL_NO_ERROR) + {} // compile Driver->extGlProgramString(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, @@ -199,7 +200,8 @@ bool COpenGLShaderMaterialRenderer::createVertexShader(const char* vtxsh) Driver->extGlBindProgram(GL_VERTEX_PROGRAM_ARB, VertexShader); // clear error buffer - while(glGetError() != GL_NO_ERROR) {} + while(glGetError() != GL_NO_ERROR) + {} // compile Driver->extGlProgramString(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,