Volumes Of Fun
http://www.volumesoffun.com/phpBB3/

LargeVolume::Constructor / LargeVolume::setVoxelAt
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=14&t=541
Page 1 of 1

Author:  Turtler [ Fri Sep 20, 2013 11:24 am ]
Post subject:  LargeVolume::Constructor / LargeVolume::setVoxelAt

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#

Author:  David Williams [ Sat Sep 21, 2013 6:48 am ]
Post subject:  Re: LargeVolume::Constructor / LargeVolume::setVoxelAt

Possibly related to this post (the need for a Pager)?

http://www.volumesoffun.com/phpBB3/viewtopic.php?p=4026#p4026

In general we should handle this more nicely... the LargeVolume still has a few rough edges compared to the SimpleVolume. But the LargeVolume is being used in Cubiquity so hopefully it will improve over the coming weeks.

Author:  Turtler [ Mon Sep 23, 2013 6:17 am ]
Post subject:  Re: LargeVolume::Constructor / LargeVolume::setVoxelAt

Thank you a lot.
It was related to the other topic, I think I didn't see there was related topic.
But now everything works fine :)

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/