Merge branch 'develop' into feature/dualcontouring
This commit is contained in:
commit
54f0856dbe
@ -107,6 +107,7 @@ SET(CORE_INC_FILES
|
|||||||
|
|
||||||
SET(IMPL_SRC_FILES
|
SET(IMPL_SRC_FILES
|
||||||
source/Impl/ErrorHandling.cpp
|
source/Impl/ErrorHandling.cpp
|
||||||
|
source/Impl/Logging.cpp
|
||||||
source/Impl/MarchingCubesTables.cpp
|
source/Impl/MarchingCubesTables.cpp
|
||||||
source/Impl/MinizWrapper.cpp
|
source/Impl/MinizWrapper.cpp
|
||||||
source/Impl/RandomUnitVectors.cpp
|
source/Impl/RandomUnitVectors.cpp
|
||||||
@ -122,6 +123,7 @@ SET(IMPL_INC_FILES
|
|||||||
include/PolyVoxCore/Impl/CompilerCapabilities.h
|
include/PolyVoxCore/Impl/CompilerCapabilities.h
|
||||||
include/PolyVoxCore/Impl/Config.h
|
include/PolyVoxCore/Impl/Config.h
|
||||||
include/PolyVoxCore/Impl/ErrorHandling.h
|
include/PolyVoxCore/Impl/ErrorHandling.h
|
||||||
|
include/PolyVoxCore/Impl/Logging.h
|
||||||
include/PolyVoxCore/Impl/MarchingCubesTables.h
|
include/PolyVoxCore/Impl/MarchingCubesTables.h
|
||||||
include/PolyVoxCore/Impl/MinizWrapper.h
|
include/PolyVoxCore/Impl/MinizWrapper.h
|
||||||
include/PolyVoxCore/Impl/RandomUnitVectors.h
|
include/PolyVoxCore/Impl/RandomUnitVectors.h
|
||||||
|
@ -72,7 +72,7 @@ namespace PolyVox
|
|||||||
uint32_t uMaxNoOfNodes = 10000,
|
uint32_t uMaxNoOfNodes = 10000,
|
||||||
Connectivity requiredConnectivity = TwentySixConnected,
|
Connectivity requiredConnectivity = TwentySixConnected,
|
||||||
polyvox_function<bool (const VolumeType*, const Vector3DInt32&)> funcIsVoxelValidForPath = &aStarDefaultVoxelValidator,
|
polyvox_function<bool (const VolumeType*, const Vector3DInt32&)> funcIsVoxelValidForPath = &aStarDefaultVoxelValidator,
|
||||||
polyvox_function<void (float)> funcProgressCallback = 0
|
polyvox_function<void (float)> funcProgressCallback = nullptr
|
||||||
)
|
)
|
||||||
:volume(volData)
|
:volume(volData)
|
||||||
,start(v3dStart)
|
,start(v3dStart)
|
||||||
|
@ -199,9 +199,9 @@ namespace PolyVox
|
|||||||
lodRecord.endIndex = m_meshCurrent->getNoOfIndices();
|
lodRecord.endIndex = m_meshCurrent->getNoOfIndices();
|
||||||
m_meshCurrent->m_vecLodRecords.push_back(lodRecord);
|
m_meshCurrent->m_vecLodRecords.push_back(lodRecord);
|
||||||
|
|
||||||
logTrace() << "Cubic surface extraction took " << timer.elapsedTimeInMilliSeconds()
|
POLYVOX_LOG_TRACE("Cubic surface extraction took " << timer.elapsedTimeInMilliSeconds()
|
||||||
<< "ms (Region size = " << m_regSizeInVoxels.getWidthInVoxels() << "x" << m_regSizeInVoxels.getHeightInVoxels()
|
<< "ms (Region size = " << m_regSizeInVoxels.getWidthInVoxels() << "x" << m_regSizeInVoxels.getHeightInVoxels()
|
||||||
<< "x" << m_regSizeInVoxels.getDepthInVoxels() << ")";
|
<< "x" << m_regSizeInVoxels.getDepthInVoxels() << ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename VolumeType, typename IsQuadNeeded>
|
template<typename VolumeType, typename IsQuadNeeded>
|
||||||
|
@ -130,8 +130,8 @@ namespace PolyVox
|
|||||||
lodRecord.endIndex = m_meshCurrent->getNoOfIndices();
|
lodRecord.endIndex = m_meshCurrent->getNoOfIndices();
|
||||||
m_meshCurrent->m_vecLodRecords.push_back(lodRecord);
|
m_meshCurrent->m_vecLodRecords.push_back(lodRecord);
|
||||||
|
|
||||||
logTrace() << "Cubic surface extraction took " << timer.elapsedTimeInMilliSeconds()
|
POLYVOX_LOG_TRACE("Cubic surface extraction took " << timer.elapsedTimeInMilliSeconds()
|
||||||
<< "ms (Region size = " << m_regSizeInVoxels.getWidthInVoxels() << "x" << m_regSizeInVoxels.getHeightInVoxels()
|
<< "ms (Region size = " << m_regSizeInVoxels.getWidthInVoxels() << "x" << m_regSizeInVoxels.getHeightInVoxels()
|
||||||
<< "x" << m_regSizeInVoxels.getDepthInVoxels() << ")";
|
<< "x" << m_regSizeInVoxels.getDepthInVoxels() << ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ namespace PolyVox
|
|||||||
FILE* pFile = fopen(filename.c_str(), "rb");
|
FILE* pFile = fopen(filename.c_str(), "rb");
|
||||||
if(pFile)
|
if(pFile)
|
||||||
{
|
{
|
||||||
logTrace() << "Paging in data for " << region;
|
POLYVOX_LOG_TRACE("Paging in data for " << region);
|
||||||
|
|
||||||
fseek(pFile, 0L, SEEK_END);
|
fseek(pFile, 0L, SEEK_END);
|
||||||
size_t fileSizeInBytes = ftell(pFile);
|
size_t fileSizeInBytes = ftell(pFile);
|
||||||
@ -109,7 +109,7 @@ namespace PolyVox
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
logTrace() << "No data found for " << region << " during paging in.";
|
POLYVOX_LOG_TRACE("No data found for " << region << " during paging in.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ namespace PolyVox
|
|||||||
POLYVOX_ASSERT(pBlockData, "Attempting to page out NULL block");
|
POLYVOX_ASSERT(pBlockData, "Attempting to page out NULL block");
|
||||||
//POLYVOX_ASSERT(pBlockData->hasUncompressedData() == false, "Block should not have uncompressed data");
|
//POLYVOX_ASSERT(pBlockData->hasUncompressedData() == false, "Block should not have uncompressed data");
|
||||||
|
|
||||||
logTrace() << "Paging out data for " << region;
|
POLYVOX_LOG_TRACE("Paging out data for " << region);
|
||||||
|
|
||||||
std::stringstream ssFilename;
|
std::stringstream ssFilename;
|
||||||
ssFilename << m_strFolderName << "/" << m_strRandomPrefix << "-"
|
ssFilename << m_strFolderName << "/" << m_strRandomPrefix << "-"
|
||||||
|
@ -24,6 +24,13 @@ freely, subject to the following restrictions:
|
|||||||
#ifndef __PolyVox_Config_H__
|
#ifndef __PolyVox_Config_H__
|
||||||
#define __PolyVox_Config_H__
|
#define __PolyVox_Config_H__
|
||||||
|
|
||||||
|
#define POLYVOX_LOG_TRACE_ENABLED
|
||||||
|
#define POLYVOX_LOG_DEBUG_ENABLED
|
||||||
|
#define POLYVOX_LOG_INFO_ENABLED
|
||||||
|
#define POLYVOX_LOG_WARNING_ENABLED
|
||||||
|
#define POLYVOX_LOG_ERROR_ENABLED
|
||||||
|
#define POLYVOX_LOG_FATAL_ENABLED
|
||||||
|
|
||||||
#define POLYVOX_ASSERTS_ENABLED
|
#define POLYVOX_ASSERTS_ENABLED
|
||||||
#define POLYVOX_THROW_ENABLED
|
#define POLYVOX_THROW_ENABLED
|
||||||
|
|
||||||
|
@ -26,6 +26,8 @@ freely, subject to the following restrictions:
|
|||||||
|
|
||||||
#include "PolyVoxCore/Impl/Config.h"
|
#include "PolyVoxCore/Impl/Config.h"
|
||||||
|
|
||||||
|
#include "PolyVoxCore/Impl/Logging.h"
|
||||||
|
|
||||||
#include <cstdlib> // For std::exit
|
#include <cstdlib> // For std::exit
|
||||||
#include <iostream> // For std::cerr
|
#include <iostream> // For std::cerr
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
@ -61,125 +63,6 @@ freely, subject to the following restrictions:
|
|||||||
|
|
||||||
#define POLYVOX_UNUSED(x) do { (void)sizeof(x); } while(0)
|
#define POLYVOX_UNUSED(x) do { (void)sizeof(x); } while(0)
|
||||||
|
|
||||||
/*
|
|
||||||
* Logging
|
|
||||||
* --------
|
|
||||||
* PolyVox provides basic logging facilities which can be redirected by your application.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define LOG_DECLARATION(name) \
|
|
||||||
std::ostream& log(name)(void); \
|
|
||||||
void set(name)Stream(std::ostream& nameStream);
|
|
||||||
|
|
||||||
namespace PolyVox
|
|
||||||
{
|
|
||||||
namespace Impl
|
|
||||||
{
|
|
||||||
std::ostream*& getTraceStreamInstance();
|
|
||||||
std::ostream*& getDebugStreamInstance();
|
|
||||||
std::ostream*& getInfoStreamInstance();
|
|
||||||
std::ostream*& getWarningStreamInstance();
|
|
||||||
std::ostream*& getErrorStreamInstance();
|
|
||||||
std::ostream*& getFatalStreamInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get a stream which will consume all input without outputting anything.
|
|
||||||
std::ostream* getNullStream(void);
|
|
||||||
|
|
||||||
// These take pointers rather than references to emphasise that the
|
|
||||||
// user needs to keep the target alive as long as PolyVox is writing data.
|
|
||||||
void setTraceStream(std::ostream* pStream);
|
|
||||||
void setDebugStream(std::ostream* pStream);
|
|
||||||
void setInfoStream(std::ostream* pStream);
|
|
||||||
void setWarningStream(std::ostream* pStream);
|
|
||||||
void setErrorStream(std::ostream* pStream);
|
|
||||||
void setFatalStream(std::ostream* pStream);
|
|
||||||
|
|
||||||
// Automatically appending 'std::endl' as described here: http://stackoverflow.com/a/2179782
|
|
||||||
struct logTrace
|
|
||||||
{
|
|
||||||
logTrace(){}
|
|
||||||
~logTrace(){*(Impl::getTraceStreamInstance()) << std::endl;}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
logTrace &operator<<(const T &x)
|
|
||||||
{
|
|
||||||
*(Impl::getTraceStreamInstance()) << x;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Automatically appending 'std::endl' as described here: http://stackoverflow.com/a/2179782
|
|
||||||
struct logDebug
|
|
||||||
{
|
|
||||||
logDebug(){}
|
|
||||||
~logDebug(){*(Impl::getDebugStreamInstance()) << std::endl;}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
logDebug &operator<<(const T &x)
|
|
||||||
{
|
|
||||||
*(Impl::getDebugStreamInstance()) << x;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Automatically appending 'std::endl' as described here: http://stackoverflow.com/a/2179782
|
|
||||||
struct logInfo
|
|
||||||
{
|
|
||||||
logInfo(){}
|
|
||||||
~logInfo(){*(Impl::getInfoStreamInstance()) << std::endl;}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
logInfo &operator<<(const T &x)
|
|
||||||
{
|
|
||||||
*(Impl::getInfoStreamInstance()) << x;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Automatically appending 'std::endl' as described here: http://stackoverflow.com/a/2179782
|
|
||||||
struct logWarning
|
|
||||||
{
|
|
||||||
logWarning(){}
|
|
||||||
~logWarning(){*(Impl::getWarningStreamInstance()) << std::endl;}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
logWarning &operator<<(const T &x)
|
|
||||||
{
|
|
||||||
*(Impl::getWarningStreamInstance()) << x;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Automatically appending 'std::endl' as described here: http://stackoverflow.com/a/2179782
|
|
||||||
struct logError
|
|
||||||
{
|
|
||||||
logError(){}
|
|
||||||
~logError(){*(Impl::getErrorStreamInstance()) << std::endl;}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
logError &operator<<(const T &x)
|
|
||||||
{
|
|
||||||
*(Impl::getErrorStreamInstance()) << x;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Automatically appending 'std::endl' as described here: http://stackoverflow.com/a/2179782
|
|
||||||
struct logFatal
|
|
||||||
{
|
|
||||||
logFatal(){}
|
|
||||||
~logFatal(){*(Impl::getFatalStreamInstance()) << std::endl;}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
logFatal &operator<<(const T &x)
|
|
||||||
{
|
|
||||||
*(Impl::getFatalStreamInstance()) << x;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Assertions
|
* Assertions
|
||||||
* ----------
|
* ----------
|
||||||
|
469
library/PolyVoxCore/include/PolyVoxCore/Impl/Logging.h
Normal file
469
library/PolyVoxCore/include/PolyVoxCore/Impl/Logging.h
Normal file
@ -0,0 +1,469 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
Copyright (c) 2005-2009 David Williams and Matthew Williams
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
|
||||||
|
3. This notice may not be removed or altered from any source
|
||||||
|
distribution.
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __PolyVox_Logging_H__
|
||||||
|
#define __PolyVox_Logging_H__
|
||||||
|
|
||||||
|
#include "PolyVoxCore/Impl/Config.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Logging
|
||||||
|
* --------
|
||||||
|
* PolyVox provides basic logging facilities which can be redirected by your application.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define LOG_DECLARATION(name) \
|
||||||
|
std::ostream& log(name)(void); \
|
||||||
|
void set(name)Stream(std::ostream& nameStream);
|
||||||
|
|
||||||
|
namespace PolyVox
|
||||||
|
{
|
||||||
|
namespace Impl
|
||||||
|
{
|
||||||
|
std::ostream*& getTraceStreamInstance();
|
||||||
|
std::ostream*& getDebugStreamInstance();
|
||||||
|
std::ostream*& getInfoStreamInstance();
|
||||||
|
std::ostream*& getWarningStreamInstance();
|
||||||
|
std::ostream*& getErrorStreamInstance();
|
||||||
|
std::ostream*& getFatalStreamInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get a stream which will consume all input without outputting anything.
|
||||||
|
std::ostream* getNullStream(void);
|
||||||
|
|
||||||
|
// These take pointers rather than references to emphasise that the
|
||||||
|
// user needs to keep the target alive as long as PolyVox is writing data.
|
||||||
|
void setTraceStream(std::ostream* pStream);
|
||||||
|
void setDebugStream(std::ostream* pStream);
|
||||||
|
void setInfoStream(std::ostream* pStream);
|
||||||
|
void setWarningStream(std::ostream* pStream);
|
||||||
|
void setErrorStream(std::ostream* pStream);
|
||||||
|
void setFatalStream(std::ostream* pStream);
|
||||||
|
|
||||||
|
// Automatically appending 'std::endl' as described here: http://stackoverflow.com/a/2179782
|
||||||
|
struct logTrace
|
||||||
|
{
|
||||||
|
logTrace(){}
|
||||||
|
~logTrace(){*(Impl::getTraceStreamInstance()) << std::endl;}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
logTrace &operator<<(const T &x)
|
||||||
|
{
|
||||||
|
*(Impl::getTraceStreamInstance()) << x;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Automatically appending 'std::endl' as described here: http://stackoverflow.com/a/2179782
|
||||||
|
struct logDebug
|
||||||
|
{
|
||||||
|
logDebug(){}
|
||||||
|
~logDebug(){*(Impl::getDebugStreamInstance()) << std::endl;}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
logDebug &operator<<(const T &x)
|
||||||
|
{
|
||||||
|
*(Impl::getDebugStreamInstance()) << x;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Automatically appending 'std::endl' as described here: http://stackoverflow.com/a/2179782
|
||||||
|
struct logInfo
|
||||||
|
{
|
||||||
|
logInfo(){}
|
||||||
|
~logInfo(){*(Impl::getInfoStreamInstance()) << std::endl;}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
logInfo &operator<<(const T &x)
|
||||||
|
{
|
||||||
|
*(Impl::getInfoStreamInstance()) << x;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Automatically appending 'std::endl' as described here: http://stackoverflow.com/a/2179782
|
||||||
|
struct logWarning
|
||||||
|
{
|
||||||
|
logWarning(){}
|
||||||
|
~logWarning(){*(Impl::getWarningStreamInstance()) << std::endl;}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
logWarning &operator<<(const T &x)
|
||||||
|
{
|
||||||
|
*(Impl::getWarningStreamInstance()) << x;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Automatically appending 'std::endl' as described here: http://stackoverflow.com/a/2179782
|
||||||
|
struct logError
|
||||||
|
{
|
||||||
|
logError(){}
|
||||||
|
~logError(){*(Impl::getErrorStreamInstance()) << std::endl;}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
logError &operator<<(const T &x)
|
||||||
|
{
|
||||||
|
*(Impl::getErrorStreamInstance()) << x;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Automatically appending 'std::endl' as described here: http://stackoverflow.com/a/2179782
|
||||||
|
struct logFatal
|
||||||
|
{
|
||||||
|
logFatal(){}
|
||||||
|
~logFatal(){*(Impl::getFatalStreamInstance()) << std::endl;}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
logFatal &operator<<(const T &x)
|
||||||
|
{
|
||||||
|
*(Impl::getFatalStreamInstance()) << x;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef POLYVOX_LOG_TRACE_ENABLED
|
||||||
|
|
||||||
|
#define POLYVOX_LOG_TRACE(message) \
|
||||||
|
/* We use the do...while(0) construct in our macros (for reasons see here: http://stackoverflow.com/a/154138) \
|
||||||
|
but Visual Studio gives unhelpful 'conditional expression is constant' warnings. The recommended solution \
|
||||||
|
(http://stackoverflow.com/a/1946485) is to disable these warnings. */ \
|
||||||
|
POLYVOX_MSC_WARNING_PUSH \
|
||||||
|
POLYVOX_DISABLE_MSC_WARNING(4127) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
/* Appending the 'std::endl' forces the stream to be flushed. */ \
|
||||||
|
*(PolyVox::Impl::getTraceStreamInstance()) << message << std::endl; \
|
||||||
|
} while(0) \
|
||||||
|
POLYVOX_MSC_WARNING_POP
|
||||||
|
|
||||||
|
#define POLYVOX_LOG_TRACE_IF(condition, message) \
|
||||||
|
/* We use the do...while(0) construct in our macros (for reasons see here: http://stackoverflow.com/a/154138) \
|
||||||
|
but Visual Studio gives unhelpful 'conditional expression is constant' warnings. The recommended solution \
|
||||||
|
(http://stackoverflow.com/a/1946485) is to disable these warnings. */ \
|
||||||
|
POLYVOX_MSC_WARNING_PUSH \
|
||||||
|
POLYVOX_DISABLE_MSC_WARNING(4127) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
if ((condition)) \
|
||||||
|
{ \
|
||||||
|
/* Appending the 'std::endl' forces the stream to be flushed. */ \
|
||||||
|
*(PolyVox::Impl::getTraceStreamInstance()) << message << std::endl; \
|
||||||
|
} \
|
||||||
|
} while(0) \
|
||||||
|
POLYVOX_MSC_WARNING_POP
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define POLYVOX_LOG_TRACE(message) \
|
||||||
|
/* We use the do...while(0) construct in our macros (for reasons see here: http://stackoverflow.com/a/154138) \
|
||||||
|
but Visual Studio gives unhelpful 'conditional expression is constant' warnings. The recommended solution \
|
||||||
|
(http://stackoverflow.com/a/1946485) is to disable these warnings. */ \
|
||||||
|
POLYVOX_MSC_WARNING_PUSH \
|
||||||
|
POLYVOX_DISABLE_MSC_WARNING(4127) \
|
||||||
|
do { POLYVOX_UNUSED(message); } while(0) \
|
||||||
|
POLYVOX_MSC_WARNING_POP
|
||||||
|
|
||||||
|
#define POLYVOX_LOG_TRACE_IF(condition, message) \
|
||||||
|
/* We use the do...while(0) construct in our macros (for reasons see here: http://stackoverflow.com/a/154138) \
|
||||||
|
but Visual Studio gives unhelpful 'conditional expression is constant' warnings. The recommended solution \
|
||||||
|
(http://stackoverflow.com/a/1946485) is to disable these warnings. */ \
|
||||||
|
POLYVOX_MSC_WARNING_PUSH \
|
||||||
|
POLYVOX_DISABLE_MSC_WARNING(4127) \
|
||||||
|
do { POLYVOX_UNUSED(condition); POLYVOX_UNUSED(message); } while(0) \
|
||||||
|
POLYVOX_MSC_WARNING_POP
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef POLYVOX_LOG_DEBUG_ENABLED
|
||||||
|
|
||||||
|
#define POLYVOX_LOG_DEBUG(message) \
|
||||||
|
/* We use the do...while(0) construct in our macros (for reasons see here: http://stackoverflow.com/a/154138) \
|
||||||
|
but Visual Studio gives unhelpful 'conditional expression is constant' warnings. The recommended solution \
|
||||||
|
(http://stackoverflow.com/a/1946485) is to disable these warnings. */ \
|
||||||
|
POLYVOX_MSC_WARNING_PUSH \
|
||||||
|
POLYVOX_DISABLE_MSC_WARNING(4127) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
/* Appending the 'std::endl' forces the stream to be flushed. */ \
|
||||||
|
*(PolyVox::Impl::getDebugStreamInstance()) << message << std::endl; \
|
||||||
|
} while(0) \
|
||||||
|
POLYVOX_MSC_WARNING_POP
|
||||||
|
|
||||||
|
#define POLYVOX_LOG_DEBUG_IF(condition, message) \
|
||||||
|
/* We use the do...while(0) construct in our macros (for reasons see here: http://stackoverflow.com/a/154138) \
|
||||||
|
but Visual Studio gives unhelpful 'conditional expression is constant' warnings. The recommended solution \
|
||||||
|
(http://stackoverflow.com/a/1946485) is to disable these warnings. */ \
|
||||||
|
POLYVOX_MSC_WARNING_PUSH \
|
||||||
|
POLYVOX_DISABLE_MSC_WARNING(4127) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
if ((condition)) \
|
||||||
|
{ \
|
||||||
|
/* Appending the 'std::endl' forces the stream to be flushed. */ \
|
||||||
|
*(PolyVox::Impl::getDebugStreamInstance()) << message << std::endl; \
|
||||||
|
} \
|
||||||
|
} while(0) \
|
||||||
|
POLYVOX_MSC_WARNING_POP
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define POLYVOX_LOG_DEBUG(message) \
|
||||||
|
/* We use the do...while(0) construct in our macros (for reasons see here: http://stackoverflow.com/a/154138) \
|
||||||
|
but Visual Studio gives unhelpful 'conditional expression is constant' warnings. The recommended solution \
|
||||||
|
(http://stackoverflow.com/a/1946485) is to disable these warnings. */ \
|
||||||
|
POLYVOX_MSC_WARNING_PUSH \
|
||||||
|
POLYVOX_DISABLE_MSC_WARNING(4127) \
|
||||||
|
do { POLYVOX_UNUSED(message); } while(0) \
|
||||||
|
POLYVOX_MSC_WARNING_POP
|
||||||
|
|
||||||
|
#define POLYVOX_LOG_DEBUG_IF(condition, message) \
|
||||||
|
/* We use the do...while(0) construct in our macros (for reasons see here: http://stackoverflow.com/a/154138) \
|
||||||
|
but Visual Studio gives unhelpful 'conditional expression is constant' warnings. The recommended solution \
|
||||||
|
(http://stackoverflow.com/a/1946485) is to disable these warnings. */ \
|
||||||
|
POLYVOX_MSC_WARNING_PUSH \
|
||||||
|
POLYVOX_DISABLE_MSC_WARNING(4127) \
|
||||||
|
do { POLYVOX_UNUSED(condition); POLYVOX_UNUSED(message); } while(0) \
|
||||||
|
POLYVOX_MSC_WARNING_POP
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef POLYVOX_LOG_INFO_ENABLED
|
||||||
|
|
||||||
|
#define POLYVOX_LOG_INFO(message) \
|
||||||
|
/* We use the do...while(0) construct in our macros (for reasons see here: http://stackoverflow.com/a/154138) \
|
||||||
|
but Visual Studio gives unhelpful 'conditional expression is constant' warnings. The recommended solution \
|
||||||
|
(http://stackoverflow.com/a/1946485) is to disable these warnings. */ \
|
||||||
|
POLYVOX_MSC_WARNING_PUSH \
|
||||||
|
POLYVOX_DISABLE_MSC_WARNING(4127) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
/* Appending the 'std::endl' forces the stream to be flushed. */ \
|
||||||
|
*(PolyVox::Impl::getInfoStreamInstance()) << message << std::endl; \
|
||||||
|
} while(0) \
|
||||||
|
POLYVOX_MSC_WARNING_POP
|
||||||
|
|
||||||
|
#define POLYVOX_LOG_INFO_IF(condition, message) \
|
||||||
|
/* We use the do...while(0) construct in our macros (for reasons see here: http://stackoverflow.com/a/154138) \
|
||||||
|
but Visual Studio gives unhelpful 'conditional expression is constant' warnings. The recommended solution \
|
||||||
|
(http://stackoverflow.com/a/1946485) is to disable these warnings. */ \
|
||||||
|
POLYVOX_MSC_WARNING_PUSH \
|
||||||
|
POLYVOX_DISABLE_MSC_WARNING(4127) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
if ((condition)) \
|
||||||
|
{ \
|
||||||
|
/* Appending the 'std::endl' forces the stream to be flushed. */ \
|
||||||
|
*(PolyVox::Impl::getInfoStreamInstance()) << message << std::endl; \
|
||||||
|
} \
|
||||||
|
} while(0) \
|
||||||
|
POLYVOX_MSC_WARNING_POP
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define POLYVOX_LOG_INFO(message) \
|
||||||
|
/* We use the do...while(0) construct in our macros (for reasons see here: http://stackoverflow.com/a/154138) \
|
||||||
|
but Visual Studio gives unhelpful 'conditional expression is constant' warnings. The recommended solution \
|
||||||
|
(http://stackoverflow.com/a/1946485) is to disable these warnings. */ \
|
||||||
|
POLYVOX_MSC_WARNING_PUSH \
|
||||||
|
POLYVOX_DISABLE_MSC_WARNING(4127) \
|
||||||
|
do { POLYVOX_UNUSED(message); } while(0) \
|
||||||
|
POLYVOX_MSC_WARNING_POP
|
||||||
|
|
||||||
|
#define POLYVOX_LOG_INFO_IF(condition, message) \
|
||||||
|
/* We use the do...while(0) construct in our macros (for reasons see here: http://stackoverflow.com/a/154138) \
|
||||||
|
but Visual Studio gives unhelpful 'conditional expression is constant' warnings. The recommended solution \
|
||||||
|
(http://stackoverflow.com/a/1946485) is to disable these warnings. */ \
|
||||||
|
POLYVOX_MSC_WARNING_PUSH \
|
||||||
|
POLYVOX_DISABLE_MSC_WARNING(4127) \
|
||||||
|
do { POLYVOX_UNUSED(condition); POLYVOX_UNUSED(message); } while(0) \
|
||||||
|
POLYVOX_MSC_WARNING_POP
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef POLYVOX_LOG_WARNING_ENABLED
|
||||||
|
|
||||||
|
#define POLYVOX_LOG_WARNING(message) \
|
||||||
|
/* We use the do...while(0) construct in our macros (for reasons see here: http://stackoverflow.com/a/154138) \
|
||||||
|
but Visual Studio gives unhelpful 'conditional expression is constant' warnings. The recommended solution \
|
||||||
|
(http://stackoverflow.com/a/1946485) is to disable these warnings. */ \
|
||||||
|
POLYVOX_MSC_WARNING_PUSH \
|
||||||
|
POLYVOX_DISABLE_MSC_WARNING(4127) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
/* Appending the 'std::endl' forces the stream to be flushed. */ \
|
||||||
|
*(PolyVox::Impl::getWarningStreamInstance()) << message << std::endl; \
|
||||||
|
} while(0) \
|
||||||
|
POLYVOX_MSC_WARNING_POP
|
||||||
|
|
||||||
|
#define POLYVOX_LOG_WARNING_IF(condition, message) \
|
||||||
|
/* We use the do...while(0) construct in our macros (for reasons see here: http://stackoverflow.com/a/154138) \
|
||||||
|
but Visual Studio gives unhelpful 'conditional expression is constant' warnings. The recommended solution \
|
||||||
|
(http://stackoverflow.com/a/1946485) is to disable these warnings. */ \
|
||||||
|
POLYVOX_MSC_WARNING_PUSH \
|
||||||
|
POLYVOX_DISABLE_MSC_WARNING(4127) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
if ((condition)) \
|
||||||
|
{ \
|
||||||
|
/* Appending the 'std::endl' forces the stream to be flushed. */ \
|
||||||
|
*(PolyVox::Impl::getWarningStreamInstance()) << message << std::endl; \
|
||||||
|
} \
|
||||||
|
} while(0) \
|
||||||
|
POLYVOX_MSC_WARNING_POP
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define POLYVOX_LOG_WARNING(message) \
|
||||||
|
/* We use the do...while(0) construct in our macros (for reasons see here: http://stackoverflow.com/a/154138) \
|
||||||
|
but Visual Studio gives unhelpful 'conditional expression is constant' warnings. The recommended solution \
|
||||||
|
(http://stackoverflow.com/a/1946485) is to disable these warnings. */ \
|
||||||
|
POLYVOX_MSC_WARNING_PUSH \
|
||||||
|
POLYVOX_DISABLE_MSC_WARNING(4127) \
|
||||||
|
do { POLYVOX_UNUSED(message); } while(0) \
|
||||||
|
POLYVOX_MSC_WARNING_POP
|
||||||
|
|
||||||
|
#define POLYVOX_LOG_WARNING_IF(condition, message) \
|
||||||
|
/* We use the do...while(0) construct in our macros (for reasons see here: http://stackoverflow.com/a/154138) \
|
||||||
|
but Visual Studio gives unhelpful 'conditional expression is constant' warnings. The recommended solution \
|
||||||
|
(http://stackoverflow.com/a/1946485) is to disable these warnings. */ \
|
||||||
|
POLYVOX_MSC_WARNING_PUSH \
|
||||||
|
POLYVOX_DISABLE_MSC_WARNING(4127) \
|
||||||
|
do { POLYVOX_UNUSED(condition); POLYVOX_UNUSED(message); } while(0) \
|
||||||
|
POLYVOX_MSC_WARNING_POP
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef POLYVOX_LOG_ERROR_ENABLED
|
||||||
|
|
||||||
|
#define POLYVOX_LOG_ERROR(message) \
|
||||||
|
/* We use the do...while(0) construct in our macros (for reasons see here: http://stackoverflow.com/a/154138) \
|
||||||
|
but Visual Studio gives unhelpful 'conditional expression is constant' warnings. The recommended solution \
|
||||||
|
(http://stackoverflow.com/a/1946485) is to disable these warnings. */ \
|
||||||
|
POLYVOX_MSC_WARNING_PUSH \
|
||||||
|
POLYVOX_DISABLE_MSC_WARNING(4127) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
/* Appending the 'std::endl' forces the stream to be flushed. */ \
|
||||||
|
*(PolyVox::Impl::getErrorStreamInstance()) << message << std::endl; \
|
||||||
|
} while(0) \
|
||||||
|
POLYVOX_MSC_WARNING_POP
|
||||||
|
|
||||||
|
#define POLYVOX_LOG_ERROR_IF(condition, message) \
|
||||||
|
/* We use the do...while(0) construct in our macros (for reasons see here: http://stackoverflow.com/a/154138) \
|
||||||
|
but Visual Studio gives unhelpful 'conditional expression is constant' warnings. The recommended solution \
|
||||||
|
(http://stackoverflow.com/a/1946485) is to disable these warnings. */ \
|
||||||
|
POLYVOX_MSC_WARNING_PUSH \
|
||||||
|
POLYVOX_DISABLE_MSC_WARNING(4127) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
if ((condition)) \
|
||||||
|
{ \
|
||||||
|
/* Appending the 'std::endl' forces the stream to be flushed. */ \
|
||||||
|
*(PolyVox::Impl::getErrorStreamInstance()) << message << std::endl; \
|
||||||
|
} \
|
||||||
|
} while(0) \
|
||||||
|
POLYVOX_MSC_WARNING_POP
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define POLYVOX_LOG_ERROR(message) \
|
||||||
|
/* We use the do...while(0) construct in our macros (for reasons see here: http://stackoverflow.com/a/154138) \
|
||||||
|
but Visual Studio gives unhelpful 'conditional expression is constant' warnings. The recommended solution \
|
||||||
|
(http://stackoverflow.com/a/1946485) is to disable these warnings. */ \
|
||||||
|
POLYVOX_MSC_WARNING_PUSH \
|
||||||
|
POLYVOX_DISABLE_MSC_WARNING(4127) \
|
||||||
|
do { POLYVOX_UNUSED(message); } while(0) \
|
||||||
|
POLYVOX_MSC_WARNING_POP
|
||||||
|
|
||||||
|
#define POLYVOX_LOG_ERROR_IF(condition, message) \
|
||||||
|
/* We use the do...while(0) construct in our macros (for reasons see here: http://stackoverflow.com/a/154138) \
|
||||||
|
but Visual Studio gives unhelpful 'conditional expression is constant' warnings. The recommended solution \
|
||||||
|
(http://stackoverflow.com/a/1946485) is to disable these warnings. */ \
|
||||||
|
POLYVOX_MSC_WARNING_PUSH \
|
||||||
|
POLYVOX_DISABLE_MSC_WARNING(4127) \
|
||||||
|
do { POLYVOX_UNUSED(condition); POLYVOX_UNUSED(message); } while(0) \
|
||||||
|
POLYVOX_MSC_WARNING_POP
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef POLYVOX_LOG_FATAL_ENABLED
|
||||||
|
|
||||||
|
#define POLYVOX_LOG_FATAL(message) \
|
||||||
|
/* We use the do...while(0) construct in our macros (for reasons see here: http://stackoverflow.com/a/154138) \
|
||||||
|
but Visual Studio gives unhelpful 'conditional expression is constant' warnings. The recommended solution \
|
||||||
|
(http://stackoverflow.com/a/1946485) is to disable these warnings. */ \
|
||||||
|
POLYVOX_MSC_WARNING_PUSH \
|
||||||
|
POLYVOX_DISABLE_MSC_WARNING(4127) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
/* Appending the 'std::endl' forces the stream to be flushed. */ \
|
||||||
|
*(PolyVox::Impl::getFatalStreamInstance()) << message << std::endl; \
|
||||||
|
} while(0) \
|
||||||
|
POLYVOX_MSC_WARNING_POP
|
||||||
|
|
||||||
|
#define POLYVOX_LOG_FATAL_IF(condition, message) \
|
||||||
|
/* We use the do...while(0) construct in our macros (for reasons see here: http://stackoverflow.com/a/154138) \
|
||||||
|
but Visual Studio gives unhelpful 'conditional expression is constant' warnings. The recommended solution \
|
||||||
|
(http://stackoverflow.com/a/1946485) is to disable these warnings. */ \
|
||||||
|
POLYVOX_MSC_WARNING_PUSH \
|
||||||
|
POLYVOX_DISABLE_MSC_WARNING(4127) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
if ((condition)) \
|
||||||
|
{ \
|
||||||
|
/* Appending the 'std::endl' forces the stream to be flushed. */ \
|
||||||
|
*(PolyVox::Impl::getFatalStreamInstance()) << message << std::endl; \
|
||||||
|
} \
|
||||||
|
} while(0) \
|
||||||
|
POLYVOX_MSC_WARNING_POP
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define POLYVOX_LOG_FATAL(message) \
|
||||||
|
/* We use the do...while(0) construct in our macros (for reasons see here: http://stackoverflow.com/a/154138) \
|
||||||
|
but Visual Studio gives unhelpful 'conditional expression is constant' warnings. The recommended solution \
|
||||||
|
(http://stackoverflow.com/a/1946485) is to disable these warnings. */ \
|
||||||
|
POLYVOX_MSC_WARNING_PUSH \
|
||||||
|
POLYVOX_DISABLE_MSC_WARNING(4127) \
|
||||||
|
do { POLYVOX_UNUSED(message); } while(0) \
|
||||||
|
POLYVOX_MSC_WARNING_POP
|
||||||
|
|
||||||
|
#define POLYVOX_LOG_FATAL_IF(condition, message) \
|
||||||
|
/* We use the do...while(0) construct in our macros (for reasons see here: http://stackoverflow.com/a/154138) \
|
||||||
|
but Visual Studio gives unhelpful 'conditional expression is constant' warnings. The recommended solution \
|
||||||
|
(http://stackoverflow.com/a/1946485) is to disable these warnings. */ \
|
||||||
|
POLYVOX_MSC_WARNING_PUSH \
|
||||||
|
POLYVOX_DISABLE_MSC_WARNING(4127) \
|
||||||
|
do { POLYVOX_UNUSED(condition); POLYVOX_UNUSED(message); } while(0) \
|
||||||
|
POLYVOX_MSC_WARNING_POP
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif //__PolyVox_Logging_H__
|
@ -130,9 +130,9 @@ namespace PolyVox
|
|||||||
lodRecord.endIndex = m_meshCurrent->getNoOfIndices();
|
lodRecord.endIndex = m_meshCurrent->getNoOfIndices();
|
||||||
m_meshCurrent->m_vecLodRecords.push_back(lodRecord);
|
m_meshCurrent->m_vecLodRecords.push_back(lodRecord);
|
||||||
|
|
||||||
logTrace() << "Marching cubes surface extraction took " << timer.elapsedTimeInMilliSeconds()
|
POLYVOX_LOG_TRACE("Marching cubes surface extraction took " << timer.elapsedTimeInMilliSeconds()
|
||||||
<< "ms (Region size = " << m_regSizeInVoxels.getWidthInVoxels() << "x" << m_regSizeInVoxels.getHeightInVoxels()
|
<< "ms (Region size = " << m_regSizeInVoxels.getWidthInVoxels() << "x" << m_regSizeInVoxels.getHeightInVoxels()
|
||||||
<< "x" << m_regSizeInVoxels.getDepthInVoxels() << ")";
|
<< "x" << m_regSizeInVoxels.getDepthInVoxels() << ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename VolumeType, typename Controller>
|
template<typename VolumeType, typename Controller>
|
||||||
|
@ -25,93 +25,6 @@ freely, subject to the following restrictions:
|
|||||||
|
|
||||||
namespace PolyVox
|
namespace PolyVox
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* \return A pointer to the null stream.
|
|
||||||
*/
|
|
||||||
std::ostream* getNullStream(void)
|
|
||||||
{
|
|
||||||
// Passing zero to the stream constructor guarentees it will discard all input. See
|
|
||||||
// here http://stackoverflow.com/a/8244052 and here http://stackoverflow.com/a/6240980
|
|
||||||
static std::ostream s_NullStream(0);
|
|
||||||
return &s_NullStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
// These create the global stream instances, created on demand.
|
|
||||||
namespace Impl
|
|
||||||
{
|
|
||||||
std::ostream*& getTraceStreamInstance()
|
|
||||||
{
|
|
||||||
static std::ostream* s_pTraceStream = getNullStream();
|
|
||||||
return s_pTraceStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostream*& getDebugStreamInstance()
|
|
||||||
{
|
|
||||||
static std::ostream* s_pDebugStream = getNullStream();
|
|
||||||
return s_pDebugStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostream*& getInfoStreamInstance()
|
|
||||||
{
|
|
||||||
static std::ostream* s_pInfoStream = &(std::cout);
|
|
||||||
return s_pInfoStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostream*& getWarningStreamInstance()
|
|
||||||
{
|
|
||||||
static std::ostream* s_pWarningStream = &(std::cerr);
|
|
||||||
return s_pWarningStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostream*& getErrorStreamInstance()
|
|
||||||
{
|
|
||||||
static std::ostream* s_pErrorStream = &(std::cerr);
|
|
||||||
return s_pErrorStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostream*& getFatalStreamInstance()
|
|
||||||
{
|
|
||||||
static std::ostream* s_pFatalStream = &(std::cerr);
|
|
||||||
return s_pFatalStream;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void setTraceStream(std::ostream* pStream)
|
|
||||||
{
|
|
||||||
Impl::getTraceStreamInstance() = pStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setDebugStream(std::ostream* pStream)
|
|
||||||
{
|
|
||||||
Impl::getDebugStreamInstance() = pStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setInfoStream(std::ostream* pStream)
|
|
||||||
{
|
|
||||||
Impl::getInfoStreamInstance() = pStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setWarningStream(std::ostream* pStream)
|
|
||||||
{
|
|
||||||
Impl::getWarningStreamInstance() = pStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setErrorStream(std::ostream* pStream)
|
|
||||||
{
|
|
||||||
Impl::getErrorStreamInstance() = pStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fatal stream for logging
|
|
||||||
std::ostream*& getFatalStreamInstance()
|
|
||||||
{
|
|
||||||
static std::ostream* s_pFatalStream = &(std::cerr);
|
|
||||||
return s_pFatalStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setFatalStream(std::ostream* pStream)
|
|
||||||
{
|
|
||||||
getFatalStreamInstance() = pStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef POLYVOX_THROW_ENABLED
|
#ifndef POLYVOX_THROW_ENABLED
|
||||||
void defaultThrowHandler(std::exception& e, const char* file, int line)
|
void defaultThrowHandler(std::exception& e, const char* file, int line)
|
||||||
|
115
library/PolyVoxCore/source/Impl/Logging.cpp
Normal file
115
library/PolyVoxCore/source/Impl/Logging.cpp
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
Copyright (c) 2005-2009 David Williams and Matthew Williams
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
|
||||||
|
3. This notice may not be removed or altered from any source
|
||||||
|
distribution.
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include "PolyVoxCore/Impl/Logging.h"
|
||||||
|
|
||||||
|
namespace PolyVox
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* \return A pointer to the null stream.
|
||||||
|
*/
|
||||||
|
std::ostream* getNullStream(void)
|
||||||
|
{
|
||||||
|
// Passing zero to the stream constructor guarentees it will discard all input. See
|
||||||
|
// here http://stackoverflow.com/a/8244052 and here http://stackoverflow.com/a/6240980
|
||||||
|
static std::ostream s_NullStream(0);
|
||||||
|
return &s_NullStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
// These create the global stream instances, created on demand.
|
||||||
|
namespace Impl
|
||||||
|
{
|
||||||
|
std::ostream*& getTraceStreamInstance()
|
||||||
|
{
|
||||||
|
static std::ostream* s_pTraceStream = getNullStream();
|
||||||
|
return s_pTraceStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ostream*& getDebugStreamInstance()
|
||||||
|
{
|
||||||
|
static std::ostream* s_pDebugStream = getNullStream();
|
||||||
|
return s_pDebugStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ostream*& getInfoStreamInstance()
|
||||||
|
{
|
||||||
|
static std::ostream* s_pInfoStream = &(std::cout);
|
||||||
|
return s_pInfoStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ostream*& getWarningStreamInstance()
|
||||||
|
{
|
||||||
|
static std::ostream* s_pWarningStream = &(std::cerr);
|
||||||
|
return s_pWarningStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ostream*& getErrorStreamInstance()
|
||||||
|
{
|
||||||
|
static std::ostream* s_pErrorStream = &(std::cerr);
|
||||||
|
return s_pErrorStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ostream*& getFatalStreamInstance()
|
||||||
|
{
|
||||||
|
static std::ostream* s_pFatalStream = &(std::cerr);
|
||||||
|
return s_pFatalStream;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setTraceStream(std::ostream* pStream)
|
||||||
|
{
|
||||||
|
Impl::getTraceStreamInstance() = pStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setDebugStream(std::ostream* pStream)
|
||||||
|
{
|
||||||
|
Impl::getDebugStreamInstance() = pStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setInfoStream(std::ostream* pStream)
|
||||||
|
{
|
||||||
|
Impl::getInfoStreamInstance() = pStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setWarningStream(std::ostream* pStream)
|
||||||
|
{
|
||||||
|
Impl::getWarningStreamInstance() = pStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setErrorStream(std::ostream* pStream)
|
||||||
|
{
|
||||||
|
Impl::getErrorStreamInstance() = pStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fatal stream for logging
|
||||||
|
std::ostream*& getFatalStreamInstance()
|
||||||
|
{
|
||||||
|
static std::ostream* s_pFatalStream = &(std::cerr);
|
||||||
|
return s_pFatalStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setFatalStream(std::ostream* pStream)
|
||||||
|
{
|
||||||
|
getFatalStreamInstance() = pStream;
|
||||||
|
}
|
||||||
|
}
|
@ -37,6 +37,12 @@ MACRO(CREATE_TEST headerfile sourcefile executablename)
|
|||||||
SET(LATEST_TEST ${CMAKE_CURRENT_BINARY_DIR}/${executablename})
|
SET(LATEST_TEST ${CMAKE_CURRENT_BINARY_DIR}/${executablename})
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
SET_PROPERTY(TARGET ${executablename} PROPERTY FOLDER "Tests")
|
SET_PROPERTY(TARGET ${executablename} PROPERTY FOLDER "Tests")
|
||||||
|
|
||||||
|
IF(${XML_TEST_OUTPUT})
|
||||||
|
ADD_TEST(${executablename} ${LATEST_TEST} -xunitxml)
|
||||||
|
ELSE()
|
||||||
|
ADD_TEST(${executablename} ${LATEST_TEST})
|
||||||
|
ENDIF()
|
||||||
ENDMACRO(CREATE_TEST)
|
ENDMACRO(CREATE_TEST)
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(${PolyVoxCore_BINARY_DIR}/include ${PolyVox_SOURCE_DIR}/PolyVoxCore/include ${CMAKE_CURRENT_BINARY_DIR})
|
INCLUDE_DIRECTORIES(${PolyVoxCore_BINARY_DIR}/include ${PolyVox_SOURCE_DIR}/PolyVoxCore/include ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
@ -64,78 +70,37 @@ ENDIF()
|
|||||||
|
|
||||||
# AmbientOcclusionGenerator tests
|
# AmbientOcclusionGenerator tests
|
||||||
CREATE_TEST(TestAmbientOcclusionGenerator.h TestAmbientOcclusionGenerator.cpp TestAmbientOcclusionGenerator)
|
CREATE_TEST(TestAmbientOcclusionGenerator.h TestAmbientOcclusionGenerator.cpp TestAmbientOcclusionGenerator)
|
||||||
ADD_TEST(AmbientOcclusionGeneratorExecuteTest ${LATEST_TEST} testExecute)
|
|
||||||
|
|
||||||
# Array tests
|
# Array tests
|
||||||
CREATE_TEST(TestArray.h TestArray.cpp TestArray)
|
CREATE_TEST(TestArray.h TestArray.cpp TestArray)
|
||||||
ADD_TEST(ArrayReadWriteTest ${LATEST_TEST} testReadWrite)
|
|
||||||
|
|
||||||
# AStarPathfinder tests
|
# AStarPathfinder tests
|
||||||
CREATE_TEST(TestAStarPathfinder.h TestAStarPathfinder.cpp TestAStarPathfinder)
|
CREATE_TEST(TestAStarPathfinder.h TestAStarPathfinder.cpp TestAStarPathfinder)
|
||||||
ADD_TEST(AStarPathfinderExecuteTest ${LATEST_TEST} testExecute)
|
|
||||||
|
|
||||||
CREATE_TEST(TestCubicSurfaceExtractor.h TestCubicSurfaceExtractor.cpp TestCubicSurfaceExtractor)
|
CREATE_TEST(TestCubicSurfaceExtractor.h TestCubicSurfaceExtractor.cpp TestCubicSurfaceExtractor)
|
||||||
ADD_TEST(CubicSurfaceExtractorExecuteTest ${LATEST_TEST} testExecute)
|
|
||||||
|
|
||||||
# Low pass filter tests
|
# Low pass filter tests
|
||||||
CREATE_TEST(TestLowPassFilter.h TestLowPassFilter.cpp TestLowPassFilter)
|
CREATE_TEST(TestLowPassFilter.h TestLowPassFilter.cpp TestLowPassFilter)
|
||||||
ADD_TEST(LowPassFilterExecuteTest ${LATEST_TEST} testExecute)
|
|
||||||
|
|
||||||
# Material tests
|
# Material tests
|
||||||
CREATE_TEST(testmaterial.h testmaterial.cpp testmaterial)
|
CREATE_TEST(testmaterial.h testmaterial.cpp testmaterial)
|
||||||
ADD_TEST(MaterialTestCompile ${LATEST_TEST} testCompile)
|
|
||||||
|
|
||||||
# Raycast tests
|
# Raycast tests
|
||||||
CREATE_TEST(TestRaycast.h TestRaycast.cpp TestRaycast)
|
CREATE_TEST(TestRaycast.h TestRaycast.cpp TestRaycast)
|
||||||
ADD_TEST(RaycastExecuteTest ${LATEST_TEST} testExecute)
|
|
||||||
|
|
||||||
# Picking tests
|
# Picking tests
|
||||||
CREATE_TEST(TestPicking.h TestPicking.cpp TestPicking)
|
CREATE_TEST(TestPicking.h TestPicking.cpp TestPicking)
|
||||||
ADD_TEST(PickingExecuteTest ${LATEST_TEST} testExecute)
|
|
||||||
|
|
||||||
# Region tests
|
# Region tests
|
||||||
CREATE_TEST(TestRegion.h TestRegion.cpp TestRegion)
|
CREATE_TEST(TestRegion.h TestRegion.cpp TestRegion)
|
||||||
ADD_TEST(RegionEqualityTest ${LATEST_TEST} testEquality)
|
|
||||||
|
|
||||||
CREATE_TEST(TestSurfaceExtractor.h TestSurfaceExtractor.cpp TestSurfaceExtractor)
|
CREATE_TEST(TestSurfaceExtractor.h TestSurfaceExtractor.cpp TestSurfaceExtractor)
|
||||||
ADD_TEST(SurfaceExtractorExecuteTest ${LATEST_TEST} testExecute)
|
|
||||||
|
|
||||||
#Vector tests
|
#Vector tests
|
||||||
CREATE_TEST(testvector.h testvector.cpp testvector)
|
CREATE_TEST(testvector.h testvector.cpp testvector)
|
||||||
ADD_TEST(VectorLengthTest ${LATEST_TEST} testLength)
|
|
||||||
ADD_TEST(VectorDotProductTest ${LATEST_TEST} testDotProduct)
|
|
||||||
ADD_TEST(VectorEqualityTest ${LATEST_TEST} testEquality)
|
|
||||||
|
|
||||||
# Volume tests
|
# Volume tests
|
||||||
CREATE_TEST(testvolume.h testvolume.cpp testvolume)
|
CREATE_TEST(testvolume.h testvolume.cpp testvolume)
|
||||||
|
|
||||||
ADD_TEST(RawVolumeDirectAccessAllInternalForwards ${LATEST_TEST} testRawVolumeDirectAccessAllInternalForwards)
|
|
||||||
ADD_TEST(RawVolumeSamplersAllInternalForwards ${LATEST_TEST} testRawVolumeSamplersAllInternalForwards)
|
|
||||||
ADD_TEST(RawVolumeDirectAccessWithExternalForwards ${LATEST_TEST} testRawVolumeDirectAccessWithExternalForwards)
|
|
||||||
ADD_TEST(RawVolumeSamplersWithExternalForwards ${LATEST_TEST} testRawVolumeSamplersWithExternalForwards)
|
|
||||||
ADD_TEST(RawVolumeDirectAccessAllInternalBackwards ${LATEST_TEST} testRawVolumeDirectAccessAllInternalBackwards)
|
|
||||||
ADD_TEST(RawVolumeSamplersAllInternalBackwards ${LATEST_TEST} testRawVolumeSamplersAllInternalBackwards)
|
|
||||||
ADD_TEST(RawVolumeDirectAccessWithExternalBackwards ${LATEST_TEST} testRawVolumeDirectAccessWithExternalBackwards)
|
|
||||||
ADD_TEST(RawVolumeSamplersWithExternalBackwards ${LATEST_TEST} testRawVolumeSamplersWithExternalBackwards)
|
|
||||||
|
|
||||||
ADD_TEST(SimpleVolumeDirectAccessAllInternalForwards ${LATEST_TEST} testSimpleVolumeDirectAccessAllInternalForwards)
|
|
||||||
ADD_TEST(SimpleVolumeSamplersAllInternalForwards ${LATEST_TEST} testSimpleVolumeSamplersAllInternalForwards)
|
|
||||||
ADD_TEST(SimpleVolumeDirectAccessWithExternalForwards ${LATEST_TEST} testSimpleVolumeDirectAccessWithExternalForwards)
|
|
||||||
ADD_TEST(SimpleVolumeSamplersWithExternalForwards ${LATEST_TEST} testSimpleVolumeSamplersWithExternalForwards)
|
|
||||||
ADD_TEST(SimpleVolumeDirectAccessAllInternalBackwards ${LATEST_TEST} testSimpleVolumeDirectAccessAllInternalBackwards)
|
|
||||||
ADD_TEST(SimpleVolumeSamplersAllInternalBackwards ${LATEST_TEST} testSimpleVolumeSamplersAllInternalBackwards)
|
|
||||||
ADD_TEST(SimpleVolumeDirectAccessWithExternalBackwards ${LATEST_TEST} testSimpleVolumeDirectAccessWithExternalBackwards)
|
|
||||||
ADD_TEST(SimpleVolumeSamplersWithExternalBackwards ${LATEST_TEST} testSimpleVolumeSamplersWithExternalBackwards)
|
|
||||||
|
|
||||||
ADD_TEST(LargeVolumeDirectAccessAllInternalForwards ${LATEST_TEST} testLargeVolumeDirectAccessAllInternalForwards)
|
|
||||||
ADD_TEST(LargeVolumeSamplersAllInternalForwards ${LATEST_TEST} testLargeVolumeSamplersAllInternalForwards)
|
|
||||||
ADD_TEST(LargeVolumeDirectAccessWithExternalForwards ${LATEST_TEST} testLargeVolumeDirectAccessWithExternalForwards)
|
|
||||||
ADD_TEST(LargeVolumeSamplersWithExternalForwards ${LATEST_TEST} testLargeVolumeSamplersWithExternalForwards)
|
|
||||||
ADD_TEST(LargeVolumeDirectAccessAllInternalBackwards ${LATEST_TEST} testLargeVolumeDirectAccessAllInternalBackwards)
|
|
||||||
ADD_TEST(LargeVolumeSamplersAllInternalBackwards ${LATEST_TEST} testLargeVolumeSamplersAllInternalBackwards)
|
|
||||||
ADD_TEST(LargeVolumeDirectAccessWithExternalBackwards ${LATEST_TEST} testLargeVolumeDirectAccessWithExternalBackwards)
|
|
||||||
ADD_TEST(LargeVolumeSamplersWithExternalBackwards ${LATEST_TEST} testLargeVolumeSamplersWithExternalBackwards)
|
|
||||||
|
|
||||||
# Volume subclass tests
|
# Volume subclass tests
|
||||||
CREATE_TEST(TestVolumeSubclass.h TestVolumeSubclass.cpp TestVolumeSubclass)
|
CREATE_TEST(TestVolumeSubclass.h TestVolumeSubclass.cpp TestVolumeSubclass)
|
||||||
ADD_TEST(VolumeSubclassExtractSurfaceTest ${LATEST_TEST} testExtractSurface)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user