Hi together,
@Midnight: Thirst of all sorry for my late Answer...
Thanks for the flowers, as we say in german.

. For what i was able to learn from you was unfortnately nothing concrete, except one little thing: that PolyVox has a dramatic performance difference between debug and release, more than other libraries.
This mainly had the reason that i only saw one thread where you were asking questions, and i didnt really understood what kind of problem you had there initially, so i went on further. At some point later, when i remember correctly you solved it, the reason was you did not delete an irrlicht mesh or meshbuffer)...
For the UV-mapping, perhaps i have useful thing to share. I used it a while ago for a different set of rationales (not Voxel related, but for voronoi fractured objects where i want to texture the shards on the inside faces, so that one doesn't see it's fractured). It is also not really mature and complete, so it's an 80 % solution because you can still see some uv coords which are wrongly set. For cubic voxels it could although be robust enough.
I am only posting the relevant excerpts here, since the code is too tied with bullet physics. I hope it's enough to get the idea...
The trick is get the normal of a triangle which represents it's surface direction and then to get the Angle of it in the 3D-Space.
Code:
float getZAngle(float x, float y, float z)
{
float theta = atan2(x, z);
return theta * (180 / 3.141592653589793238);
}
float getYAngle(float x, float y, float z)
{
float theta = atan2(sqrt(pow(z, 2) + pow(x, 2)), y);
return theta * (180 / 3.141592653589793238);
}
Code:
...
core::plane3df triangle(pMeshBuffer->getPosition(idx[i]), pMeshBuffer->getPosition(idx[i + 1]), pMeshBuffer->getPosition(idx[i + 2]));
triangle.Normal.X = fabsf(triangle.Normal.X);
triangle.Normal.Y = fabsf(triangle.Normal.Y);
triangle.Normal.Z = fabsf(triangle.Normal.Z);
btVector3 nrm = btVector3(triangle.Normal.X, triangle.Normal.Y, triangle.Normal.Z).normalized();
int yAngle = getYAngle(nrm.getX(), nrm.getY(), nrm.getZ());
int zAngle = getZAngle(nrm.getX(), nrm.getY(), nrm.getZ());
if (triangle.Normal.X > triangle.Normal.Y && triangle.Normal.X > triangle.Normal.Z) {
for (uint32_t j = 0; j != 3; ++j) {
const uint32_t index = idx[i + j];
pMeshBuffer->getTCoords(index).X = pMeshBuffer->getPosition(index).Z;
pMeshBuffer->getTCoords(index).Y = pMeshBuffer->getPosition(index).Y;
}
} else if ((triangle.Normal.Y > triangle.Normal.X && triangle.Normal.Y > triangle.Normal.Z)) {
for (uint32_t j = 0; j != 3; ++j) {
const uint32_t index = idx[i + j];
pMeshBuffer->getTCoords(index).X = pMeshBuffer->getPosition(index).X;
pMeshBuffer->getTCoords(index).Y = pMeshBuffer->getPosition(index).Z;
}
} else {
for (uint32_t j = 0; j != 3; ++j) {
const uint32_t index = idx[i + j];
pMeshBuffer->getTCoords(index).X = pMeshBuffer->getPosition(index).X;
pMeshBuffer->getTCoords(index).Y = pMeshBuffer->getPosition(index).Y;
}
}
...