Open cspotcode opened 1 year ago
Related to #1772
I really want these to be floats because of the flexibility this adds, but I'm not entirely sure yet if this is worth it. At least I don't think there's a fast way to have backwards compatible support for both byte and float colors. Worst case it could be something we consider futher down the line. Some more thinking is needed here.
We do have some places were float colors are used, so having the type certainly doesn't hurt.
I see three orthogonal concerns:
NamedTuple
vs Tuple
, protocol vs tuple subclass, etc), answerable with benchmarksobject.color_float
property interaction with object.color
The most urgent issue for me is the last one since it determines whether I should continue work on #1772.
object.color
property?object._color_dirty
+ properties acceptable?
Enhancement request:
What should be added/changed?
BasicSprite._color
should be stored as floats internally, not as ints from 0 to 255.What would it help with?
A list of reasons discussed here: https://discord.com/channels/458662222697070613/458662458198982676/1110348630956720158
Color manipulation within python is easier and has greater precision w/floats. Useful for smoothly lerping between colors using float math instead of imprecise int math.
Easier for consumers to think about. More performant(?) since we never need to convert back and forth between int and float, only copy the float values to the GPU. A bit more data transfer.
Shaders already convert the ints to floats anyway.