From b5814a410c5b8c7c4eaeda11d45213183817159c Mon Sep 17 00:00:00 2001 From: David Williams Date: Thu, 4 Nov 2010 23:25:26 +0000 Subject: [PATCH] Fixed some warnings with patch from AndiNo. --- library/PolyVoxCore/include/Array.h | 6 +-- library/PolyVoxCore/include/Array.inl | 46 +++++++++---------- .../include/CubicSurfaceExtractor.h | 8 ++-- .../include/CubicSurfaceExtractor.inl | 15 +++--- .../include/PolyVoxImpl/SubArray.h | 4 +- .../include/PolyVoxImpl/SubArray.inl | 4 +- 6 files changed, 41 insertions(+), 42 deletions(-) diff --git a/library/PolyVoxCore/include/Array.h b/library/PolyVoxCore/include/Array.h index 80e10f56..b451da5d 100644 --- a/library/PolyVoxCore/include/Array.h +++ b/library/PolyVoxCore/include/Array.h @@ -18,7 +18,7 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source - distribution. + distribution. *******************************************************************************/ #ifndef __PolyVox_Array_H__ @@ -35,7 +35,7 @@ namespace PolyVox /// While C++ provides one-dimensional arrays as a language feature, it does not /// provide a simple and intuitive way of working with multidimensional arrays /// whose sizes are specified at runtime. Such a construct is very useful within - /// the context of PolyVox, and this Array class provides such functionality + /// the context of PolyVox, and this Array class provides such functionality /// implemented via templates and partial specialisation. /// /// The following code snippet illustrates the basic usage of the class by writing @@ -132,7 +132,7 @@ namespace PolyVox void resize(const uint32_t (&pDimensions)[1]); void swap(Array<1, ElementType>& rhs); - + private: Array<1, ElementType>(const Array<1, ElementType>& rhs); diff --git a/library/PolyVoxCore/include/Array.inl b/library/PolyVoxCore/include/Array.inl index ecf28e86..8f70c0b9 100644 --- a/library/PolyVoxCore/include/Array.inl +++ b/library/PolyVoxCore/include/Array.inl @@ -18,7 +18,7 @@ appreciated but is not required. misrepresented as being the original software. 3. This notice may not be removed or altered from any source -distribution. +distribution. *******************************************************************************/ namespace PolyVox @@ -29,12 +29,12 @@ namespace PolyVox //////////////////////////////////////////////////////////////////////////////// template Array::Array() - :m_pElements(0) - ,m_pDimensions(0) + :m_pDimensions(0) ,m_pOffsets(0) ,m_uNoOfElements(0) + ,m_pElements(0) { - } + } //////////////////////////////////////////////////////////////////////////////// /// Creates an array with the specified dimensions. @@ -44,13 +44,13 @@ namespace PolyVox //////////////////////////////////////////////////////////////////////////////// template Array::Array(const uint32_t (&pDimensions)[noOfDims]) - :m_pElements(0) - ,m_pDimensions(0) + :m_pDimensions(0) ,m_pOffsets(0) ,m_uNoOfElements(0) + ,m_pElements(0) { resize(pDimensions); - } + } //////////////////////////////////////////////////////////////////////////////// /// Destroys the array and releases all owned memory. @@ -64,8 +64,8 @@ namespace PolyVox //////////////////////////////////////////////////////////////////////////////// /// An N-dimensional array can be conceptually consists of N subarrays each of which /// has N-1 dimensions. For example, a 3D array conceptually consists of three 2D - /// arrays. This operator is used to access the subarray at the specified index. - /// Crucially, the subarray defines a similar operator allowing them to be chained + /// arrays. This operator is used to access the subarray at the specified index. + /// Crucially, the subarray defines a similar operator allowing them to be chained /// together to convieniently access a particular element. /// \param uIndex The zero-based index of the subarray to retrieve. /// \return The requested SubArray @@ -82,8 +82,8 @@ namespace PolyVox //////////////////////////////////////////////////////////////////////////////// /// An N-dimensional array can be conceptually consists of N subarrays each of which /// has N-1 dimensions. For example, a 3D array conceptually consists of three 2D - /// arrays. This operator is used to access the subarray at the specified index. - /// Crucially, the subarray defines a similar operator allowing them to be chained + /// arrays. This operator is used to access the subarray at the specified index. + /// Crucially, the subarray defines a similar operator allowing them to be chained /// together to convieniently access a particular element. /// \param uIndex The zero-based index of the subarray to retrieve. /// \return The requested SubArray @@ -108,7 +108,7 @@ namespace PolyVox } //////////////////////////////////////////////////////////////////////////////// - /// Sometimes it is useful to directly manipulate the underlying array without + /// Sometimes it is useful to directly manipulate the underlying array without /// going through this classes interface. Although this does not honour the principle /// of encapsulation it can be done safely if you are careful and can sometimes be /// useful. Use getNoOfElements() to determine how far you can safely write. @@ -123,7 +123,7 @@ namespace PolyVox //////////////////////////////////////////////////////////////////////////////// /// Please note that the existing contents of the array will be lost. - /// \param pDimensions The new dimensions of the array. You can also use the + /// \param pDimensions The new dimensions of the array. You can also use the /// ArraySizes class to specify this more easily. /// \sa ArraySizes //////////////////////////////////////////////////////////////////////////////// @@ -141,15 +141,15 @@ namespace PolyVox { assert(pDimensions[i] != 0); - m_uNoOfElements *= pDimensions[i]; + m_uNoOfElements *= pDimensions[i]; m_pDimensions[i] = pDimensions[i]; - m_pOffsets[i] = 1; - for (int k=noOfDims-1; k>i; k--) + m_pOffsets[i] = 1; + for (uint32_t k=noOfDims-1; k>i; k--) { m_pOffsets[i] *= pDimensions[k]; } - } - // Allocate new elements, let exception propagate + } + // Allocate new elements, let exception propagate m_pElements = new ElementType[m_uNoOfElements]; } @@ -198,7 +198,7 @@ namespace PolyVox assert(false); return *this; - } + } template void Array::deallocate(void) @@ -222,7 +222,7 @@ namespace PolyVox : m_pElements(0) ,m_pDimensions(0) { - } + } template Array<1, ElementType>::Array(const uint32_t (&pDimensions)[1]) @@ -269,10 +269,10 @@ namespace PolyVox { deallocate(); - m_pDimensions = new uint32_t[1]; + m_pDimensions = new uint32_t[1]; m_pDimensions[0] = pDimensions[0]; - // Allocate new elements, let exception propagate + // Allocate new elements, let exception propagate m_pElements = new ElementType[m_pDimensions[0]]; } @@ -307,7 +307,7 @@ namespace PolyVox assert(false); return *this; - } + } template void Array<1, ElementType>::deallocate(void) diff --git a/library/PolyVoxCore/include/CubicSurfaceExtractor.h b/library/PolyVoxCore/include/CubicSurfaceExtractor.h index b0a520f6..3e681cca 100644 --- a/library/PolyVoxCore/include/CubicSurfaceExtractor.h +++ b/library/PolyVoxCore/include/CubicSurfaceExtractor.h @@ -18,7 +18,7 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source - distribution. + distribution. *******************************************************************************/ #ifndef __PolyVox_CubicSurfaceExtractor_H__ @@ -53,13 +53,13 @@ namespace PolyVox Volume* m_volData; VolumeSampler m_sampVolume; - //The surface patch we are currently filling. - SurfaceMesh* m_meshCurrent; - //Information about the region we are currently processing Region m_regSizeInVoxels; Region m_regSizeInCells; + //The surface patch we are currently filling. + SurfaceMesh* m_meshCurrent; + //Array<4, IndexAndMaterial> m_vertices; Array<3, IndexAndMaterial> m_previousSliceVertices; Array<3, IndexAndMaterial> m_currentSliceVertices; diff --git a/library/PolyVoxCore/include/CubicSurfaceExtractor.inl b/library/PolyVoxCore/include/CubicSurfaceExtractor.inl index 6245b610..1102f8cd 100644 --- a/library/PolyVoxCore/include/CubicSurfaceExtractor.inl +++ b/library/PolyVoxCore/include/CubicSurfaceExtractor.inl @@ -18,7 +18,7 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source - distribution. + distribution. *******************************************************************************/ #include "Array.h" @@ -48,7 +48,7 @@ namespace PolyVox template void CubicSurfaceExtractor::execute() - { + { uint32_t arraySize[3]= {m_regSizeInVoxels.width()+2, m_regSizeInVoxels.height()+2, MaxQuadsSharingVertex}; m_previousSliceVertices.resize(arraySize); m_currentSliceVertices.resize(arraySize); @@ -99,7 +99,7 @@ namespace PolyVox m_meshCurrent->addTriangleCubic(v0,v2,v1); m_meshCurrent->addTriangleCubic(v1,v2,v3); } - } + } VoxelType negYVoxel = m_volData->getVoxelAt(x,y-1,z); bool negYVoxelIsSolid = negYVoxel.getDensity() >= VoxelType::getThreshold(); @@ -138,7 +138,7 @@ namespace PolyVox uint32_t v3 = addVertex(regX + 0.5f, regY + 0.5f, regZ - 0.5f, material, m_previousSliceVertices); if(currentVoxelIsSolid > negZVoxelIsSolid) - { + { m_meshCurrent->addTriangleCubic(v0,v1,v2); m_meshCurrent->addTriangleCubic(v1,v3,v2); } @@ -169,9 +169,8 @@ namespace PolyVox { uint16_t uX = static_cast(fX + 0.75f); uint16_t uY = static_cast(fY + 0.75f); - uint16_t uZ = static_cast(fZ + 0.75f); - for(int ct = 0; ct < MaxQuadsSharingVertex; ct++) + for(uint32_t ct = 0; ct < MaxQuadsSharingVertex; ct++) { IndexAndMaterial& rEntry = existingVertices[uX][uY][ct]; @@ -180,7 +179,7 @@ namespace PolyVox //If we have an existing vertex and the material matches then we can return it. if((iIndex != -1) && (uMaterial == uMaterialIn)) - { + { return iIndex; } else @@ -199,7 +198,7 @@ namespace PolyVox //If we exit the loop here then apparently all the slots were full but none of //them matched. I don't think this can happen so let's put an assert to make sure. - assert(false); + assert(false); return 0; } } \ No newline at end of file diff --git a/library/PolyVoxCore/include/PolyVoxImpl/SubArray.h b/library/PolyVoxCore/include/PolyVoxImpl/SubArray.h index c51363d0..52b71283 100644 --- a/library/PolyVoxCore/include/PolyVoxImpl/SubArray.h +++ b/library/PolyVoxCore/include/PolyVoxImpl/SubArray.h @@ -18,7 +18,7 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source - distribution. + distribution. *******************************************************************************/ #ifndef __PolyVox_SubArray_H__ @@ -66,7 +66,7 @@ namespace PolyVox ElementType & operator [] (uint32_t uIndex); const ElementType & operator [] (uint32_t uIndex) const; - + private: SubArray<1, ElementType>(ElementType * pElements, uint32_t * pDimensions, uint32_t * /*pOffsets*/); diff --git a/library/PolyVoxCore/include/PolyVoxImpl/SubArray.inl b/library/PolyVoxCore/include/PolyVoxImpl/SubArray.inl index 7417a1c0..398c060b 100644 --- a/library/PolyVoxCore/include/PolyVoxImpl/SubArray.inl +++ b/library/PolyVoxCore/include/PolyVoxImpl/SubArray.inl @@ -45,10 +45,10 @@ namespace PolyVox template SubArray::SubArray(ElementType * pElements, uint32_t * pDimensions, uint32_t * pOffsets) - :m_pElements(pElements) - ,m_pDimensions(pDimensions) + :m_pDimensions(pDimensions) ,m_pOffsets(pOffsets) ,m_uNoOfElements(0) + ,m_pElements(pElements) { }