Przeglądaj źródła

Merge pull request #2066 from rextimmy/color_fix

ColorI::fromLinear fix
Areloch 8 lat temu
rodzic
commit
04c6307f7a
1 zmienionych plików z 4 dodań i 4 usunięć
  1. 4 4
      Engine/source/core/color.h

+ 4 - 4
Engine/source/core/color.h

@@ -884,10 +884,10 @@ inline ColorI LinearColorF::toColorI(const bool keepAsLinear)
 inline ColorI ColorI::fromLinear()
 inline ColorI ColorI::fromLinear()
 {
 {
    //manually create LinearColorF, otherwise it will try and convert to linear first
    //manually create LinearColorF, otherwise it will try and convert to linear first
-   LinearColorF linearColor = LinearColorF(F32(red) * 255.0f + 0.5f,
-                                           F32(red) * 255.0f + 0.5f,
-                                           F32(red) * 255.0f + 0.5f,
-                                           F32(alpha) * 255.0f + 0.5f);
+   LinearColorF linearColor = LinearColorF(F32(red) * gOneOver255,
+                                           F32(green) * gOneOver255,
+                                           F32(blue) * gOneOver255,
+                                           F32(alpha) * gOneOver255);
    //convert back to srgb
    //convert back to srgb
    return linearColor.toColorI();
    return linearColor.toColorI();
 }
 }