It is currently Sat Aug 22, 2020 4:13 am


All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: uint8_t and density
PostPosted: Mon Apr 02, 2012 1:29 pm 

Joined: Sat Feb 04, 2012 7:10 pm
Posts: 19
hi dudes! what's up?
I played with polyvox lastnight... yep no gf... I never saw/used uint8_t type before, what it is his min/max value ? what's the reason of it use ?

I also played with libnoise to generate coherent noise, libnoise gives a double value between zero and one.

how can I use this double value for the density ?

another question, the density have to be zero or max only ? is there a reason to have the mid value for example ? because I can't imagine how ogre/opengl can deals with that, to build the mesh.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: uint8_t and density
PostPosted: Mon Apr 02, 2012 2:22 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Firstly I'll assume you are using the last stable snapshot, because the current Git version is undergoing some changes in this regard.

uint8_t is an 8-bit unsigned integer, with a range from 0 to 255. If you have a double in the range 0.0 to 1.0 then you can convert this to uint8_t by multiplying by 255 and then casting to uint8_t. Note that the multiply must come before the cast!

In the last stable version it is difficult to use the doubles directly, but this will change soon.

I assume you are using the marching cubes surface extractor (rather than one of the cubic ones) in which case the middle values are indeed useful. They basically make sure the terrain appears smooth.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: uint8_t and density
PostPosted: Mon Apr 02, 2012 3:58 pm 

Joined: Sat Feb 04, 2012 7:10 pm
Posts: 19
I don't have the current GIT for sure, I still have the one I compil several weeks ago.

If uint8_t go from 0 to 255 I'll do what you said, multiply by 255

Quote:
Note that the multiply must come before the cast

ok

Quote:
I assume you are using the marching cubes surface extractor

i'm using PolyVox::SurfaceExtractor.

thank you for your help!


Top
Offline Profile  
Reply with quote  
 Post subject: Re: uint8_t and density
PostPosted: Mon Apr 02, 2012 4:16 pm 

Joined: Sat Feb 04, 2012 7:10 pm
Posts: 19
AWESOME!!!!
Image
Image
Image


Top
Offline Profile  
Reply with quote  
 Post subject: Re: uint8_t and density
PostPosted: Mon Apr 02, 2012 7:19 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Well that's satisfying, glad you got it working so easily :-)


Top
Offline Profile  
Reply with quote  
 Post subject: Re: uint8_t and density
PostPosted: Mon Apr 02, 2012 8:34 pm 

Joined: Sat Feb 04, 2012 7:10 pm
Posts: 19
David Williams wrote:
Well that's satisfying, glad you got it working so easily :-)

yeah, we should say that you guys make a good work.


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 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