Merge branch 'develop' into feature/cubiquity-version

Conflicts:
	library/PolyVoxCore/include/PolyVoxCore/DefaultIsQuadNeeded.h
This commit is contained in:
Daviw Williams
2014-02-25 16:35:54 +01:00
43 changed files with 38 additions and 604 deletions

View File

@ -22,11 +22,6 @@
PROJECT(PolyVoxCore)
if(NOT MSVC)
#Set up the C++11 feature header file based on the CheckCXX11Features script
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/include/PolyVoxCore/Impl/CompilerCapabilities.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/PolyVoxCore/Impl/CompilerCapabilities.h)
endif()
#Projects source files
SET(CORE_SRC_FILES
source/ArraySizes.cpp
@ -119,7 +114,6 @@ SET(IMPL_INC_FILES
include/PolyVoxCore/Impl/ArraySizesImpl.h
include/PolyVoxCore/Impl/ArraySizesImpl.inl
include/PolyVoxCore/Impl/AStarPathfinderImpl.h
include/PolyVoxCore/Impl/CompilerCapabilities.h
include/PolyVoxCore/Impl/Config.h
include/PolyVoxCore/Impl/ErrorHandling.h
include/PolyVoxCore/Impl/Logging.h

View File

@ -29,6 +29,7 @@ freely, subject to the following restrictions:
#include "PolyVoxCore/Array.h"
#include <functional>
#include <list>
#include <stdexcept> //For runtime_error
@ -71,8 +72,8 @@ namespace PolyVox
float fHBias = 1.0,
uint32_t uMaxNoOfNodes = 10000,
Connectivity requiredConnectivity = TwentySixConnected,
polyvox_function<bool (const VolumeType*, const Vector3DInt32&)> funcIsVoxelValidForPath = &aStarDefaultVoxelValidator,
polyvox_function<void (float)> funcProgressCallback = nullptr
std::function<bool (const VolumeType*, const Vector3DInt32&)> funcIsVoxelValidForPath = &aStarDefaultVoxelValidator,
std::function<void (float)> funcProgressCallback = nullptr
)
:volume(volData)
,start(v3dStart)
@ -126,14 +127,14 @@ namespace PolyVox
/// you could check to ensure that the voxel above is empty and the voxel below is solid.
///
/// \sa aStarDefaultVoxelValidator
polyvox_function<bool (const VolumeType*, const Vector3DInt32&)> isVoxelValidForPath;
std::function<bool (const VolumeType*, const Vector3DInt32&)> isVoxelValidForPath;
/// This function is called by the AStarPathfinder to report on its progress in getting to
/// the goal. The progress is reported by computing the distance from the closest node found
/// so far to the end node, and comparing this with the distance from the start node to the
/// end node. This progress value is guarenteed to never decrease, but it may stop increasing
///for short periods of time. It may even stop increasing altogether if a path cannot be found.
polyvox_function<void (float)> progressCallback;
std::function<void (float)> progressCallback;
};
/// The AStarPathfinder compute a path from one point in the volume to another.

View File

@ -26,6 +26,8 @@ freely, subject to the following restrictions:
#include "PolyVoxCore/Impl/TypeDef.h"
#include <cstdint>
namespace PolyVox
{
template<typename VoxelType>

View File

@ -26,6 +26,8 @@ distribution.
#include "PolyVoxCore/Impl/TypeDef.h"
#include <cstdint>
namespace PolyVox
{
/*

View File

@ -1,23 +0,0 @@
/*
* This file describes the capabilities of the C++ compiler and is used to determine which features to enable in PolyVox.
* It assumes that if the compiler is from VS2008 or earlier then no C++11 is present, otherwise it assumes full support
* is present.
*
* Not that this file is usually overwritten by CMake which does careful tests of the true compiler capabilities. However,
* we provide this default file so that CMake is not actually required for users of PolyVox and they can instead just drop
* PolyVox code into their project/makefile if they prefer.
*/
#ifndef __PolyVox_CompilerCapabilities_H__
#define __PolyVox_CompilerCapabilities_H__
// If we are not using Visual Studio (or we are but it
// is a recent version) then assume support for these.
#if !defined(_MSC_VER) || (_MSC_VER >= 1600)
#define HAS_CXX11_CONSTEXPR
#define HAS_CXX11_STATIC_ASSERT
#define HAS_CXX11_CSTDINT_H
#define HAS_CXX11_SHARED_PTR
#endif
#endif

View File

@ -1,17 +0,0 @@
/*
* This file is an input file for the CMake build system. It is processed and
* placed in the build directory by CMake.
*/
#ifndef __PolyVox_CompilerCapabilities_H__
#define __PolyVox_CompilerCapabilities_H__
#cmakedefine HAS_CXX11_CONSTEXPR
#cmakedefine HAS_CXX11_STATIC_ASSERT
#cmakedefine HAS_CXX11_CSTDINT_H
#cmakedefine HAS_CXX11_SHARED_PTR
#endif

View File

@ -110,35 +110,6 @@ freely, subject to the following restrictions:
#endif
/*
* Static Assertions
* -----------------
* These map to C+11 static_assert if available or our own implentation otherwise.
*/
#if defined(HAS_CXX11_STATIC_ASSERT)
//In this case we can just use static_assert
#define POLYVOX_STATIC_ASSERT static_assert
#else
namespace PolyVox
{
// empty default template
template <bool b>
struct StaticAssert {};
// template specialized on true
template <>
struct StaticAssert<true>
{
// If the static assertion is failing then this function won't exist. It will then
// appear in the error message which gives a clue to the user about what is wrong.
static void ERROR_The_static_assertion_has_failed() {}
};
}
#define POLYVOX_STATIC_ASSERT(condition, message) StaticAssert<(condition)>::ERROR_The_static_assertion_has_failed();
#endif
/*
* Exceptions
* ----------

View File

@ -26,6 +26,8 @@ freely, subject to the following restrictions:
#include "PolyVoxCore/Impl/TypeDef.h"
#include <cstdint>
namespace PolyVox
{
extern const POLYVOX_API uint16_t edgeTable[256];

View File

@ -26,6 +26,8 @@ freely, subject to the following restrictions:
#include "PolyVoxCore/Impl/TypeDef.h"
#include <cstdint>
namespace PolyVox
{
template <uint32_t noOfDims, typename ElementType> class Array;

View File

@ -24,8 +24,6 @@ freely, subject to the following restrictions:
#ifndef __PolyVox_TypeDef_H__
#define __PolyVox_TypeDef_H__
#include "PolyVoxCore/Impl/CompilerCapabilities.h"
//Definitions needed to make library functions accessable
// See http://gcc.gnu.org/wiki/Visibility for more info.
#if defined _WIN32 || defined __CYGWIN__
@ -69,52 +67,4 @@ freely, subject to the following restrictions:
#define POLYVOX_LOCAL
#endif // POLYVOX_SHARED
//Check which compiler we are using and work around unsupported features as necessary.
#if defined(_MSC_VER) && (_MSC_VER < 1600)
//To support old (pre-vc2010) Microsoft compilers we use boost to replace the
//std::shared_ptr and potentially other C++0x features. To use this capability you
//will need to make sure you have boost installed on your system.
#include <boost/function.hpp>
#define polyvox_function boost::function
#include <boost/bind.hpp>
#define polyvox_bind boost::bind
#define polyvox_placeholder_1 _1
#define polyvox_placeholder_2 _2
#else
//We have a decent compiler - use real C++0x features
#include <functional>
#define polyvox_function std::function
#define polyvox_bind std::bind
#define polyvox_placeholder_1 std::placeholders::_1
#define polyvox_placeholder_2 std::placeholders::_2
#endif
#if defined(HAS_CXX11_CONSTEXPR)
#define polyvox_constexpr_const constexpr //constexpr which falls back to const
#define polyvox_constexpr constexpr //constexpr which falls back to nothing
#else
#define polyvox_constexpr_const const
#define polyvox_constexpr
#endif
#if defined(HAS_CXX11_CSTDINT_H)
#include <cstdint>
#else
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t;
typedef unsigned short uint16_t;
typedef long int32_t;
typedef unsigned long uint32_t;
#endif
#if defined(HAS_CXX11_SHARED_PTR)
#include <memory>
#define polyvox_shared_ptr std::shared_ptr
#else
#include <boost/smart_ptr.hpp>
#define polyvox_shared_ptr boost::shared_ptr
#endif
#endif

View File

@ -26,6 +26,8 @@ freely, subject to the following restrictions:
#include "PolyVoxCore/Impl/TypeDef.h"
#include <cstdint>
namespace PolyVox
{
POLYVOX_API uint8_t logBase2(uint32_t uInput);

View File

@ -26,6 +26,8 @@ freely, subject to the following restrictions:
#include "Impl/TypeDef.h"
#include <cstdint>
namespace PolyVox
{
////////////////////////////////////////////////////////////////////////////////

View File

@ -75,7 +75,7 @@ namespace PolyVox
//RATE THE STD::SET CAUSES PROBLEMS WITH SWIG. IF YOU UNCOMMENT ANY OF THESE FUNCTIONS, PLEASE POST ON
//THE FORUM SO WE CAN KNOW THE FUNCTIONALITY IS STILL NEEDED IN SOME FORM.
//void sumNearbyNormals(bool bNormaliseResult = true);
//polyvox_shared_ptr< SurfaceMesh<VertexType> > extractSubset(std::set<uint8_t> setMaterials);
//std::shared_ptr< SurfaceMesh<VertexType> > extractSubset(std::set<uint8_t> setMaterials);
//void generateAveragedFaceNormals(bool bNormalise, bool bIncludeEdgeVertices = false);
int noOfDegenerateTris(void);
@ -96,7 +96,7 @@ namespace PolyVox
};
template <typename VertexType>
polyvox_shared_ptr< SurfaceMesh<VertexType> > extractSubset(SurfaceMesh<VertexType>& inputMesh, std::set<uint8_t> setMaterials);
std::shared_ptr< SurfaceMesh<VertexType> > extractSubset(SurfaceMesh<VertexType>& inputMesh, std::set<uint8_t> setMaterials);
}
#include "PolyVoxCore/SurfaceMesh.inl"

View File

@ -245,9 +245,9 @@ namespace PolyVox
}*/
/*template <typename VertexType>
polyvox_shared_ptr< SurfaceMesh<VertexType> > SurfaceMesh<VertexType>::extractSubset(std::set<uint8_t> setMaterials)
std::shared_ptr< SurfaceMesh<VertexType> > SurfaceMesh<VertexType>::extractSubset(std::set<uint8_t> setMaterials)
{
polyvox_shared_ptr< SurfaceMesh<VertexType> > result(new SurfaceMesh<VertexType>);
std::shared_ptr< SurfaceMesh<VertexType> > result(new SurfaceMesh<VertexType>);
if(m_vecVertices.size() == 0) //FIXME - I don't think we should need this test, but I have seen crashes otherwise...
{
@ -395,9 +395,9 @@ namespace PolyVox
//Currently a free function - think where this needs to go.
template <typename VertexType>
polyvox_shared_ptr< SurfaceMesh<VertexType> > extractSubset(SurfaceMesh<VertexType>& inputMesh, std::set<uint8_t> setMaterials)
std::shared_ptr< SurfaceMesh<VertexType> > extractSubset(SurfaceMesh<VertexType>& inputMesh, std::set<uint8_t> setMaterials)
{
polyvox_shared_ptr< SurfaceMesh<VertexType> > result(new SurfaceMesh<VertexType>);
std::shared_ptr< SurfaceMesh<VertexType> > result(new SurfaceMesh<VertexType>);
result->m_Region = inputMesh.m_Region;

View File

@ -53,7 +53,7 @@ namespace PolyVox
template <uint32_t Size,typename StorageType, typename OperationType>
Vector<Size,StorageType,OperationType>::Vector(StorageType x, StorageType y)
{
POLYVOX_STATIC_ASSERT(Size == 2, "This constructor should only be used for vectors with two elements.");
static_assert(Size == 2, "This constructor should only be used for vectors with two elements.");
m_tElements[0] = x;
m_tElements[1] = y;
@ -68,7 +68,7 @@ namespace PolyVox
template <uint32_t Size,typename StorageType, typename OperationType>
Vector<Size,StorageType,OperationType>::Vector(StorageType x, StorageType y, StorageType z)
{
POLYVOX_STATIC_ASSERT(Size == 3, "This constructor should only be used for vectors with three elements.");
static_assert(Size == 3, "This constructor should only be used for vectors with three elements.");
m_tElements[0] = x;
m_tElements[1] = y;
@ -86,7 +86,7 @@ namespace PolyVox
template <uint32_t Size,typename StorageType, typename OperationType>
Vector<Size,StorageType,OperationType>::Vector(StorageType x, StorageType y, StorageType z, StorageType w)
{
POLYVOX_STATIC_ASSERT(Size == 4, "This constructor should only be used for vectors with four elements.");
static_assert(Size == 4, "This constructor should only be used for vectors with four elements.");
m_tElements[0] = x;
m_tElements[1] = y;
@ -136,7 +136,7 @@ namespace PolyVox
// vector with one element, and supporting this would cause confusion over the
// behaviour of the constructor taking a single value, as this fills all elements
// to that value rather than just the first one.
POLYVOX_STATIC_ASSERT(Size > 1, "Vector must have a length greater than one.");
static_assert(Size > 1, "Vector must have a length greater than one.");
}
/**
@ -446,7 +446,7 @@ namespace PolyVox
template <uint32_t Size, typename StorageType, typename OperationType>
inline StorageType Vector<Size, StorageType, OperationType>::getZ(void) const
{
POLYVOX_STATIC_ASSERT(Size >= 3, "You can only get the 'z' component from a vector with at least three elements.");
static_assert(Size >= 3, "You can only get the 'z' component from a vector with at least three elements.");
return m_tElements[2];
}
@ -457,7 +457,7 @@ namespace PolyVox
template <uint32_t Size, typename StorageType, typename OperationType>
inline StorageType Vector<Size, StorageType, OperationType>::getW(void) const
{
POLYVOX_STATIC_ASSERT(Size >= 4, "You can only get the 'w' component from a vector with at least four elements.");
static_assert(Size >= 4, "You can only get the 'w' component from a vector with at least four elements.");
return m_tElements[3];
}
@ -499,7 +499,7 @@ namespace PolyVox
template <uint32_t Size,typename StorageType, typename OperationType>
inline void Vector<Size,StorageType,OperationType>::setElements(StorageType x, StorageType y, StorageType z)
{
POLYVOX_STATIC_ASSERT(Size >= 3, "You can only use this version of setElements() on a vector with at least three elements.");
static_assert(Size >= 3, "You can only use this version of setElements() on a vector with at least three elements.");
m_tElements[0] = x;
m_tElements[1] = y;
@ -516,7 +516,7 @@ namespace PolyVox
template <uint32_t Size,typename StorageType, typename OperationType>
inline void Vector<Size,StorageType,OperationType>::setElements(StorageType x, StorageType y, StorageType z, StorageType w)
{
POLYVOX_STATIC_ASSERT(Size >= 4, "You can only use this version of setElements() on a vector with at least four elements.");
static_assert(Size >= 4, "You can only use this version of setElements() on a vector with at least four elements.");
m_tElements[0] = x;
m_tElements[1] = y;
@ -548,7 +548,7 @@ namespace PolyVox
template <uint32_t Size, typename StorageType, typename OperationType>
inline void Vector<Size, StorageType, OperationType>::setZ(StorageType tZ)
{
POLYVOX_STATIC_ASSERT(Size >= 3, "You can only set the 'w' component from a vector with at least three elements.");
static_assert(Size >= 3, "You can only set the 'w' component from a vector with at least three elements.");
m_tElements[2] = tZ;
}
@ -559,7 +559,7 @@ namespace PolyVox
template <uint32_t Size, typename StorageType, typename OperationType>
inline void Vector<Size, StorageType, OperationType>::setW(StorageType tW)
{
POLYVOX_STATIC_ASSERT(Size >= 4, "You can only set the 'w' component from a vector with at least four elements.");
static_assert(Size >= 4, "You can only set the 'w' component from a vector with at least four elements.");
m_tElements[3] = tW;
}

View File

@ -23,6 +23,8 @@ freely, subject to the following restrictions:
#include "PolyVoxCore/ArraySizes.h"
#include <cstdint>
namespace PolyVox
{
/**

View File

@ -1,7 +1,6 @@
%module PolyVoxCore
#define POLYVOX_API
%include "PolyVoxCore/Impl/CompilerCapabilities.h"
%include "Impl/TypeDef.h"
#define __attribute__(x) //Silence DEPRECATED errors