Skip to content

Store Sprite Colors, and all others, as 4x floats, not 0-255 ints #1794

@cspotcode

Description

@cspotcode

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions