Midnight wrote:
Sooo... it keeps throwing an error saying that .getIndices() and .getVertices() aren't part of the class/namespace.
The Mesh class still contains std::vectors but this is hidden now (it is an 'implementation detail'). You can access the individual vertices and indices with getNoOfVertices(), getVertex(), etc.
Midnight wrote:
And what is all this decoding nonesense?
PolyVox now uses a more compact format for it's vertex data. For example, a surface normal would usually be three 32-bit floats (x,y,z) but for the MarchingCubesVertex we encode it in only 16 bits (approx 5 bits per component). Before being used this data needs to be decoded to a more conventional format. You can do this decoding in one line using the decode() function, and in this case PolyVox should behave similarly to before. Advanced users can upload the encoded data to the GPU (to save space) and do the decoding there in a shader.
I strongly recommend you use the built-in decode() function for now.
Code:
// Create an empty volume and then place a sphere in it
RawVolume<uint8_t> volData(PolyVox::Region(Vector3DInt32(0, 0, 0), Vector3DInt32(63, 63, 63)));
createSphereInVolume(volData, 30);
// Extract the surface for the specified region of the volume. Uncomment the line for the kind of surface extraction you want to see.
auto mesh = extractCubicMesh(&volData, volData.getEnclosingRegion());
//auto mesh = extractMarchingCubesMesh(&volData, volData.getEnclosingRegion());
// The surface extractor outputs the mesh in an efficient compressed format which is not directly suitable for rendering. The easiest approach is to
// decode this on the CPU as shown below, though more advanced applications can upload the compressed mesh to the GPU and decompress in shader code.
auto decodedMesh = decodeMesh(mesh);
The decoded mesh contains instances of Vertex, which has a conventional position and normal:
Code:
template<typename _DataType>
struct Vertex
{
typedef _DataType DataType;
Vector3DFloat position;
Vector3DFloat normal;
DataType data;
};
Midnight wrote:
this was the only actual example available for the new polyvox. And you've ruined me. heeeellllppp!!

Have a look at the BasicExample to start with. It shouldn't be much more complex than old versions of PolyVox if you use the decode() function.
Midnight wrote:
Well I've worked through some of the template hell problems. Using auto.
I agree the template stuff gets a bit too crazy. I was thinking of adding some template typedef's to make it a bit clearer.
Midnight wrote:
But the issue now is getting actual vertices and indices from polyvox, my std::cout says that there are none, and they create segmentation faults on both the mesh and decoded mesh...
Maybe you can show the code where you create and extract the volume?
But overall, yes, a lot has changed since the previous version. In the next few weeks we will make a new PolyVox release to fix this situation where the 'official' version is so old.