From 9ed6ac7da81a33388904e3bf5d1cfb9ae54284a5 Mon Sep 17 00:00:00 2001 From: manuelk Date: Tue, 22 Jan 2013 14:47:46 -0800 Subject: [PATCH] - clean up all unused variables / constructors... - add a -Wall flag, but leave it commented out for now until the same is done for other compilers fixes #96 --- CMakeLists.txt | 2 ++ examples/common/hud.cpp | 1 - examples/glutViewer/viewer.cpp | 22 +++++++-------- .../mayaPtexViewer/OpenSubdivPtexShader.cpp | 18 +++++------- examples/mayaViewer/OpenSubdivShader.cpp | 10 +++---- .../mayaViewer/OpenSubdivShaderOverride.cpp | 1 - examples/ptexViewer/viewer.cpp | 28 +++++++++---------- examples/simpleCpu/simpleCpuSubdivision.cpp | 4 +-- opensubdiv/hbr/fvarData.h | 2 +- opensubdiv/osd/clKernelBundle.cpp | 5 ++-- 10 files changed, 44 insertions(+), 49 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5390060d..54ec2504 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,6 +98,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ) +#add_definitions(-Wall) + # Disable spurrious offsetof warning in gcc builds and clang if (CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") add_definitions("-Wno-invalid-offsetof") diff --git a/examples/common/hud.cpp b/examples/common/hud.cpp index 7c1886fc..b6717dca 100755 --- a/examples/common/hud.cpp +++ b/examples/common/hud.cpp @@ -277,7 +277,6 @@ Hud::drawChar(std::vector &vboSource, int x, int y, float r, float g, flo int Hud::drawString(std::vector &vboSource, int x, int y, float r, float g, float b, const char *c) const { - int numchar = (int)strlen(c); while(*c) { int ch = (*c) & 0x7f; x = drawChar(vboSource, x, y, r, g, b, ch); diff --git a/examples/glutViewer/viewer.cpp b/examples/glutViewer/viewer.cpp index 013bbcde..b2ee28cf 100644 --- a/examples/glutViewer/viewer.cpp +++ b/examples/glutViewer/viewer.cpp @@ -244,7 +244,7 @@ static void initializeShapes( ) { #include -// g_defaultShapes.push_back(SimpleShape(bilinear_cube, "bilinear_cube", kBilinear)); + g_defaultShapes.push_back(SimpleShape(bilinear_cube, "bilinear_cube", kBilinear)); #include g_defaultShapes.push_back(SimpleShape(catmark_cube_corner0, "catmark_cube_corner0", kCatmark)); @@ -424,7 +424,7 @@ updateGeom() { float r = sin(g_frame*0.001f) * g_moveScale; for (int i = 0; i < nverts; ++i) { - float move = 0.05f*cosf(p[0]*20+g_frame*0.01f); + //float move = 0.05f*cosf(p[0]*20+g_frame*0.01f); float ct = cos(p[2] * r); float st = sin(p[2] * r); g_positions[i*3+0] = p[0]*ct + p[1]*st; @@ -899,15 +899,15 @@ bindProgram(Effect effect, OpenSubdiv::OsdPatchArray const & patch) float specular[4]; } lightSource[2]; } lightingData = { - 0.5, 0.2f, 1.0f, 0.0f, - 0.1f, 0.1f, 0.1f, 1.0f, - 0.7f, 0.7f, 0.7f, 1.0f, - 0.8f, 0.8f, 0.8f, 1.0f, - - -0.8f, 0.4f, -1.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f, - 0.5f, 0.5f, 0.5f, 1.0f, - 0.8f, 0.8f, 0.8f, 1.0f, + {{ { 0.5, 0.2f, 1.0f, 0.0f }, + { 0.1f, 0.1f, 0.1f, 1.0f }, + { 0.7f, 0.7f, 0.7f, 1.0f }, + { 0.8f, 0.8f, 0.8f, 1.0f } }, + + { { -0.8f, 0.4f, -1.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f, 1.0f }, + { 0.5f, 0.5f, 0.5f, 1.0f }, + { 0.8f, 0.8f, 0.8f, 1.0f } }} }; if (! g_lightingUB) { glGenBuffers(1, &g_lightingUB); diff --git a/examples/mayaPtexViewer/OpenSubdivPtexShader.cpp b/examples/mayaPtexViewer/OpenSubdivPtexShader.cpp index 65ebb081..62fa00bd 100644 --- a/examples/mayaPtexViewer/OpenSubdivPtexShader.cpp +++ b/examples/mayaPtexViewer/OpenSubdivPtexShader.cpp @@ -362,26 +362,26 @@ EffectDrawRegistry effectRegistry; OpenSubdivPtexShader::OpenSubdivPtexShader() : _level(3), _tessFactor(2), + _adaptive(true), + _wireframe(false), _scheme(OsdPtexMeshData::kCatmark), _kernel(OsdPtexMeshData::kCPU), _interpolateBoundary(OsdPtexMeshData::kInterpolateBoundaryNone), - _adaptive(true), - _wireframe(false), - _ptexColor(NULL), - _ptexDisplacement(NULL), - _ptexOcclusion(NULL), _enableColor(true), _enableDisplacement(true), _enableOcclusion(true), _enableNormal(true), + _ptexColor(NULL), + _ptexDisplacement(NULL), + _ptexOcclusion(NULL), + _shaderSource( defaultShaderSource ), _adaptiveDirty(false), _diffEnvMapDirty(true), _specEnvMapDirty(true), _ptexColorDirty(true), _ptexDisplacementDirty(true), _ptexOcclusionDirty(true), - _shaderSourceDirty(false), - _shaderSource( defaultShaderSource ) + _shaderSourceDirty(false) { } @@ -1111,10 +1111,6 @@ OpenSubdivPtexShader::bindProgram(const MHWRender::MDrawContext & mDrawConte glProgramUniform1i(program, texPages, OCC_TEXTURE_UNIT + 2); } - - MHWRender::MRenderer *theRenderer = MHWRender::MRenderer::theRenderer(); - MHWRender::MTextureManager *theTextureManager = theRenderer->getTextureManager(); - // diffuse environment map if (effectRegistry.getDiffuseEnvironmentId() != 0) { GLint difmap = glGetUniformLocation(program, "diffuseEnvironmentMap"); diff --git a/examples/mayaViewer/OpenSubdivShader.cpp b/examples/mayaViewer/OpenSubdivShader.cpp index ca992104..73843b5d 100644 --- a/examples/mayaViewer/OpenSubdivShader.cpp +++ b/examples/mayaViewer/OpenSubdivShader.cpp @@ -365,17 +365,17 @@ EffectDrawRegistry g_effectRegistry; OpenSubdivShader::OpenSubdivShader() : _level(3), _tessFactor(2), + _adaptive(true), + _wireframe(false), _scheme(OsdMeshData::kCatmark), _kernel(OsdMeshData::kCPU), _interpolateBoundary(OsdMeshData::kInterpolateBoundaryNone), - _adaptive(true), - _wireframe(false), _interpolateUVBoundary(OsdMeshData::kInterpolateBoundaryNone), + _shaderSource( defaultShaderSource ), _hbrMeshDirty(true), _adaptiveDirty(true), _diffuseMapDirty(true), - _shaderSourceDirty(false), - _shaderSource( defaultShaderSource ) + _shaderSourceDirty(false) { } @@ -676,7 +676,7 @@ OpenSubdivShader::draw(const MHWRender::MDrawContext &mDrawContext, for (size_t i = 0; i < patches.size(); ++i) { OpenSubdiv::OsdPatchArray const & patch = patches[i]; - GLint surfaceProgram = bindProgram(mDrawContext, osdDrawContext, patch); + bindProgram(mDrawContext, osdDrawContext, patch); if (patch.desc.type != OpenSubdiv::kNonPatch) { glPatchParameteri(GL_PATCH_VERTICES, patch.patchSize); diff --git a/examples/mayaViewer/OpenSubdivShaderOverride.cpp b/examples/mayaViewer/OpenSubdivShaderOverride.cpp index be028cea..9818eb45 100644 --- a/examples/mayaViewer/OpenSubdivShaderOverride.cpp +++ b/examples/mayaViewer/OpenSubdivShaderOverride.cpp @@ -407,7 +407,6 @@ public: const MComponentDataIndexing &targetIndexing) const { #endif - const MVertexBufferDescriptor &desc = vertexBuffer.descriptor(); MFnMesh meshFn(dagPath); int nVertices = meshFn.numVertices(); diff --git a/examples/ptexViewer/viewer.cpp b/examples/ptexViewer/viewer.cpp index 0f070326..d7cf4b1d 100644 --- a/examples/ptexViewer/viewer.cpp +++ b/examples/ptexViewer/viewer.cpp @@ -262,18 +262,16 @@ OpenSubdiv::OsdGLPtexTexture * g_osdPTexOcclusion = 0; OpenSubdiv::OsdGLPtexTexture * g_osdPTexSpecular = 0; const char * g_ptexColorFilename; -static void +/*static void checkGLErrors(std::string const & where = "") { GLuint err; while ((err = glGetError()) != GL_NO_ERROR) { - /* std::cerr << "GL error: " << (where.empty() ? "" : where + " ") << err << "\n"; - */ } -} +}*/ //------------------------------------------------------------------------------ static void calcNormals(OsdHbrMesh * mesh, std::vector const & pos, std::vector & result ) { @@ -710,7 +708,7 @@ createPtex(const char *filename) { printf("Loading ptex : %s\n", filename); PtexTexture *ptex = PtexTexture::open(filename, ptexError, true); if (ptex == NULL) { - printf("Error in reading %s\n", ptex); + printf("Error in reading %s\n", filename); exit(1); } OpenSubdiv::OsdGLPtexTexture *osdPtex = OpenSubdiv::OsdGLPtexTexture::Create( @@ -938,15 +936,15 @@ bindProgram(Effect effect, OpenSubdiv::OsdPatchArray const & patch) float specular[4]; } lightSource[2]; } lightingData = { - 0.5, 0.2f, 1.0f, 0.0f, - 0.1f, 0.1f, 0.1f, 1.0f, - 0.7f, 0.7f, 0.7f, 1.0f, - 0.8f, 0.8f, 0.8f, 1.0f, - - -0.8f, 0.4f, -1.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f, - 0.5f, 0.5f, 0.5f, 1.0f, - 0.8f, 0.8f, 0.8f, 1.0f, + {{ { 0.5, 0.2f, 1.0f, 0.0f }, + { 0.1f, 0.1f, 0.1f, 1.0f }, + { 0.7f, 0.7f, 0.7f, 1.0f }, + { 0.8f, 0.8f, 0.8f, 1.0f } }, + + { { -0.8f, 0.4f, -1.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f, 1.0f }, + { 0.5f, 0.5f, 0.5f, 1.0f }, + { 0.8f, 0.8f, 0.8f, 1.0f } }} }; if (! g_lightingUB) { glGenBuffers(1, &g_lightingUB); @@ -1043,7 +1041,7 @@ drawModel() { OpenSubdiv::OsdPatchType patchType = patch.desc.type; int patchPattern = patch.desc.pattern; - int patchRotation = patch.desc.rotation; + //int patchRotation = patch.desc.rotation; if (g_mesh->GetDrawContext()->IsAdaptive()) { diff --git a/examples/simpleCpu/simpleCpuSubdivision.cpp b/examples/simpleCpu/simpleCpuSubdivision.cpp index 23e83d48..eabcb798 100644 --- a/examples/simpleCpu/simpleCpuSubdivision.cpp +++ b/examples/simpleCpu/simpleCpuSubdivision.cpp @@ -331,7 +331,7 @@ createOsdContext(int level) // Now, create current face given the number of verts per face and the // face index data. // - OsdHbrFace * face = hmesh->NewFace(VERTS_PER_FACE, faces+i, 0); + /* OsdHbrFace * face = */ hmesh->NewFace(VERTS_PER_FACE, faces+i, 0); // // If you had ptex data, you would set it here, for example @@ -446,7 +446,7 @@ updateGeom() // float r = sin(g_frame*0.001f); for (int i = 0; i < nverts; ++i) { - float move = 0.05f*cosf(p[0]*20+g_frame*0.01f); + //float move = 0.05f*cosf(p[0]*20+g_frame*0.01f); float ct = cos(p[2] * r); float st = sin(p[2] * r); diff --git a/opensubdiv/hbr/fvarData.h b/opensubdiv/hbr/fvarData.h index 05cfd921..df98bb7a 100644 --- a/opensubdiv/hbr/fvarData.h +++ b/opensubdiv/hbr/fvarData.h @@ -76,7 +76,7 @@ template class HbrFVarData { public: HbrFVarData() - : initialized(0), faceid( 0 ) { + : faceid(0), initialized(0) { } ~HbrFVarData() { diff --git a/opensubdiv/osd/clKernelBundle.cpp b/opensubdiv/osd/clKernelBundle.cpp index 9b4ff68b..3e507b70 100644 --- a/opensubdiv/osd/clKernelBundle.cpp +++ b/opensubdiv/osd/clKernelBundle.cpp @@ -84,6 +84,7 @@ namespace OpenSubdiv { namespace OPENSUBDIV_VERSION { OsdCLKernelBundle::OsdCLKernelBundle() : + _clProgram(NULL), _clBilinearEdge(NULL), _clBilinearVertex(NULL), _clCatmarkFace(NULL), @@ -92,8 +93,8 @@ OsdCLKernelBundle::OsdCLKernelBundle() : _clCatmarkVertexB(NULL), _clLoopEdge(NULL), _clLoopVertexA(NULL), - _clLoopVertexB(NULL), - _clProgram(NULL) { + _clLoopVertexB(NULL) + { } OsdCLKernelBundle::~OsdCLKernelBundle() {