1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0025964: Visualization, TKOpenGl - compile RayTracing shader without texturing when no textures in use

This commit is contained in:
dbp 2015-04-01 16:19:20 +03:00 committed by bugmaster
parent 91c60b5790
commit f483f2ed11
3 changed files with 16 additions and 6 deletions

View File

@ -304,7 +304,7 @@ public: //! @name methods related to texture management
}
//! Checks if scene contains textured objects.
Standard_Integer HasTextures() const
Standard_Boolean HasTextures() const
{
return !myTextures.IsEmpty();
}

View File

@ -429,14 +429,18 @@ protected: //! @name data types related to ray-tracing
//! Actual ray-tracing depth (number of ray bounces).
Standard_Integer NbBounces;
//! Sets light propagation through transparent media.
//! Enables/disables light propagation through transparent media.
Standard_Boolean TransparentShadows;
//! Enables/disables the use of OpenGL bindless textures.
Standard_Boolean UseBindlessTextures;
//! Creates default compile-time ray-tracing parameters.
RaytracingParams()
: StackSize (THE_DEFAULT_STACK_SIZE),
NbBounces (THE_DEFAULT_NB_BOUNCES),
TransparentShadows (Standard_False)
TransparentShadows (Standard_False),
UseBindlessTextures (Standard_False)
{
//
}

View File

@ -1011,9 +1011,9 @@ TCollection_AsciiString OpenGl_View::generateShaderPrefix (const Handle(OpenGl_C
aPrefixString += TCollection_AsciiString ("\n#define TRANSPARENT_SHADOWS");
}
// If OpenGL driver supports bindless textures,
// activate texturing in ray-tracing mode
if (theGlContext->arbTexBindless != NULL)
// If OpenGL driver supports bindless textures and texturing
// is actually used, activate texturing in ray-tracing mode
if (myRaytraceParameters.UseBindlessTextures && theGlContext->arbTexBindless != NULL)
{
aPrefixString += TCollection_AsciiString ("\n#define USE_TEXTURES") +
TCollection_AsciiString ("\n#define MAX_TEX_NUMBER ") + TCollection_AsciiString (OpenGl_RaytraceGeometry::MAX_TEX_NUMBER);
@ -1153,6 +1153,12 @@ Standard_Boolean OpenGl_View::initRaytraceResources (const Graphic3d_CView& theC
aToRebuildShaders = Standard_True;
}
if (myRaytraceGeometry.HasTextures() != myRaytraceParameters.UseBindlessTextures)
{
myRaytraceParameters.UseBindlessTextures = myRaytraceGeometry.HasTextures();
aToRebuildShaders = Standard_True;
}
if (theCView.RenderParams.IsTransparentShadowEnabled != myRaytraceParameters.TransparentShadows)
{
myRaytraceParameters.TransparentShadows = theCView.RenderParams.IsTransparentShadowEnabled;