1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0029528: Visualization, TKOpenGl - allow defining sRGB textures

OpenGL rendering is now done into sRGB framebuffer.
OpenGl_ShaderManager::prepareStdProgramFboBlit() has been extended
by programs resolving MSAA texture and applying gamma correction as fallbacks.

Quantity_Color definition has been modified to store RGB components
in linear color space within Quantity_TOC_RGB type.
Standard colors defined by Quantity_NameOfColor enumeration has been updated accordingly.
New Quantity_TOC_sRGB type has been introduced to handle RGB components in non-linear sRGB color space.

OpenGl_TextureFormat class definition has been moved to dedicated files.
New method OpenGl_TextureFormat::FindFormat() replaces OpenGl_Texture::GetDataFormat().
New method OpenGl_TextureFormat::FindSizedFormat() replaces OpenGl_FrameBuffer::getColorDataFormat()
and OpenGl_FrameBuffer::getDepthDataFormat().

Graphic3d_TextureRoot::IsColorMap() - introduced new property defining
if RGB(A)8 image formats should be loaded as sRGB(A) textures or as data RGB(A) textures.
OpenGl_Texture initialization methods have been extended with new theIsColorMap argument.

vreadpixel - added argument -sRGB printing color in sRGB color space.

Test cases have been updated to new sRGB rendered results.
This commit is contained in:
kgv
2019-08-29 11:04:56 +03:00
committed by apn
parent aaf8d6a98d
commit ba00aab7a0
137 changed files with 2542 additions and 2240 deletions

View File

@@ -632,7 +632,9 @@ Handle(StepVisual_Colour) STEPConstruct_Styles::EncodeColor(const Quantity_Color
else {
Handle(TCollection_HAsciiString) ColName = new TCollection_HAsciiString ( "" );
Handle(StepVisual_ColourRgb) ColRGB = new StepVisual_ColourRgb;
ColRGB->Init ( ColName, C.Red(), C.Green(), C.Blue() );
NCollection_Vec3<Standard_Real> aColor_sRGB;
C.Values (aColor_sRGB.r(), aColor_sRGB.g(), aColor_sRGB.b(), Quantity_TOC_sRGB);
ColRGB->Init ( ColName, aColor_sRGB.r(), aColor_sRGB.g(), aColor_sRGB.b() );
return ColRGB;
}
}
@@ -675,14 +677,18 @@ Handle(StepVisual_Colour) STEPConstruct_Styles::EncodeColor
}
else {
Handle(StepVisual_ColourRgb) ColRGB;
gp_Pnt P(C.Red(),C.Green(),C.Blue());
gp_Pnt P;
C.Values (P.ChangeCoord().ChangeData()[0],
P.ChangeCoord().ChangeData()[1],
P.ChangeCoord().ChangeData()[2],
Quantity_TOC_sRGB);
if(ColRGBs.IsBound(P)) {
ColRGB = Handle(StepVisual_ColourRgb)::DownCast(ColRGBs.Find(P));
if(!ColRGB.IsNull()) return ColRGB;
}
Handle(TCollection_HAsciiString) ColName = new TCollection_HAsciiString ( "" );
ColRGB = new StepVisual_ColourRgb;
ColRGB->Init ( ColName, C.Red(), C.Green(), C.Blue() );
ColRGB->Init ( ColName, P.Coord (1), P.Coord (2), P.Coord (3) );
ColRGBs.Bind(P,ColRGB);
return ColRGB;
}
@@ -703,10 +709,10 @@ Standard_Boolean STEPConstruct_Styles::DecodeColor (const Handle(StepVisual_Colo
if(norm<rgb->Green()) norm = rgb->Green();
if(norm<rgb->Blue()) norm = rgb->Blue();
Col.SetValues(rgb->Red()/norm, rgb->Green()/norm,
rgb->Blue()/norm, Quantity_TOC_RGB);
rgb->Blue()/norm, Quantity_TOC_sRGB);
}
else
Col.SetValues(rgb->Red(), rgb->Green(), rgb->Blue(), Quantity_TOC_RGB);
Col.SetValues(rgb->Red(), rgb->Green(), rgb->Blue(), Quantity_TOC_sRGB);
return Standard_True;
}
else if ( Colour->IsKind (STANDARD_TYPE(StepVisual_PreDefinedColour)) ) {