shadowmage45 / TexturesUnlimited

KSP Shader, Texture, and Modeling Utilities
GNU General Public License v3.0
29 stars 17 forks source link

KSP_TEXTURE_SET -- COLORS block doesn't accept byte notation for colors #75

Closed shadowmage45 closed 5 years ago

shadowmage45 commented 5 years ago

Update the COLORS block parsing to include multi-format parsing for at least byte and float notations.
As five values are needed, cannot use the unity built-in HTML color parsing; might need to develop own hex-parsing method?

shadowmage45 commented 5 years ago

Apparently this will not work as it interferes with parsing of persistence data.

Notably KSP does not store integer-valued floating point numbers with decimals, and it is the decimals that trigger the float-based parsing. This was causing existing craft/etc to reload using the byte-notation, which was resulting in colors like (1/255 RED), instead of (1.0f RED). '1' was being parsed as a byte rather than a float due to no decimal place.

Will investigate alternative methods to implement this feature that only work for COLORs blocks and are not used for persistence load/save functions. Likely will just require a specific COLORS-block constructor.