Fixed some warnings with patch from AndiNo.

This commit is contained in:
David Williams 2010-11-04 23:25:26 +00:00
parent 625bd14187
commit b5814a410c
6 changed files with 41 additions and 42 deletions

View File

@ -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);

View File

@ -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 <uint32_t noOfDims, typename ElementType>
Array<noOfDims, ElementType>::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 <uint32_t noOfDims, typename ElementType>
Array<noOfDims, ElementType>::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 <uint32_t noOfDims, typename ElementType>
void Array<noOfDims, ElementType>::deallocate(void)
@ -222,7 +222,7 @@ namespace PolyVox
: m_pElements(0)
,m_pDimensions(0)
{
}
}
template <typename ElementType>
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 <typename ElementType>
void Array<1, ElementType>::deallocate(void)

View File

@ -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<VoxelType>* m_volData;
VolumeSampler<VoxelType> m_sampVolume;
//The surface patch we are currently filling.
SurfaceMesh<PositionMaterial>* m_meshCurrent;
//Information about the region we are currently processing
Region m_regSizeInVoxels;
Region m_regSizeInCells;
//The surface patch we are currently filling.
SurfaceMesh<PositionMaterial>* m_meshCurrent;
//Array<4, IndexAndMaterial> m_vertices;
Array<3, IndexAndMaterial> m_previousSliceVertices;
Array<3, IndexAndMaterial> m_currentSliceVertices;

View File

@ -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 <typename VoxelType>
void CubicSurfaceExtractor<VoxelType>::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<uint16_t>(fX + 0.75f);
uint16_t uY = static_cast<uint16_t>(fY + 0.75f);
uint16_t uZ = static_cast<uint16_t>(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;
}
}

View File

@ -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*/);

View File

@ -45,10 +45,10 @@ namespace PolyVox
template <uint32_t noOfDims, typename ElementType>
SubArray<noOfDims, ElementType>::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)
{
}