mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-29 14:00: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:
@@ -385,7 +385,7 @@ bool RWGltf_GltfJsonParser::gltfParseStdMaterial (Handle(RWGltf_MaterialCommon)&
|
||||
else if (gltfReadVec4 (anAmb, anAmbVal)
|
||||
&& validateColor4 (anAmb))
|
||||
{
|
||||
theMat->AmbientColor = Quantity_Color (anAmb.r(), anAmb.g(), anAmb.b(), Quantity_TOC_RGB);
|
||||
theMat->AmbientColor = Quantity_Color (anAmb.r(), anAmb.g(), anAmb.b(), Quantity_TOC_sRGB);
|
||||
}
|
||||
|
||||
if (aDiffVal != NULL
|
||||
@@ -396,14 +396,14 @@ bool RWGltf_GltfJsonParser::gltfParseStdMaterial (Handle(RWGltf_MaterialCommon)&
|
||||
else if (gltfReadVec4 (aDiff, aDiffVal)
|
||||
&& validateColor4 (aDiff))
|
||||
{
|
||||
theMat->DiffuseColor = Quantity_Color (aDiff.r(), aDiff.g(), aDiff.b(), Quantity_TOC_RGB);
|
||||
theMat->DiffuseColor = Quantity_Color (aDiff.r(), aDiff.g(), aDiff.b(), Quantity_TOC_sRGB);
|
||||
theMat->Transparency = float(1.0 - aDiff.a());
|
||||
}
|
||||
|
||||
if (gltfReadVec4 (anEmi, anEmiVal)
|
||||
&& validateColor4 (anEmi))
|
||||
{
|
||||
theMat->EmissiveColor = Quantity_Color (anEmi.r(), anEmi.g(), anEmi.b(), Quantity_TOC_RGB);
|
||||
theMat->EmissiveColor = Quantity_Color (anEmi.r(), anEmi.g(), anEmi.b(), Quantity_TOC_sRGB);
|
||||
}
|
||||
|
||||
if (aSpecVal != NULL
|
||||
@@ -414,7 +414,7 @@ bool RWGltf_GltfJsonParser::gltfParseStdMaterial (Handle(RWGltf_MaterialCommon)&
|
||||
if (gltfReadVec4 (aSpec, aSpecVal)
|
||||
&& validateColor4 (aSpec))
|
||||
{
|
||||
theMat->SpecularColor = Quantity_Color (aSpec.r(), aSpec.g(), aSpec.b(), Quantity_TOC_RGB);
|
||||
theMat->SpecularColor = Quantity_Color (aSpec.r(), aSpec.g(), aSpec.b(), Quantity_TOC_sRGB);
|
||||
}
|
||||
|
||||
if (aShinVal != NULL
|
||||
|
@@ -36,10 +36,10 @@ public:
|
||||
Standard_ShortReal Transparency;
|
||||
|
||||
RWGltf_MaterialCommon()
|
||||
: AmbientColor (0.1, 0.1, 0.1, Quantity_TOC_RGB),
|
||||
DiffuseColor (0.8, 0.8, 0.8, Quantity_TOC_RGB),
|
||||
SpecularColor(0.2, 0.2, 0.2, Quantity_TOC_RGB),
|
||||
EmissiveColor(0.0, 0.0, 0.0, Quantity_TOC_RGB),
|
||||
: AmbientColor (0.1, 0.1, 0.1, Quantity_TOC_sRGB),
|
||||
DiffuseColor (0.8, 0.8, 0.8, Quantity_TOC_sRGB),
|
||||
SpecularColor(0.2, 0.2, 0.2, Quantity_TOC_sRGB),
|
||||
EmissiveColor(Quantity_NOC_BLACK),
|
||||
Shininess (1.0f),
|
||||
Transparency (0.0f) {}
|
||||
|
||||
|
Reference in New Issue
Block a user