garrysmod icon indicating copy to clipboard operation
garrysmod copied to clipboard

Math for Color class

Open Be1zebub opened this issue 1 year ago • 2 comments

new metaevents support __unm, __add, __sub, __mul, __div, __lt, __le new methods: :Invert(), :Copy(), :Normalize(), :GetNormalized()

Be1zebub avatar May 28 '23 20:05 Be1zebub

Could you give some examples/documentation that makes these operations defined and sensible for rgb colours?

Kefta avatar May 29 '23 00:05 Kefta

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) I actively use pseudo shaders in my projects, for example one of it implements bloom for some vgui elements here are some examples how color math can be used: https://gist.github.com/Be1zebub/66a16af468e2f2d7e2a9fc0dc9ee9311 image

Be1zebub avatar May 30 '23 01:05 Be1zebub