Hi everybody,
I am working with PolyVox in C# for about 3 weeks. For better usage I wrote my own wrapper, because there were problems with the SWIG bindings. (I couldn't change the Density of my Volume)
For SimpleVolume everything works fine, now I am trieing to do the same with LargeVolume and there is where I am having problems.
Code:
//LargeVolume(Region region)
var volData = new LargeVolume(new Region(0, 0, 0, 200, 200, 200));
//setVoxelAt(uint32_t x, uint32_t y, uint32_t z, byte material, byte density)
volData.setVoxelAt(100,100,100, 255,255);
Here I create a new LargeVolume Object with the Region from (0,0,0) to (200,200,200), which works fine. The problem is the time i try to call setVoxel() I get a NullRefernceException at getCompressedBlock and getUncompressedBlock.
I was wondering if I call the constructor or the setVoxel Method wrong or if this is a known problem.
Code:
PolyVox::LargeVolume<PolyVox::MaterialDensityPair88>* volData;
PolyVox::MinizBlockCompressor<PolyVox::BaseVolume<PolyVox::MaterialDensityPair88>::VoxelType>* minizCompressor;
PolyVox::Pager<PolyVox::BaseVolume<PolyVox::MaterialDensityPair88>::VoxelType>* pager;
LargeVolume::LargeVolume(Region region)
{
minizCompressor = new PolyVox::MinizBlockCompressor<PolyVox::BaseVolume<PolyVox::MaterialDensityPair88>::VoxelType>();
volData = new PolyVox::LargeVolume<PolyVox::MaterialDensityPair88>(region.getPolyVoxRegion(), minizCompressor, pager, 32);
}
bool LargeVolume::setVoxelAt(int32_t x, int32_t y, int32_t z, Byte value, Byte density)
{
return volData->setVoxelAt(x, getHeight() - y -1, z, PolyVox::MaterialDensityPair88(value, density));
}
Those are my Wrapper Methods I use to create the Objects in C#