Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
Porsche Monty

GLDEFS question (GZDoom)

Recommended Posts

Would anybody happen to know a little bit more about the range for "color" in GLDEFS?

I'm reading it goes from 0.0 to 1.0, meaning that, if rounded down to one decimal, only 1000 out of 16777216 colours would be accessible (not a good deal)

GZDoom seems to be able to parse 0 and 1 plus any amount of decimals (resulting from R, G or B * 1.0 / 256) which does not necessarily mean it's actually taking them into account, so I'd like to know if that's the case.

I could probably figure this out by running a shitload of tests, but it makes more sense to ask someone who's familiar with it.

Much appreciated.

Share this post


Link to post

You obviously have a lot more than 1000 colors. You need to specify 3 color components, red green and blue. So something like:

color 0.046875 0.546875 0.734375

for a dark sky blue. You can convert from RGB colors expressed as 3 components in the range from 0-255 by doing (1 / 256) * component.

Share this post


Link to post

It's parsing them as float, and then multiply them by 255 to get an integer between 0 and 255 (inclusive). So you've got the full 256^3 colors available; you can have 0.0039216 and it'll turn back into 1.


(If you're a stickler for precision, you'll want to divide by 255 since the maximum isn't 256.)

Share this post


Link to post

Thanks for the explanation and thanks for the tip. 255 from now on.

Also, is there any advantage to using floating point numbers rather than the traditional hex or rgb values? performance maybe?

Regards.

Share this post


Link to post

It's just how it's written. It's converted to int as soon as it's parsed.

The design decision to use floating point values in the lump originates from ZDoomGL.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×