Skip to content
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

Merged
merged 4 commits into from
Mar 22, 2015
Merged

Added alpha channel and Color functions #359

merged 4 commits into from
Mar 22, 2015

Conversation

mxgrey
Copy link
Member

@mxgrey mxgrey commented Mar 19, 2015

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.

@mxgrey
Copy link
Member Author

mxgrey commented Mar 19, 2015

Also, I put a usage example in the softBodies app.

@jslee02
Copy link
Member

jslee02 commented Mar 21, 2015

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.

@mxgrey
Copy link
Member Author

mxgrey commented Mar 21, 2015

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.

@jslee02
Copy link
Member

jslee02 commented Mar 21, 2015

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

@mxgrey
Copy link
Member Author

mxgrey commented Mar 21, 2015

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.

@jslee02
Copy link
Member

jslee02 commented Mar 21, 2015

It's possible. Okay, let's merge this.

@jslee02
Copy link
Member

jslee02 commented Mar 21, 2015

There are conflicts with master. Could you merge master branch into this PR first?

@mxgrey
Copy link
Member Author

mxgrey commented Mar 21, 2015

Merged.

jslee02 added a commit that referenced this pull request Mar 22, 2015
Added alpha channel and Color functions
@jslee02 jslee02 merged commit 41e5b0b into master Mar 22, 2015
@jslee02 jslee02 added this to the Release DART 5.0 milestone Mar 22, 2015
@mxgrey mxgrey deleted the grey/alpha branch March 22, 2015 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants