Pass things as const reference to the extractor
This commit is contained in:
parent
cc1e1e477c
commit
09d5624cc8
@ -32,8 +32,8 @@ freely, subject to the following restrictions:
|
|||||||
|
|
||||||
namespace PolyVox
|
namespace PolyVox
|
||||||
{
|
{
|
||||||
template< typename VolumeType>
|
template< typename VolumeType, typename ControllerType>
|
||||||
SurfaceMesh<PositionMaterialNormal> dualContouringSurfaceExtractor(VolumeType* volData, Region region);
|
SurfaceMesh<PositionMaterialNormal> dualContouringSurfaceExtractor(VolumeType* volData, const Region& region, const ControllerType& controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "PolyVoxCore/DualContouringSurfaceExtractor.inl"
|
#include "PolyVoxCore/DualContouringSurfaceExtractor.inl"
|
||||||
|
@ -129,8 +129,7 @@ namespace PolyVox
|
|||||||
matrix[rows][1] = normal.getY();
|
matrix[rows][1] = normal.getY();
|
||||||
matrix[rows][2] = normal.getZ();
|
matrix[rows][2] = normal.getZ();
|
||||||
|
|
||||||
const Vector3DFloat p = vertices[i] - massPoint;
|
const Vector3DFloat product = normal * (vertices[i] - massPoint);
|
||||||
const Vector3DFloat product = normal * p;
|
|
||||||
|
|
||||||
vector[rows] = product.getX() + product.getY() + product.getZ();
|
vector[rows] = product.getX() + product.getY() + product.getZ();
|
||||||
|
|
||||||
@ -141,6 +140,8 @@ namespace PolyVox
|
|||||||
|
|
||||||
const auto& vertexPosition = evaluateQEF(matrix, vector, rows) + massPoint;
|
const auto& vertexPosition = evaluateQEF(matrix, vector, rows) + massPoint;
|
||||||
|
|
||||||
|
POLYVOX_ASSERT(vertexPosition.getX() >= -0.01 && vertexPosition.getY() >= -0.01 && vertexPosition.getZ() >= -0.01 && vertexPosition.getX() <= 1.01 && vertexPosition.getY() <= 1.01 && vertexPosition.getZ() <= 1.01, "Vertex is outside unit cell"); //0.01 to give a little leniency
|
||||||
|
|
||||||
if(cellVertexNormal.lengthSquared() != 0.0f)
|
if(cellVertexNormal.lengthSquared() != 0.0f)
|
||||||
{
|
{
|
||||||
cellVertexNormal.normalise();
|
cellVertexNormal.normalise();
|
||||||
@ -156,7 +157,7 @@ namespace PolyVox
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename VolumeType, typename ControllerType>
|
template<typename VolumeType, typename ControllerType>
|
||||||
SurfaceMesh<PositionMaterialNormal> dualContouringSurfaceExtractor(VolumeType* volData, Region region, ControllerType controller)
|
SurfaceMesh<PositionMaterialNormal> dualContouringSurfaceExtractor(VolumeType* volData, const Region& region, const ControllerType& controller)
|
||||||
{
|
{
|
||||||
static_assert(std::is_signed<typename ControllerType::DensityType>::value, "Voxel type must be signed");
|
static_assert(std::is_signed<typename ControllerType::DensityType>::value, "Voxel type must be signed");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user