It is currently Tue Aug 11, 2020 4:03 pm

 All times are UTC

 Page 1 of 1 [ 6 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: uint8_t and densityPosted: 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

 Post subject: Re: uint8_t and densityPosted: Mon Apr 02, 2012 2:22 pm
 Developer

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

 Post subject: Re: uint8_t and densityPosted: 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.

Top

 Post subject: Re: uint8_t and densityPosted: Mon Apr 02, 2012 4:16 pm

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

Top

 Post subject: Re: uint8_t and densityPosted: Mon Apr 02, 2012 7:19 pm
 Developer

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

Top

 Post subject: Re: uint8_t and densityPosted: 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

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 6 posts ]

 All times are UTC

#### Who is online

Users browsing this forum: No registered users and 1 guest

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

Search for:
 Jump to:  Select a forum ------------------ General Discussion Forums    General Discussion PolyVox Forums    PolyVox Discussion    PolyVox Bugs    Showcase Cubiquity Forums    Cubiquity Discussion Voxeliens Forums    Voxeliens Discussion    Voxeliens Support