Ok, I've changed back to a LargeVolume and now I have my map of polyMeshes like so-
Code:
std::map<Vector3DInt32, Polymesh> polyMeshes;
but when I try to find my voxel region like so -
Code:
it = polyMeshes.find(Vector3DInt32(intersect.getY(),intersect.getX(),intersect.getZ()));
volume.setVoxelAt(newVoxel,VoxelTypeTraits<Density8>::MinDensity);
volume.setVoxelAt(raycastResult.intersectionVoxel,VoxelTypeTraits<Density8>::MinDensity);
PolyvoxMeshtoManual(it->second);
I get a map not dereferencable error. My polyMeshes map looks just fine in Debug but my iterator doesn't contain the correct element, why?
I'm storing my regions like before but now in a map now like so -
Code:
for (int h = 0; h < totalHSegs; h++){
for (int w = 0; w < totalWSegs; w++){
for (int l = 0; l < totalLSegs; l++){
if(l2 + divisor <= volume.getDepth() && w2 + divisor <= volume.getWidth() && h2 + divisor <= volume.getHeight()){
// region is a block (divisor x divisor x divisor voxels)
p.region = Region(Vector3DInt32(w2,h2,l2),Vector3DInt32(w2+divisor,h2+divisor,l2+divisor));
p.position = position;
polyMeshes.insert(pair<Vector3DInt32,Polymesh>(Vector3DInt32(w,h,l),p));
//polyMeshes[h][w][l] = p;
}
else {
// region is a remainder
p.region = Region(Vector3DInt32(w2,h2,l2),Vector3DInt32(w2 + widthRemainder,h2 + heightRemainder,l2 + lengthRemainder));
p.position = position;
polyMeshes.insert(pair<Vector3DInt32,Polymesh>(Vector3DInt32(w,h,l),p));
//polyMeshes[h][w][l] = p;
}
l2 += divisor;
position.z += divisor;
}
w2 += divisor;
l2 = 0;
position.z = 0;
position.x += divisor;
}
h2 += divisor;
w2 = 0;
position.x = 0;
position.y += divisor;
}
In my test run, I could plainly see that element [89]in polyMeshes is region 2,6,1, but it didn't point to it....help please