Initial checkin of Timer class.

This commit is contained in:
David Williams
2013-08-07 23:07:26 +02:00
parent a308102585
commit 9ad4c3fcf7
7 changed files with 182 additions and 0 deletions

View File

@ -21,6 +21,8 @@ freely, subject to the following restrictions:
distribution.
*******************************************************************************/
#include "PolyVoxCore/Impl/Timer.h"
namespace PolyVox
{
// We try to avoid duplicate vertices by checking whether a vertex has already been added at a given position.
@ -48,6 +50,7 @@ namespace PolyVox
template<typename VolumeType, typename IsQuadNeeded>
void CubicSurfaceExtractor<VolumeType, IsQuadNeeded>::execute()
{
Timer timer;
m_meshCurrent->clear();
uint32_t uArrayWidth = m_regSizeInVoxels.getUpperX() - m_regSizeInVoxels.getLowerX() + 2;
@ -195,6 +198,10 @@ namespace PolyVox
lodRecord.beginIndex = 0;
lodRecord.endIndex = m_meshCurrent->getNoOfIndices();
m_meshCurrent->m_vecLodRecords.push_back(lodRecord);
logTrace() << "Cubic surface extraction took " << timer.elapsedTimeInMilliSeconds()
<< "ms (Region size = " << m_regSizeInVoxels.getWidthInVoxels() << "x" << m_regSizeInVoxels.getHeightInVoxels()
<< "x" << m_regSizeInVoxels.getDepthInVoxels() << ")";
}
template<typename VolumeType, typename IsQuadNeeded>

View File

@ -21,6 +21,8 @@ freely, subject to the following restrictions:
distribution.
*******************************************************************************/
#include "PolyVoxCore/Impl/Timer.h"
namespace PolyVox
{
template<typename VolumeType, typename IsQuadNeeded>
@ -38,6 +40,7 @@ namespace PolyVox
template<typename VolumeType, typename IsQuadNeeded>
void CubicSurfaceExtractorWithNormals<VolumeType, IsQuadNeeded>::execute()
{
Timer timer;
m_meshCurrent->clear();
for(int32_t z = m_regSizeInVoxels.getLowerZ(); z < m_regSizeInVoxels.getUpperZ(); z++)
@ -126,5 +129,9 @@ namespace PolyVox
lodRecord.beginIndex = 0;
lodRecord.endIndex = m_meshCurrent->getNoOfIndices();
m_meshCurrent->m_vecLodRecords.push_back(lodRecord);
logTrace() << "Cubic surface extraction took " << timer.elapsedTimeInMilliSeconds()
<< "ms (Region size = " << m_regSizeInVoxels.getWidthInVoxels() << "x" << m_regSizeInVoxels.getHeightInVoxels()
<< "x" << m_regSizeInVoxels.getDepthInVoxels() << ")";
}
}

View File

@ -21,6 +21,8 @@ freely, subject to the following restrictions:
distribution.
*******************************************************************************/
#include "PolyVoxCore/Impl/Timer.h"
namespace PolyVox
{
template<typename VolumeType, typename Controller>
@ -42,6 +44,7 @@ namespace PolyVox
template<typename VolumeType, typename Controller>
void MarchingCubesSurfaceExtractor<VolumeType, Controller>::execute()
{
Timer timer;
m_meshCurrent->clear();
const uint32_t uArrayWidth = m_regSizeInVoxels.getUpperX() - m_regSizeInVoxels.getLowerX() + 1;
@ -126,6 +129,10 @@ namespace PolyVox
lodRecord.beginIndex = 0;
lodRecord.endIndex = m_meshCurrent->getNoOfIndices();
m_meshCurrent->m_vecLodRecords.push_back(lodRecord);
logTrace() << "Marching cubes surface extraction took " << timer.elapsedTimeInMilliSeconds()
<< "ms (Region size = " << m_regSizeInVoxels.getWidthInVoxels() << "x" << m_regSizeInVoxels.getHeightInVoxels()
<< "x" << m_regSizeInVoxels.getDepthInVoxels() << ")";
}
template<typename VolumeType, typename Controller>