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 ... 9, 10, 11, 12, 13  Next
Author Message
 Post subject: Re: Realtime Ogre 1.8 Terrain Component manipulation
PostPosted: Sun Feb 26, 2012 9:26 pm 

Joined: Wed Jan 11, 2012 7:33 pm
Posts: 109
Ok, I changed it to just Density8 and that works but I still get error -

error C2276: '&' : illegal operation on bound member function expression

initializing it like so -

Code:
PolyVox::LargeVolume<Density8> volume(&dataRequiredHandler, &dataOverflowHandler, num_chunks);

and defined the functions like so -

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


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

Joined: Sat Dec 18, 2010 2:58 am
Posts: 41
Not at home right now, but only difference between the way I've done it and you've done it is highlighted in bold:

void dataRequiredHandler(const PolyVox::ConstVolumeProxy<Density8>& volume, const PolyVox::Region& region)
{}


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Realtime Ogre 1.8 Terrain Component manipulation
PostPosted: Mon Feb 27, 2012 10:15 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
I haven't used the LargeVolume much (though I hope to in our next project) so I may be wrong here... but this use of empty handlers makes me nerveous. I mean, if the volume tries to unload and then reload data then isn't it just going to get lost? Is it not better to pass '0' (like one of the constructors does) in which case the handlers won't actually get called (though I forget what happens when an overflow occurs).

Also, RawVolume and SimpleVolume should handle negative coordinates fine if you set up your initial region to include some of the negative space, but I don't think there has been much testing.

I'm just a little worried that you (drwbns) haven't quite mastered the basics, and that using LargeVolume/handlers might cause more confusion for you.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Realtime Ogre 1.8 Terrain Component manipulation
PostPosted: Mon Feb 27, 2012 11:08 am 
User avatar

Joined: Wed Jan 26, 2011 3:20 pm
Posts: 203
Location: Germany
hmm... yes data gets lost. but it would also get lost if you passed 0... which doesn't work anyway, since the deprecated constructor with 3 ints will then get called.

the problem is that drwbns used a member function of a class... but for just passing the addr of the function, those need to be free functions.

@drwbns: just move the callbacks out of your class. they do not need to be declared in the header file, just define them in the source file above the point where you use them.

@david: in my opinion largevolume just needs a default constructor (no args, infinite volumesize, no callbacks), once it has that, it is the easiest volume to use. you dump data anywhere in it and then you run any surfaceextractor on a region you know to contain data.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Realtime Ogre 1.8 Terrain Component manipulation
PostPosted: Mon Feb 27, 2012 1:44 pm 

Joined: Wed Jan 11, 2012 7:33 pm
Posts: 109
Ok I moved the functions but now I get a crash on initializing the volume.

Code:
Unhandled exception at 0x76d6b9bc (KernelBase.dll) in WorldCraft.exe: Microsoft C++ exception: std::invalid_argument at memory location 0x003af664..


code stops around -

Code:
   void LargeVolume<VoxelType>::resize(const Region& regValidRegion, uint16_t uBlockSideLength)
   {
      //Debug mode validation
      assert(uBlockSideLength > 0);
      
      //Release mode validation
      if(uBlockSideLength == 0)
      {
         throw std::invalid_argument("Block side length cannot be zero.");
      }
      if(!isPowerOf2(uBlockSideLength))
      {
         throw std::invalid_argument("Block side length must be a power of two.");
      }

      m_uTimestamper = 0;


then if I continue it says -

Code:
---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Assertion failed!

Program: ...
File: C:\Users\Andrew\Downloads\polyvox-020...\Utility.cpp
Line: 37

Expression: isPowerOf2(uInput)

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts

(Press Retry to debug the application - JIT must be enabled)
---------------------------
Abort   Retry   Ignore   
---------------------------


What size should num_chunks be?

UPDATE: I played around with the num_chunks size and at 512, the program runs but crashes after raycasting with the error -

Code:
Unhandled exception at 0x76d6b9bc (KernelBase.dll) in WorldCraft.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0028e5a0..


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Realtime Ogre 1.8 Terrain Component manipulation
PostPosted: Mon Feb 27, 2012 2:30 pm 
User avatar

Joined: Wed Jan 26, 2011 3:20 pm
Posts: 203
Location: Germany
just leave it empty, the default is fine...
512 is a little extreme ;) and it's not num_chunks it's the side length of the chunks, something internal that you do not need


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Realtime Ogre 1.8 Terrain Component manipulation
PostPosted: Mon Feb 27, 2012 2:33 pm 

Joined: Wed Jan 11, 2012 7:33 pm
Posts: 109
ok that works, but now I can't see my mesh anymore. What's the best way to go about generating the mesh? Do I have to change my mesh generating function?


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Realtime Ogre 1.8 Terrain Component manipulation
PostPosted: Mon Feb 27, 2012 2:49 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
I think your using the term 'crash' a little loosly here ;-) It's not really crashing - it's throwing an exception to tell you you've done something wrong so you do need to pay attention to the error. It's saying:

Code:
Unhandled exception at 0x76d6b9bc (KernelBase.dll) in WorldCraft.exe: Microsoft C++ exception: std::invalid_argument at memory location 0x003af664..


This means an exception of type invalid_argument has been thrown by PolyVox - i.e. the function argument you passed was not valid. From your next code snippet:

Code:
if(!isPowerOf2(uBlockSideLength))
{
   throw std::invalid_argument("Block side length must be a power of two.");
}


This exception can be thrown if your block size is not a power of two (this is why it works for 512). There are other reasons it can be thrown, and you can handle the exception and call the 'what()' function to retrieve the actual error message (this is the same as standard C++ exceptions).

Lastly:

drwbns wrote:
UPDATE: I played around with the num_chunks size and at 512, the program runs but crashes after raycasting with the error -

Code:
Unhandled exception at 0x76d6b9bc (KernelBase.dll) in WorldCraft.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0028e5a0..


This time the exception is of type bad_alloc, which means it failed to allocate enough memory for the block. You should use a much smaller block size (maybe 32 or 64, but still a power of two!).


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Realtime Ogre 1.8 Terrain Component manipulation
PostPosted: Mon Feb 27, 2012 2:54 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
ker wrote:
hmm... yes data gets lost. but it would also get lost if you passed 0...


Except in the case of it being '0' we can test for that... maybe we should consider changing the behaviour of LargeVolume so that if these handlers are not provided then it will never do paging and will just run out of memory? I can't think through this in detail at the moment as I'm focusing on other parts of PolyVox, but maybe something for the future?

ker wrote:
which doesn't work anyway, since the deprecated constructor with 3 ints will then get called.


Probably time to get rid of that constructor - it was only there to catch people who didn't update their code.

ker wrote:
in my opinion largevolume just needs a default constructor (no args, infinite volumesize, no callbacks), once it has that, it is the easiest volume to use. you dump data anywhere in it and then you run any surfaceextractor on a region you know to contain data.


I could be open to this, and I guess it also relates to my first point above.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Realtime Ogre 1.8 Terrain Component manipulation
PostPosted: Mon Feb 27, 2012 3:00 pm 

Joined: Wed Jan 11, 2012 7:33 pm
Posts: 109
Since LargeVolume doesn't have a set size, how do I go about splitting it into mesh regions?

UPDATE: I just passed some initial sizes to my volumeSplitter function instead of the volume sizes and that works fine but still, my raycasts are failing on the LargeVolume, no intersection is found?


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 ... 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