From 7b598c5701809a742a2ac81fa23b6dcadb4cbe52 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 23 Jan 2009 15:12:26 +0000 Subject: [PATCH] Warning fixes for VS, and removal of associated warning disables --- include/osg/Export | 2 -- src/osg/AutoTransform.cpp | 2 +- src/osg/KdTree.cpp | 4 ++-- src/osg/Texture.cpp | 18 +++++++++--------- src/osgPlugins/bsp/VBSPData.cpp | 2 +- src/osgPlugins/bsp/VBSPGeometry.cpp | 18 +++++++++--------- 6 files changed, 22 insertions(+), 24 deletions(-) diff --git a/include/osg/Export b/include/osg/Export index f1648fdff..49f6cfbb5 100644 --- a/include/osg/Export +++ b/include/osg/Export @@ -25,8 +25,6 @@ #pragma warning( disable : 4244 ) #pragma warning( disable : 4251 ) #pragma warning( disable : 4275 ) - #pragma warning( disable : 4305 ) - #pragma warning( disable : 4996 ) #endif #if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || defined( __BCPLUSPLUS__) || defined( __MWERKS__) diff --git a/src/osg/AutoTransform.cpp b/src/osg/AutoTransform.cpp index ee670c14c..4fde14a7e 100644 --- a/src/osg/AutoTransform.cpp +++ b/src/osg/AutoTransform.cpp @@ -182,7 +182,7 @@ void AutoTransform::accept(NodeVisitor& nv) if (getAutoScaleToScreen()) { - double size = 1.0/cs->pixelSize(getPosition(),0.48); + double size = 1.0/cs->pixelSize(getPosition(),0.48f); if (_autoScaleTransitionWidthRatio>0.0) { diff --git a/src/osg/KdTree.cpp b/src/osg/KdTree.cpp index c4010d3e0..64d19ef64 100644 --- a/src/osg/KdTree.cpp +++ b/src/osg/KdTree.cpp @@ -233,7 +233,7 @@ int BuildKdTree::divide(KdTree::BuildOptions& options, osg::BoundingBox& bb, int if (node.bb.valid()) { - float epsilon = 1e-6; + float epsilon = 1e-6f; node.bb._min.x() -= epsilon; node.bb._min.y() -= epsilon; node.bb._min.z() -= epsilon; @@ -505,7 +505,7 @@ void IntersectKdTree::intersect(const KdTree::KdNode& node, const osg::Vec3& ls, float r,r0,r1,r2; - const float esplison = 1e-10; + const float esplison = 1e-10f; if (det>esplison) { float u = (P*T); diff --git a/src/osg/Texture.cpp b/src/osg/Texture.cpp index 972022d1b..ca82246f9 100644 --- a/src/osg/Texture.cpp +++ b/src/osg/Texture.cpp @@ -1637,24 +1637,24 @@ void Texture::Extensions::setupGLExtensions(unsigned int contextID) const char* renderer = (const char*) glGetString(GL_RENDERER); std::string rendererString(renderer ? renderer : ""); - _isMultiTexturingSupported = isGLExtensionOrVersionSupported( contextID,"GL_ARB_multitexture", 1.3) || - isGLExtensionOrVersionSupported(contextID,"GL_EXT_multitexture", 1.3); + _isMultiTexturingSupported = isGLExtensionOrVersionSupported( contextID,"GL_ARB_multitexture", 1.3f) || + isGLExtensionOrVersionSupported(contextID,"GL_EXT_multitexture", 1.3f); _isTextureFilterAnisotropicSupported = isGLExtensionSupported(contextID,"GL_EXT_texture_filter_anisotropic"); - _isTextureCompressionARBSupported = isGLExtensionOrVersionSupported(contextID,"GL_ARB_texture_compression", 1.3); + _isTextureCompressionARBSupported = isGLExtensionOrVersionSupported(contextID,"GL_ARB_texture_compression", 1.3f); _isTextureCompressionS3TCSupported = isGLExtensionSupported(contextID,"GL_EXT_texture_compression_s3tc"); - _isTextureMirroredRepeatSupported = isGLExtensionOrVersionSupported(contextID,"GL_IBM_texture_mirrored_repeat", 1.4) || - isGLExtensionOrVersionSupported(contextID,"GL_ARB_texture_mirrored_repeat", 1.4); + _isTextureMirroredRepeatSupported = isGLExtensionOrVersionSupported(contextID,"GL_IBM_texture_mirrored_repeat", 1.4f) || + isGLExtensionOrVersionSupported(contextID,"GL_ARB_texture_mirrored_repeat", 1.4f); - _isTextureEdgeClampSupported = isGLExtensionOrVersionSupported(contextID,"GL_EXT_texture_edge_clamp", 1.2) || - isGLExtensionOrVersionSupported(contextID,"GL_SGIS_texture_edge_clamp", 1.2); + _isTextureEdgeClampSupported = isGLExtensionOrVersionSupported(contextID,"GL_EXT_texture_edge_clamp", 1.2f) || + isGLExtensionOrVersionSupported(contextID,"GL_SGIS_texture_edge_clamp", 1.2f); - _isTextureBorderClampSupported = isGLExtensionOrVersionSupported(contextID,"GL_ARB_texture_border_clamp", 1.3); + _isTextureBorderClampSupported = isGLExtensionOrVersionSupported(contextID,"GL_ARB_texture_border_clamp", 1.3f); - _isGenerateMipMapSupported = isGLExtensionOrVersionSupported(contextID,"GL_SGIS_generate_mipmap", 1.4); + _isGenerateMipMapSupported = isGLExtensionOrVersionSupported(contextID,"GL_SGIS_generate_mipmap", 1.4f); _isShadowSupported = isGLExtensionSupported(contextID,"GL_ARB_shadow"); diff --git a/src/osgPlugins/bsp/VBSPData.cpp b/src/osgPlugins/bsp/VBSPData.cpp index 7cc95721f..d214ef755 100644 --- a/src/osgPlugins/bsp/VBSPData.cpp +++ b/src/osgPlugins/bsp/VBSPData.cpp @@ -74,7 +74,7 @@ const bsp::Plane & VBSPData::getPlane(int index) const void VBSPData::addVertex(osg::Vec3f & newVertex) { // Scale the vertex from inches up to meter scale - vertex_list.push_back(newVertex * 0.0254); + vertex_list.push_back(newVertex * 0.0254f); } diff --git a/src/osgPlugins/bsp/VBSPGeometry.cpp b/src/osgPlugins/bsp/VBSPGeometry.cpp index 933fbbe81..dafe74d5a 100644 --- a/src/osgPlugins/bsp/VBSPGeometry.cpp +++ b/src/osgPlugins/bsp/VBSPGeometry.cpp @@ -294,13 +294,13 @@ void VBSPGeometry::createDispSurface(Face & face, DisplaceInfo & dispInfo) texVOffset = currentTexInfo.texture_vecs[1][3]; // Scale the texture vectors from inches to meters - texU *= 39.37; - texV *= 39.37; + texU *= 39.37f; + texV *= 39.37f; // Get the size of the texture involved, as the planar texture projection // assumes non-normalized texture coordinates - texUScale = 1.0 / (float)currentTexData.texture_width; - texVScale = 1.0 / (float)currentTexData.texture_height; + texUScale = 1.0f / (float)currentTexData.texture_width; + texVScale = 1.0f / (float)currentTexData.texture_height; // Get the first edge index edgeIndex = face.first_edge; @@ -335,7 +335,7 @@ void VBSPGeometry::createDispSurface(Face & face, DisplaceInfo & dispInfo) for (i = 0; i < 4; i++) { // Calculate the distance of the start position from this vertex - dist = (vertices[i] - dispInfo.start_position * 0.0254).length(); + dist = (vertices[i] - dispInfo.start_position * 0.0254f).length(); // If this is the smallest distance we've seen, remember it if (dist < minDist) @@ -553,13 +553,13 @@ void VBSPGeometry::addFace(int faceIndex) texVOffset = currentTexInfo.texture_vecs[1][3]; // Scale the texture vectors from inches to meters - texU *= 39.37; - texV *= 39.37; + texU *= 39.37f; + texV *= 39.37f; // Get the texture size, as the planar texture projection results in // non-normalized texture coordinates - texUScale = 1.0 / (float)currentTexData.texture_width; - texVScale = 1.0 / (float)currentTexData.texture_height; + texUScale = 1.0f / (float)currentTexData.texture_width; + texVScale = 1.0f / (float)currentTexData.texture_height; // Start with the last edge index, because we need to switch from // clockwise winding (DirectX) to counter-clockwise winding (OpenGL)