I cannot figure out what I could possibly be doing wrong. I cannot create a new mesh decimator without incurring this error during runtime.
Unhandled exception at 0x5f4ccac8 (msvcr100d.dll) in WorldCraft.exe: 0xC0000005: Access violation writing location 0x00000000.
It breaks in the middle of the constructor call to MeshDecimator
Below is the code I wrote to create a surface mesh and then decimate it.
It does make it inside of the if statement. Previous to this point I use the example code in order to fill a volume with cubes.
Code:
void TutorialApplication::createManObj(Volume<MaterialDensityPair44>* test, Ogre::SceneManager* mSceneMgr)
{
SurfaceMesh<PositionMaterialNormal>* MaterialAll = new SurfaceMesh<PositionMaterialNormal>(); // regular mesh
SurfaceMesh<PositionMaterialNormal>* mesh = NULL;
Ogre::ManualObject* manual = mSceneMgr->createManualObject("manual");
// only need single extractor since will extract single mesh first
SurfaceExtractor<MaterialDensityPair44>* mSurfaceExtractor = new SurfaceExtractor<MaterialDensityPair44>(test,test->getEnclosingRegion(),MaterialAll);
mSurfaceExtractor->execute();
if(MaterialAll && MaterialAll->getNoOfVertices() > 0 && MaterialAll->getNoOfIndices() > 0)
{
MeshDecimator<PositionMaterialNormal>* DecMesh = new MeshDecimator<PositionMaterialNormal>(MaterialAll,mesh, 0.95f);
DecMesh->execute();
}
I've spent many hours on this already and I am out of ideas. Any help would be greatly appreciated.