This class is responsible for generation of shader programs. More...
#include <Graphic3d_ShaderManager.hxx>

Public Member Functions | |
| Graphic3d_ShaderManager (Aspect_GraphicsLibrary theGapi) | |
| Creates new empty shader manager. | |
| virtual | ~Graphic3d_ShaderManager () |
| Releases resources of shader manager. | |
| bool | IsGapiGreaterEqual (Standard_Integer theVerMajor, Standard_Integer theVerMinor) const |
| Standard_Integer | GapiVersionMajor () const |
| Return GAPI version major number. | |
| Standard_Integer | GapiVersionMinor () const |
| Return GAPI version minor number. | |
| void | SetGapiVersion (Standard_Integer theVerMajor, Standard_Integer theVerMinor) |
| Return GAPI version major number. | |
| bool | UseRedAlpha () const |
| Return TRUE if RED channel should be used instead of ALPHA for single-channel textures (e.g. GAPI supports only GL_RED textures and not GL_ALPHA). | |
| void | SetUseRedAlpha (bool theUseRedAlpha) |
| Set if RED channel should be used instead of ALPHA for single-channel textures. | |
| bool | HasFlatShading () const |
| Return flag indicating flat shading usage; TRUE by default. | |
| bool | ToReverseDFdxSign () const |
| Return flag indicating flat shading should reverse normal flag; FALSE by default. | |
| void | SetFlatShading (bool theToUse, bool theToReverseSign) |
| Set flag indicating flat shading usage. | |
| bool | ToEmulateDepthClamp () const |
| Return TRUE if depth clamping should be emulated by GLSL program; TRUE by default. | |
| void | SetEmulateDepthClamp (bool theToEmulate) |
| Set if depth clamping should be emulated by GLSL program. | |
| bool | HasGlslExtension (Graphic3d_GlslExtension theExt) const |
| Return TRUE if specified extension is available. | |
| void | EnableGlslExtension (Graphic3d_GlslExtension theExt, bool theToEnable=true) |
| Set if specified extension is available or not. | |
Public Member Functions inherited from Standard_Transient | |
| Standard_Transient () | |
| Empty constructor. | |
| Standard_Transient (const Standard_Transient &) | |
| Copy constructor – does nothing. | |
| Standard_Transient & | operator= (const Standard_Transient &) |
| Assignment operator, needed to avoid copying reference counter. | |
| virtual | ~Standard_Transient () |
| Destructor must be virtual. | |
| virtual const opencascade::handle< Standard_Type > & | DynamicType () const |
| Returns a type descriptor about this object. | |
| Standard_Boolean | IsInstance (const opencascade::handle< Standard_Type > &theType) const |
| Returns a true value if this is an instance of Type. | |
| Standard_Boolean | IsInstance (const Standard_CString theTypeName) const |
| Returns a true value if this is an instance of TypeName. | |
| Standard_Boolean | IsKind (const opencascade::handle< Standard_Type > &theType) const |
| Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism. | |
| Standard_Boolean | IsKind (const Standard_CString theTypeName) const |
| Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism. | |
| Standard_Transient * | This () const |
| Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero. | |
| Standard_Integer | GetRefCount () const noexcept |
| Get the reference counter of this object. | |
| void | IncrementRefCounter () noexcept |
| Increments the reference counter of this object. | |
| Standard_Integer | DecrementRefCounter () noexcept |
| Decrements the reference counter of this object; returns the decremented value. | |
| virtual void | Delete () const |
| Memory deallocator for transient classes. | |
Protected Member Functions | |
| TCollection_AsciiString | genLightKey (const Handle< Graphic3d_LightSet > &theLights, const bool theHasShadowMap) const |
| Generate map key for light sources configuration. | |
| Handle< Graphic3d_ShaderProgram > | getStdProgramFont () const |
| Prepare standard GLSL program for textured font. | |
| Handle< Graphic3d_ShaderProgram > | getStdProgramUnlit (Standard_Integer theBits, Standard_Boolean theIsOutline=false) const |
| Prepare standard GLSL program without lighting. | |
| Handle< Graphic3d_ShaderProgram > | getStdProgramGouraud (const Handle< Graphic3d_LightSet > &theLights, Standard_Integer theBits) const |
| Prepare standard GLSL program with per-vertex lighting. | |
| Handle< Graphic3d_ShaderProgram > | getStdProgramPhong (const Handle< Graphic3d_LightSet > &theLights, const Standard_Integer theBits, const Standard_Boolean theIsFlatNormal, const Standard_Boolean theIsPBR, const Standard_Integer theNbShadowMaps) const |
| Prepare standard GLSL program with per-pixel lighting. | |
| Handle< Graphic3d_ShaderProgram > | getStdProgramBoundBox () const |
| Prepare standard GLSL program for bounding box. | |
| Handle< Graphic3d_ShaderProgram > | getBgCubeMapProgram () const |
| Generates shader program to render environment cubemap as background. | |
| Handle< Graphic3d_ShaderProgram > | getBgSkydomeProgram () const |
| Generates shader program to render skydome background. | |
| Handle< Graphic3d_ShaderProgram > | getColoredQuadProgram () const |
| Generates shader program to render correctly colored quad. | |
| Handle< Graphic3d_ShaderProgram > | getPBREnvBakingProgram (Standard_Integer theIndex) const |
| Prepare GLSL source for IBL generation used in PBR pipeline. | |
| Handle< Graphic3d_ShaderProgram > | getStdProgramFboBlit (Standard_Integer theNbSamples, Standard_Boolean theIsFallback_sRGB) const |
| Prepare standard GLSL program for FBO blit operation. | |
| Handle< Graphic3d_ShaderProgram > | getStdProgramStereo (Graphic3d_StereoMode theStereoMode) const |
| Prepare standard GLSL program for stereoscopic image. | |
| Handle< Graphic3d_ShaderProgram > | getStdProgramOitCompositing (Standard_Boolean theMsaa) const |
| Prepare standard GLSL programs for OIT compositing operation. | |
| Handle< Graphic3d_ShaderProgram > | getStdProgramOitDepthPeelingBlend (Standard_Boolean theMsaa) const |
| Prepare standard GLSL programs for OIT Depth Peeling blend operation. | |
| Handle< Graphic3d_ShaderProgram > | getStdProgramOitDepthPeelingFlush (Standard_Boolean theMsaa) const |
| Prepare standard GLSL programs for OIT Depth Peeling flush operation. | |
| bool | hasGlslBitwiseOps () const |
| Return TRUE if bitwise operations can be used in GLSL program. | |
| Standard_Integer | defaultGlslVersion (const Handle< Graphic3d_ShaderProgram > &theProgram, const TCollection_AsciiString &theName, Standard_Integer theBits, bool theUsesDerivates=false) const |
| Prepare GLSL version header. | |
| void | defaultOitGlslVersion (const Handle< Graphic3d_ShaderProgram > &theProgram, const TCollection_AsciiString &theName, bool theMsaa) const |
| Prepare GLSL version header for OIT composition programs. | |
| TCollection_AsciiString | pointSpriteAlphaSrc (Standard_Integer theBits) const |
| Prepare standard GLSL program for accessing point sprite alpha. | |
| TCollection_AsciiString | pointSpriteShadingSrc (const TCollection_AsciiString &theBaseColorSrc, Standard_Integer theBits) const |
| Prepare standard GLSL program for computing point sprite shading. | |
| TCollection_AsciiString | stdComputeLighting (Standard_Integer &theNbLights, const Handle< Graphic3d_LightSet > &theLights, Standard_Boolean theHasVertColor, Standard_Boolean theIsPBR, Standard_Boolean theHasTexColor, Standard_Integer theNbShadowMaps) const |
| Define computeLighting GLSL function depending on current lights configuration. | |
Protected Attributes | |
| Aspect_GraphicsLibrary | myGapi |
| GAPI name. | |
| Graphic3d_Vec2i | myGapiVersion |
| GAPI version major/minor number pair. | |
| Standard_Boolean | myGlslExtensions [Graphic3d_GlslExtension_NB] |
| Standard_Boolean | myHasFlatShading |
| flag indicating flat shading usage | |
| Standard_Boolean | myToReverseDFdxSign |
| flag to reverse flat shading normal (workaround) | |
| Standard_Boolean | mySetPointSize |
| always set gl_PointSize variable | |
| Standard_Boolean | myUseRedAlpha |
| use RED channel instead of ALPHA (e.g. GAPI supports only GL_RED textures and not GL_ALPHA) | |
| Standard_Boolean | myToEmulateDepthClamp |
| emulate depth clamping in GLSL program | |
| Standard_Boolean | mySRgbState |
| track sRGB state | |
Additional Inherited Members | |
| typedef void | base_type |
| Returns a type descriptor about this object. | |
| static constexpr const char * | get_type_name () |
| Returns a type descriptor about this object. | |
| static const opencascade::handle< Standard_Type > & | get_type_descriptor () |
| Returns type descriptor of Standard_Transient class. | |
This class is responsible for generation of shader programs.
| Graphic3d_ShaderManager::Graphic3d_ShaderManager | ( | Aspect_GraphicsLibrary | theGapi | ) |
Creates new empty shader manager.
|
virtual |
Releases resources of shader manager.
|
protected |
Prepare GLSL version header.
| [in] |
out] theProgram program to set version header
| [in] | theName | program id suffix |
| [in] | theBits | program bits |
| [in] | theUsesDerivates | program uses standard derivatives functions or not |
|
protected |
Prepare GLSL version header for OIT composition programs.
| [in] |
out] theProgram program to set version header
| [in] | theName | program id suffix |
| [in] | theMsaa | multisampling flag |
|
inline |
Set if specified extension is available or not.
|
inline |
Return GAPI version major number.
|
inline |
Return GAPI version minor number.
|
protected |
Generate map key for light sources configuration.
| [in] | theLights | list of light sources |
| [in] | theHasShadowMap | flag indicating shadow maps usage |
|
protected |
Generates shader program to render environment cubemap as background.
|
protected |
Generates shader program to render skydome background.
|
protected |
Generates shader program to render correctly colored quad.
|
protected |
Prepare GLSL source for IBL generation used in PBR pipeline.
|
protected |
Prepare standard GLSL program for bounding box.
|
protected |
Prepare standard GLSL program for FBO blit operation.
|
protected |
Prepare standard GLSL program for textured font.
|
protected |
Prepare standard GLSL program with per-vertex lighting.
| [in] | theLights | list of light sources |
| [in] | theBits | program bits |
|
protected |
Prepare standard GLSL programs for OIT compositing operation.
|
protected |
Prepare standard GLSL programs for OIT Depth Peeling blend operation.
|
protected |
Prepare standard GLSL programs for OIT Depth Peeling flush operation.
|
protected |
Prepare standard GLSL program with per-pixel lighting.
| [in] | theLights | list of light sources |
| [in] | theBits | program bits |
| [in] | theIsFlatNormal | when TRUE, the Vertex normals will be ignored and Face normal will be computed instead |
| [in] | theIsPBR | when TRUE, the PBR pipeline will be activated |
| [in] | theNbShadowMaps | number of shadow maps |
|
protected |
Prepare standard GLSL program for stereoscopic image.
|
protected |
Prepare standard GLSL program without lighting.
| [in] | theBits | program bits |
| [in] | theIsOutline | draw silhouette |
|
inline |
Return flag indicating flat shading usage; TRUE by default.
|
protected |
Return TRUE if bitwise operations can be used in GLSL program.
|
inline |
Return TRUE if specified extension is available.
|
inline |
|
protected |
Prepare standard GLSL program for accessing point sprite alpha.
|
protected |
Prepare standard GLSL program for computing point sprite shading.
|
inline |
Set if depth clamping should be emulated by GLSL program.
|
inline |
Set flag indicating flat shading usage.
|
inline |
Return GAPI version major number.
|
inline |
Set if RED channel should be used instead of ALPHA for single-channel textures.
|
protected |
Define computeLighting GLSL function depending on current lights configuration.
| [out] | theNbLights | number of defined light sources |
| [in] | theLights | light sources list |
| [in] | theHasVertColor | flag to use getVertColor() instead of Ambient and Diffuse components of active material |
| [in] | theIsPBR | flag to activate PBR pipeline |
| [in] | theHasTexColor | flag to include color texturing |
| [in] | theNbShadowMaps | flag to include shadow map |
|
inline |
Return TRUE if depth clamping should be emulated by GLSL program; TRUE by default.
|
inline |
Return flag indicating flat shading should reverse normal flag; FALSE by default.
|
inline |
Return TRUE if RED channel should be used instead of ALPHA for single-channel textures (e.g. GAPI supports only GL_RED textures and not GL_ALPHA).
|
protected |
GAPI name.
|
protected |
GAPI version major/minor number pair.
|
protected |
|
protected |
flag indicating flat shading usage
|
protected |
always set gl_PointSize variable
|
protected |
track sRGB state
|
protected |
emulate depth clamping in GLSL program
|
protected |
flag to reverse flat shading normal (workaround)
|
protected |
use RED channel instead of ALPHA (e.g. GAPI supports only GL_RED textures and not GL_ALPHA)