1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +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

@@ -52,7 +52,7 @@ class VrmlData_Color : public VrmlData_ArrayVec3d
*/
inline const Quantity_Color Color (const Standard_Integer i) const
{ return Quantity_Color (Value(i).X(), Value(i).Y(), Value(i).Z(),
Quantity_TOC_RGB); }
Quantity_TOC_sRGB); }
/**
* Set the array data

View File

@@ -36,9 +36,9 @@ VrmlData_Material::VrmlData_Material ()
: myAmbientIntensity (0.2),
myShininess (0.2),
myTransparency (0.),
myDiffuseColor (0.8, 0.8, 0.8, Quantity_TOC_RGB),
myEmissiveColor (0., 0., 0., Quantity_TOC_RGB),
mySpecularColor (0., 0., 0., Quantity_TOC_RGB)
myDiffuseColor (0.8, 0.8, 0.8, Quantity_TOC_sRGB),
myEmissiveColor (Quantity_NOC_BLACK),
mySpecularColor (Quantity_NOC_BLACK)
{}
//=======================================================================
@@ -55,9 +55,9 @@ VrmlData_Material::VrmlData_Material (const VrmlData_Scene& theScene,
myAmbientIntensity (theAmbientIntens < 0. ? 0.2 : theAmbientIntens),
myShininess (theShininess < 0. ? 0.2 : theShininess),
myTransparency (theTransparency < 0 ? 0. : theTransparency),
myDiffuseColor (0.8, 0.8, 0.8, Quantity_TOC_RGB),
myEmissiveColor (0., 0., 0., Quantity_TOC_RGB),
mySpecularColor (0., 0., 0., Quantity_TOC_RGB)
myDiffuseColor (0.8, 0.8, 0.8, Quantity_TOC_sRGB),
myEmissiveColor (Quantity_NOC_BLACK),
mySpecularColor (Quantity_NOC_BLACK)
{}
@@ -169,11 +169,11 @@ VrmlData_ErrorStatus VrmlData_Material::Read (VrmlData_InBuffer& theBuffer)
myShininess = anIntensity[1];
myTransparency = anIntensity[2];
myDiffuseColor.SetValues (aColor[0].X(), aColor[0].Y(), aColor[0].Z(),
Quantity_TOC_RGB);
Quantity_TOC_sRGB);
myEmissiveColor.SetValues (aColor[1].X(), aColor[1].Y(), aColor[1].Z(),
Quantity_TOC_RGB);
Quantity_TOC_sRGB);
mySpecularColor.SetValues (aColor[2].X(), aColor[2].Y(), aColor[2].Z(),
Quantity_TOC_RGB);
Quantity_TOC_sRGB);
}
return aStatus;
}
@@ -193,7 +193,7 @@ VrmlData_ErrorStatus VrmlData_Material::Write (const char * thePrefix) const
{
char buf[128];
Standard_Real val[3];
Quantity_TypeOfColor bidType (Quantity_TOC_RGB);
const Quantity_TypeOfColor bidType = Quantity_TOC_sRGB;
const Standard_Real aConf (0.001 * Precision::Confusion());
if (OK(aStatus) && fabs(myAmbientIntensity - 0.2) > aConf) {
@@ -252,7 +252,7 @@ Standard_Boolean VrmlData_Material::IsDefault () const
myTransparency < aConf)
{
Standard_Real val[3][3];
Quantity_TypeOfColor bidType (Quantity_TOC_RGB);
const Quantity_TypeOfColor bidType = Quantity_TOC_sRGB;
myDiffuseColor.Values (val[0][0], val[0][1], val[0][2], bidType);
myEmissiveColor.Values (val[1][0], val[1][1], val[1][2], bidType);
mySpecularColor.Values (val[2][0], val[2][1], val[2][2], bidType);

View File

@@ -546,11 +546,11 @@ Handle(VrmlData_Appearance) VrmlData_ShapeConvert::defaultMaterialFace () const
const Handle(VrmlData_Material) aMaterial =
new VrmlData_Material (myScene, 0L, 1.0, 0.022, 0.);
aMaterial->SetDiffuseColor (Quantity_Color(0.780392, 0.568627, 0.113725,
Quantity_TOC_RGB));
Quantity_TOC_sRGB));
aMaterial->SetEmissiveColor(Quantity_Color(0.329412, 0.223529, 0.027451,
Quantity_TOC_RGB));
Quantity_TOC_sRGB));
aMaterial->SetSpecularColor(Quantity_Color(0.992157, 0.941176, 0.807843,
Quantity_TOC_RGB));
Quantity_TOC_sRGB));
myScene.AddNode (aMaterial, Standard_False);
anAppearance = new VrmlData_Appearance (myScene, aNodeName);
anAppearance->SetMaterial (aMaterial);
@@ -903,11 +903,13 @@ Handle(VrmlData_Appearance) VrmlData_ShapeConvert::makeMaterialFromColor(
}
else
{
aNodeName.AssignCat(aColor.GetRGB().Red());
NCollection_Vec3<Standard_Real> aColor_sRGB;
aColor.GetRGB().Values (aColor_sRGB.r(), aColor_sRGB.g(), aColor_sRGB.b(), Quantity_TOC_sRGB);
aNodeName.AssignCat(aColor_sRGB.r());
aNodeName.AssignCat("_");
aNodeName.AssignCat(aColor.GetRGB().Green());
aNodeName.AssignCat(aColor_sRGB.g());
aNodeName.AssignCat("_");
aNodeName.AssignCat(aColor.GetRGB().Blue());
aNodeName.AssignCat(aColor_sRGB.b());
}
Handle(VrmlData_Appearance) anAppearance =