Work on simple interface.
This commit is contained in:
parent
6f31898fd7
commit
db81e1bc3f
@ -30,7 +30,7 @@ freely, subject to the following restrictions:
|
|||||||
//Use the PolyVox namespace
|
//Use the PolyVox namespace
|
||||||
using namespace PolyVox;
|
using namespace PolyVox;
|
||||||
|
|
||||||
void createSphereInVolume(BasicVolume& volData, float fRadius)
|
void createSphereInVolume(Volume& volData, float fRadius)
|
||||||
{
|
{
|
||||||
//This vector hold the position of the center of the volume
|
//This vector hold the position of the center of the volume
|
||||||
Vector3DFloat v3dVolCenter(volData.getWidth() / 2, volData.getHeight() / 2, volData.getDepth() / 2);
|
Vector3DFloat v3dVolCenter(volData.getWidth() / 2, volData.getHeight() / 2, volData.getDepth() / 2);
|
||||||
@ -75,11 +75,11 @@ int main(int argc, char *argv[])
|
|||||||
openGLWidget.show();
|
openGLWidget.show();
|
||||||
|
|
||||||
//Create an empty volume and then place a sphere in it
|
//Create an empty volume and then place a sphere in it
|
||||||
BasicVolume volData(PolyVox::Region(Vector3DInt32(0,0,0), Vector3DInt32(63, 63, 63)));
|
Volume volData(PolyVox::Region(Vector3DInt32(0,0,0), Vector3DInt32(63, 63, 63)));
|
||||||
createSphereInVolume(volData, 30);
|
createSphereInVolume(volData, 30);
|
||||||
|
|
||||||
//Extract the surface
|
//Extract the surface
|
||||||
BasicMesh mesh;
|
Mesh mesh;
|
||||||
//CubicSurfaceExtractorWithNormals<SimpleVolume, MaterialDensityPair44 > surfaceExtractor(&volData, volData.getEnclosingRegion(), &mesh);
|
//CubicSurfaceExtractorWithNormals<SimpleVolume, MaterialDensityPair44 > surfaceExtractor(&volData, volData.getEnclosingRegion(), &mesh);
|
||||||
//surfaceExtractor.execute();
|
//surfaceExtractor.execute();
|
||||||
extractCubicMesh(volData, volData.getEnclosingRegion(), mesh);
|
extractCubicMesh(volData, volData.getEnclosingRegion(), mesh);
|
||||||
|
@ -24,28 +24,20 @@ freely, subject to the following restrictions:
|
|||||||
#ifndef __PolyVox_SimpleInterface_H__
|
#ifndef __PolyVox_SimpleInterface_H__
|
||||||
#define __PolyVox_SimpleInterface_H__
|
#define __PolyVox_SimpleInterface_H__
|
||||||
|
|
||||||
//Available voxel types
|
|
||||||
#include "PolyVoxCore\Density.h"
|
|
||||||
#include "PolyVoxCore\Material.h"
|
|
||||||
#include "PolyVoxCore\MaterialDensityPair.h"
|
|
||||||
|
|
||||||
//Available volumes
|
|
||||||
#include "PolyVoxCore\LargeVolume.h"
|
|
||||||
#include "PolyVoxCore\RawVolume.h"
|
|
||||||
#include "PolyVoxCore\SimpleVolume.h"
|
|
||||||
|
|
||||||
//Available extractors
|
|
||||||
#include "PolyVoxCore\CubicSurfaceExtractorWithNormals.h"
|
#include "PolyVoxCore\CubicSurfaceExtractorWithNormals.h"
|
||||||
|
#include "PolyVoxCore\MaterialDensityPair.h"
|
||||||
|
#include "PolyVoxCore\SimpleVolume.h"
|
||||||
#include "PolyVoxCore\SurfaceExtractor.h"
|
#include "PolyVoxCore\SurfaceExtractor.h"
|
||||||
|
|
||||||
namespace PolyVox
|
namespace PolyVox
|
||||||
{
|
{
|
||||||
//The PolyVox simple interface only exposes one voxel type and one volume type. But if you like you can
|
//The PolyVox simple interface only exposes one voxel type and one volume type. But if you like you can
|
||||||
//adjust these typedefs and rebuild the library in order to modify which one volume and voxel is exposed.
|
//adjust these typedefs and rebuild the library in order to modify which one volume and voxel is exposed.
|
||||||
typedef SimpleVolume<MaterialDensityPair88> BasicVolume;
|
typedef SimpleVolume<MaterialDensityPair88> Volume;
|
||||||
typedef SurfaceMesh<PositionMaterialNormal> BasicMesh;
|
typedef SurfaceMesh<PositionMaterialNormal> Mesh;
|
||||||
|
|
||||||
void extractCubicMesh(BasicVolume& volume, const Region& region, BasicMesh& resultMesh);
|
void extractCubicMesh(Volume& volume, const Region& region, Mesh& resultMesh);
|
||||||
|
void extractSmoothMesh(Volume& volume, const Region& region, Mesh& resultMesh);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,9 +25,15 @@ freely, subject to the following restrictions:
|
|||||||
|
|
||||||
namespace PolyVox
|
namespace PolyVox
|
||||||
{
|
{
|
||||||
void extractCubicMesh(BasicVolume& volume, const Region& region, BasicMesh& resultMesh)
|
void extractCubicMesh(Volume& volume, const Region& region, Mesh& resultMesh)
|
||||||
{
|
{
|
||||||
CubicSurfaceExtractorWithNormals<SimpleVolume, MaterialDensityPair88 > surfaceExtractor(&volume, region, &resultMesh);
|
CubicSurfaceExtractorWithNormals<SimpleVolume, MaterialDensityPair88 > surfaceExtractor(&volume, region, &resultMesh);
|
||||||
surfaceExtractor.execute();
|
surfaceExtractor.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void extractSmoothMesh(Volume& volume, const Region& region, Mesh& resultMesh)
|
||||||
|
{
|
||||||
|
SurfaceExtractor<SimpleVolume, MaterialDensityPair88 > surfaceExtractor(&volume, region, &resultMesh);
|
||||||
|
surfaceExtractor.execute();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user