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

Realtime Ogre 1.8 Terrain Component manipulation
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=14&t=312
Page 11 of 13

Author:  ker [ Sat Feb 25, 2012 8:02 pm ]
Post subject:  Re: Realtime Ogre 1.8 Terrain Component manipulation

nope, if it is end(), then find did not find anything. and then the iterator it is invalid.
using it can corrupt memory and will mess up logic.

ok... I can't understand your triple for loop... but you said the map looks fine I assume your loop is correct.

what do you mean by
drwbns wrote:
my iterator doesn't contain the correct element, why?
is the it->second.position != it->first? or how do you determine that the iterator contains the wrong element?

Author:  drwbns [ Sat Feb 25, 2012 8:52 pm ]
Post subject:  Re: Realtime Ogre 1.8 Terrain Component manipulation

The problem was the iterator didn't contain any element, but I've fixed that now. I guess you didn't see my last post?

Author:  ker [ Sat Feb 25, 2012 11:03 pm ]
Post subject:  Re: Realtime Ogre 1.8 Terrain Component manipulation

nope didn't see it...
you need to render at least a single triangle with dummy information, otherwise ManualObject won't be able to do a beginUpdate...
it's better if you don't create a manualobject for regions with an empty mesh, and only create one when necessary.

Author:  drwbns [ Sat Feb 25, 2012 11:21 pm ]
Post subject:  Re: Realtime Ogre 1.8 Terrain Component manipulation

ok, I'll try that, thanks ker

Author:  drwbns [ Sat Feb 25, 2012 11:52 pm ]
Post subject:  Re: Realtime Ogre 1.8 Terrain Component manipulation

Ok, it was in fact that I was trying to create a manualObject with no vertices to start so I added a check to make sure there's voxels created in a region before creating a manualObject and that works beautifully.

Now I need to figure out how to enlarge the LargeVolume on the fly....

Author:  ker [ Sun Feb 26, 2012 9:25 am ]
Post subject:  Re: Realtime Ogre 1.8 Terrain Component manipulation

don't set a size for it...
just use it.
it's infinite anyway ;)
when you want an active region, use prefetch for that region.

Author:  drwbns [ Sun Feb 26, 2012 4:45 pm ]
Post subject:  Re: Realtime Ogre 1.8 Terrain Component manipulation

I'm not sure how you just use it. When I try to set a previousVoxel say (-1,59,44) using volume.setVoxelAt(), it throws an assert...

I added these 2 lines to stop the program crashing -

Code:
         if( raycastResult.previousVoxel.getX() > 0 && raycastResult.previousVoxel.getY() > 0 && raycastResult.previousVoxel.getZ() > 0 )
            if( raycastResult.previousVoxel.getX() < volume.getDepth() && raycastResult.previousVoxel.getY()  < volume.getHeight() && raycastResult.previousVoxel.getZ()  < volume.getWidth() )

Author:  ker [ Sun Feb 26, 2012 5:45 pm ]
Post subject:  Re: Realtime Ogre 1.8 Terrain Component manipulation

yes that was stupid from me...

you need to use the constructor that has 2 function pointers and an int...

create two functions... their body does not need to contain anything
Code:
    void dataRequiredHandler(const PolyVox::ConstVolumeProxy<Voxel>&, const PolyVox::Region&)
{}
    void dataOverflowHandler(const PolyVox::ConstVolumeProxy<Voxel>&, const PolyVox::Region&)
{}


construct the volume with the following arguments:

Code:
(&dataRequiredHandler, &dataOverflowHandler, your_wished_chunk_size)

Author:  drwbns [ Sun Feb 26, 2012 8:36 pm ]
Post subject:  Re: Realtime Ogre 1.8 Terrain Component manipulation

I'm not sure I really understand that but I'll try it, thanks.

I ran into a few errors trying to add the functions and also when initializing the volume. I think I'm supposed to initialize the volume like so ? -

void dataRequiredHandler(const PolyVox::ConstVolumeProxy<Voxel<Density8,PolyVox::MaterialDensityPair44>>&, const PolyVox::Region&)
{}
void dataOverflowHandler(const PolyVox::ConstVolumeProxy<Voxel<Density8,PolyVox::MaterialDensityPair44>>&, const PolyVox::Region&)
{}

PolyVox::LargeVolume<Density8> volume(&dataRequiredHandler, &dataOverflowHandler, your_wished_chunk_size)

Author:  ker [ Sun Feb 26, 2012 8:52 pm ]
Post subject:  Re: Realtime Ogre 1.8 Terrain Component manipulation

what is
Code:
Voxel<Density8,PolyVox::MaterialDensityPair44>

?
also, post the errors

I believe you want to replace the "Voxel<Density8,PolyVox::MaterialDensityPair44>" by just "PolyVox::Density8"

yes, the actual constructor looks correct to me (i use it this way in my source)

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