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

@@ -1311,7 +1311,7 @@ void OpenGl_View::renderScene (Graphic3d_Camera::Projection theProjection,
}
renderStructs (theProjection, theReadDrawFbo, theOitAccumFbo, theToDrawImmediate);
aContext->BindTextures (Handle(OpenGl_TextureSet)());
aContext->BindTextures (Handle(OpenGl_TextureSet)(), Handle(OpenGl_ShaderProgram)());
// Apply restored view matrix.
aContext->ApplyWorldViewMatrix();
@@ -1530,7 +1530,7 @@ bool OpenGl_View::blitBuffers (OpenGl_FrameBuffer* theReadFbo,
}
#endif
aCtx->BindTextures (Handle(OpenGl_TextureSet)());
aCtx->BindTextures (Handle(OpenGl_TextureSet)(), Handle(OpenGl_ShaderProgram)());
const Graphic3d_TypeOfTextureFilter aFilter = (aDrawSizeX == aReadSizeX && aDrawSizeY == aReadSizeY) ? Graphic3d_TOTF_NEAREST : Graphic3d_TOTF_BILINEAR;
const GLint aFilterGl = aFilter == Graphic3d_TOTF_NEAREST ? GL_NEAREST : GL_LINEAR;
@@ -1674,7 +1674,7 @@ void OpenGl_View::drawStereoPair (OpenGl_FrameBuffer* theDrawFbo)
aCtx->core20fwd->glDepthMask (GL_TRUE);
aCtx->core20fwd->glEnable (GL_DEPTH_TEST);
aCtx->BindTextures (Handle(OpenGl_TextureSet)());
aCtx->BindTextures (Handle(OpenGl_TextureSet)(), Handle(OpenGl_ShaderProgram)());
OpenGl_VertexBuffer* aVerts = initBlitQuad (myToFlipOutput);
const Handle(OpenGl_ShaderManager)& aManager = aCtx->ShaderManager();