David Williams wrote:
Hi, sorry for the slow reply but i'm away from my pc for a couple of days. But it sounds like you got it working? Note that there are at least three versions of the file format - the old RAW version, the old RLE (compressed) version, and the new RLE version which starts with bytes reading 'POLYVOX' (though i forget the case) and a version number. Thermite might contain a mix of volumes as I forget what i've converted.
Yea i've got that all sorted out, now i'm running into a problem of displaying textures on my manual object.
I've read through the "Polyvox and Ogre3d" thread you have on here and took your recommendation of using shaders for the textures.
So i'm trying out your SingleProjectedTextureFP code and it's not doing so well, keep getting a completely material.
I've also attempted my own, but with same results.
Anyhoo, i'm getting a completely solid black texture over the the object, any idea why?
Code:
PolyVox::Volume<PolyVox::MaterialDensityPair44> volData(64, 64, 64);
Ogre::DataStreamPtr streamfromogre = Ogre::ResourceGroupManager::getSingleton().openResource("desert.volume","General");
std::istream stream(new StreamConverter(streamfromogre));
PolyVox::loadVolume<PolyVox::MaterialDensityPair44>(stream, volData);
PolyVox::SurfaceMesh mesh;
PolyVox::SurfaceExtractor<PolyVox::MaterialDensityPair44> surfaceExtractor(&volData, volData.getEnclosingRegion(), &mesh);
surfaceExtractor.execute();
if ( VoxelLand != NULL ) {
VoxelLandNode->detachObject(VoxelLand);
m_pSceneMgr->destroyManualObject(VoxelLand);
}
VoxelLand = m_pSceneMgr->createManualObject("VoxelLand");
uint32_t noVertices = mesh.getNoOfVertices();
uint32_t noIndices = mesh.getNoOfIndices();
VoxelLand->estimateVertexCount(noVertices);
VoxelLand->estimateIndexCount(noIndices);
VoxelLand->begin("DesertSurfaceMaterial", Ogre::RenderOperation::OT_TRIANGLE_LIST,"General");
// vertices
const std::vector<PolyVox::SurfaceVertex>& vVertices = mesh.getVertices();
for (unsigned int i=0; i<noVertices; i++) {
const PolyVox::Vector3DFloat& pos = vVertices[i].getPosition();
VoxelLand->position(pos.getX(), pos.getY(), pos.getZ());
const PolyVox::Vector3DFloat& normal = vVertices[i].getNormal();
VoxelLand->normal(normal.getX(), normal.getY(), normal.getZ());
}
// indices
const std::vector<uint32_t>& vIndices = mesh.getIndices();
for (unsigned int i=0; i<noIndices; i++) {
VoxelLand->index( vIndices[i] );
}
VoxelLand->end();
if ( VoxelLandNode == NULL ) {
VoxelLandNode = m_pSceneMgr->getRootSceneNode()->createChildSceneNode();
}
VoxelLandNode->attachObject(VoxelLand);
VoxelLandNode->setPosition(0.0, 0.0, 0.0);