0029528: Visualization, TKOpenGl - allow defining sRGB textures
[occt.git] / src / MeshVS / MeshVS_TwoColors.cxx
index e845d9e..ae37617 100644 (file)
@@ -71,13 +71,15 @@ Standard_Boolean operator== ( const MeshVS_TwoColors& K1,
 MeshVS_TwoColors BindTwoColors ( const Quantity_Color& theCol1, const Quantity_Color& theCol2 )
 {
   MeshVS_TwoColors aRes;
-
-  aRes.r1 = unsigned ( theCol1.Red()   * 255.0 );
-  aRes.g1 = unsigned ( theCol1.Green() * 255.0 );
-  aRes.b1 = unsigned ( theCol1.Blue()  * 255.0 );
-  aRes.r2 = unsigned ( theCol2.Red()   * 255.0 );
-  aRes.g2 = unsigned ( theCol2.Green() * 255.0 );
-  aRes.b2 = unsigned ( theCol2.Blue()  * 255.0 );
+  NCollection_Vec3<Standard_Real> aColor_sRGB;
+  theCol1.Values (aColor_sRGB.r(), aColor_sRGB.g(), aColor_sRGB.b(), Quantity_TOC_sRGB);
+  aRes.r1 = unsigned ( aColor_sRGB.r() * 255.0 );
+  aRes.g1 = unsigned ( aColor_sRGB.g() * 255.0 );
+  aRes.b1 = unsigned ( aColor_sRGB.b() * 255.0 );
+  theCol2.Values (aColor_sRGB.r(), aColor_sRGB.g(), aColor_sRGB.b(), Quantity_TOC_sRGB);
+  aRes.r2 = unsigned ( aColor_sRGB.r() * 255.0 );
+  aRes.g2 = unsigned ( aColor_sRGB.g() * 255.0 );
+  aRes.b2 = unsigned ( aColor_sRGB.b() * 255.0 );
 
   return aRes;
 }
@@ -94,11 +96,11 @@ Quantity_Color ExtractColor ( MeshVS_TwoColors& theTwoColors, const Standard_Int
   if ( Index == 1 )
     aRes.SetValues ( Standard_Real (theTwoColors.r1) / max,
                      Standard_Real (theTwoColors.g1) / max,
-                     Standard_Real (theTwoColors.b1) / max, Quantity_TOC_RGB );
+                     Standard_Real (theTwoColors.b1) / max, Quantity_TOC_sRGB );
   else if (Index == 2)
     aRes.SetValues ( Standard_Real (theTwoColors.r2) / max,
                      Standard_Real (theTwoColors.g2) / max,
-                     Standard_Real (theTwoColors.b2) / max, Quantity_TOC_RGB );
+                     Standard_Real (theTwoColors.b2) / max, Quantity_TOC_sRGB );
 
   return aRes;
 }
@@ -112,8 +114,8 @@ void ExtractColors ( MeshVS_TwoColors& theTwoColors, Quantity_Color& theCol1, Qu
   Standard_Real max = 255.0;
   theCol1.SetValues ( Standard_Real (theTwoColors.r1) / max,
                       Standard_Real (theTwoColors.g1) / max,
-                      Standard_Real (theTwoColors.b1) / max, Quantity_TOC_RGB );
+                      Standard_Real (theTwoColors.b1) / max, Quantity_TOC_sRGB );
   theCol2.SetValues ( Standard_Real (theTwoColors.r2) / max,
                       Standard_Real (theTwoColors.g2) / max,
-                      Standard_Real (theTwoColors.b2) / max, Quantity_TOC_RGB );
+                      Standard_Real (theTwoColors.b2) / max, Quantity_TOC_sRGB );
 }