1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +03:00

0031096: Visualization, TKOpenGl - support metallic-roughness texture mapping

OpenGl_ShaderManager - metallic-roughness, emissive, occlusion
and normal texture maps are now supported by PBR.
Emissive, occlusion and normal texture maps are now supported by Phong shading model.
Path-Tracing now handles metallic-roughness and emissive texture maps.

Graphic3d_TextureUnit enumeration has been extended by
new values corresponding to supported texture maps.

OpenGl_TextureSet and OpenGl_ShaderProgram have been extended with
bitmask Graphic3d_TextureSetBits identifying texture slots read from GLSL Program
and slots defined within Texture Set to avoid undefined behavior by binding mock textures.

OpenGl_TextureSet now duplicates texture unit information to handle
textures shared across multiple slots (like Occlusion [R] + Metallic-Roughness [GB]).

OpenGl_Context::BindTextures() has been extended with active GLSL program paramter
to set mock textures to texture units used by program but undefined by texture set.
OpenGl_Workspace::ApplyAspects() has been extended with parameter to avoid bining texture set.
This commit is contained in:
iko
2019-11-07 16:52:53 +03:00
committed by bugmaster
parent f051908edc
commit 72f6dc612c
35 changed files with 856 additions and 405 deletions

View File

@@ -618,6 +618,10 @@ protected:
&& theTextures->HasNonPointSprite())
{
aBits |= OpenGl_PO_TextureRGB;
if ((theTextures->TextureSetBits() & Graphic3d_TextureSetBits_Normal) != 0)
{
aBits |= OpenGl_PO_TextureNormal;
}
}
if (theHasVertColor
&& theInteriorStyle != Aspect_IS_HIDDENLINE)
@@ -637,7 +641,7 @@ protected:
Standard_Integer theBits)
{
if (theShadingModel == Graphic3d_TOSM_UNLIT
|| (theBits & OpenGl_PO_TextureEnv) != 0)
|| (theBits & OpenGl_PO_HasTextures) == OpenGl_PO_TextureEnv)
{
// If environment map is enabled lighting calculations are
// not needed (in accordance with default OCCT behavior)
@@ -714,9 +718,11 @@ protected:
//! @param theNbLights [out] number of defined light sources
//! @param theHasVertColor [in] flag to use getVertColor() instead of Ambient and Diffuse components of active material
//! @param theIsPBR [in] flag to activate PBR pipeline
//! @param theHasEmissive [in] flag to include emissive
Standard_EXPORT TCollection_AsciiString stdComputeLighting (Standard_Integer& theNbLights,
Standard_Boolean theHasVertColor,
Standard_Boolean theIsPBR);
Standard_Boolean theIsPBR,
Standard_Boolean theHasEmissive = true);
//! Bind specified program to current context and apply state.
Standard_EXPORT Standard_Boolean bindProgramWithState (const Handle(OpenGl_ShaderProgram)& theProgram);