It is currently Sat Aug 22, 2020 1:53 pm


All times are UTC




Post new topic Reply to topic  [ 128 posts ]  Go to page Previous  1 ... 8, 9, 10, 11, 12, 13  Next
Author Message
 Post subject: Re: Realtime Ogre 1.8 Terrain Component manipulation
PostPosted: Sat Feb 25, 2012 8:02 pm 
User avatar

Joined: Wed Jan 26, 2011 3:20 pm
Posts: 203
Location: Germany
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?


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Realtime Ogre 1.8 Terrain Component manipulation
PostPosted: Sat Feb 25, 2012 8:52 pm 

Joined: Wed Jan 11, 2012 7:33 pm
Posts: 109
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?


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Realtime Ogre 1.8 Terrain Component manipulation
PostPosted: Sat Feb 25, 2012 11:03 pm 
User avatar

Joined: Wed Jan 26, 2011 3:20 pm
Posts: 203
Location: Germany
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.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Realtime Ogre 1.8 Terrain Component manipulation
PostPosted: Sat Feb 25, 2012 11:21 pm 

Joined: Wed Jan 11, 2012 7:33 pm
Posts: 109
ok, I'll try that, thanks ker


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Realtime Ogre 1.8 Terrain Component manipulation
PostPosted: Sat Feb 25, 2012 11:52 pm 

Joined: Wed Jan 11, 2012 7:33 pm
Posts: 109
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....


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Realtime Ogre 1.8 Terrain Component manipulation
PostPosted: Sun Feb 26, 2012 9:25 am 
User avatar

Joined: Wed Jan 26, 2011 3:20 pm
Posts: 203
Location: Germany
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.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Realtime Ogre 1.8 Terrain Component manipulation
PostPosted: Sun Feb 26, 2012 4:45 pm 

Joined: Wed Jan 11, 2012 7:33 pm
Posts: 109
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() )


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Realtime Ogre 1.8 Terrain Component manipulation
PostPosted: Sun Feb 26, 2012 5:45 pm 
User avatar

Joined: Wed Jan 26, 2011 3:20 pm
Posts: 203
Location: Germany
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)


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Realtime Ogre 1.8 Terrain Component manipulation
PostPosted: Sun Feb 26, 2012 8:36 pm 

Joined: Wed Jan 11, 2012 7:33 pm
Posts: 109
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)


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Realtime Ogre 1.8 Terrain Component manipulation
PostPosted: Sun Feb 26, 2012 8:52 pm 
User avatar

Joined: Wed Jan 26, 2011 3:20 pm
Posts: 203
Location: Germany
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)


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 128 posts ]  Go to page Previous  1 ... 8, 9, 10, 11, 12, 13  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net