-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added alpha channel and Color functions #359
Conversation
Also, I put a usage example in the softBodies app. |
I'd like to create actual Color class so we don't need to worry about the validness with color arithmetic operation. Also, Color class can be in common namespace. |
I think being able to do normal vector arithmetic with colors is valuable. I'm not seeing the purpose behind a unique class for them. |
Color class will be able to normal vector arithmetic operations but it will clamp when the result is not valid. For example, result of (0, 0, 0) - (1, 0, 0) = (-1, 0, 0) is not valid so it will be clamped as (0, 0, 0). |
I'm kind of worried that could be overbearing. At the end of the day, it seems like it's the user's responsibility to provide sane color values. I could imagine someone wanting to determine their colors programmatically, and having a color value that's temporarily negative (between arithmetic operations). But then if the color class suppresses that, it could mess up the computation. |
It's possible. Okay, let's merge this. |
There are conflicts with master. Could you merge master branch into this PR first? |
Merged. |
Added alpha channel and Color functions
I've added an alpha channel for Shape colors. It turns out the whole OpenGL renderer pipeline was completely ready for an alpha channel, it just wasn't being used.
I also added some Color generating functions. Rather than create a Color class, I simply made a namespace called Color in dart/math/Helpers.h and put some functions in that namespace. I decided to inline all the functions so that end users can just check the header to see what actual color codes are being used for each of the color functions.