-
Notifications
You must be signed in to change notification settings - Fork 800
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
Math for Color class #1971
base: master
Are you sure you want to change the base?
Math for Color class #1971
Conversation
Could you give some examples/documentation that makes these operations defined and sensible for rgb colours? |
arithmetic operators allows to write cleaner code, this is useful in complex code - eg for pseudo shaders (we dont have shaders api, so cope with rt & render.ReadPixel) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add functions like Add
, Sub
, etc. that modify the original color rather than create a new one? Vectors, angles and matrices already have these, so it would make sense for colors to have them too.
|
||
end | ||
|
||
function COLOR:Normalize() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the use case of Normalize
? Currently it just divides the color components by 255, i.e., if you ignore copying, it is equivalent to color / 255
. Wouldn't clamping the components to the range of 0…255 make more sense for a function like this?
new metaevents support
__unm
,__add
,__sub
,__mul
,__div
,__lt
,__le
new methods:
:Invert()
,:Copy()
,:Normalize()
,:GetNormalized()