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:
parent
91c60b5790
commit
f483f2ed11
@ -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();
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user