//! This class is responsible for managing shader programs.
class Graphic3d_ShaderProgram : public Standard_Transient
{
+ DEFINE_STANDARD_RTTIEXT(Graphic3d_ShaderProgram, Standard_Transient)
+public:
+
+ //! Default value of THE_MAX_LIGHTS macros within GLSL program (see Declarations.glsl).
+ static const Standard_Integer THE_MAX_LIGHTS_DEFAULT = 8;
+
+ //! Default value of THE_MAX_CLIP_PLANES macros within GLSL program (see Declarations.glsl).
+ static const Standard_Integer THE_MAX_CLIP_PLANES_DEFAULT = 8;
public:
//! @endcode
void SetHeader (const TCollection_AsciiString& theHeader) { myHeader = theHeader; }
+ //! Append line to GLSL header.
+ void AppendToHeader (const TCollection_AsciiString& theHeaderLine)
+ {
+ if (!myHeader.IsEmpty())
+ {
+ myHeader += "\n";
+ }
+ myHeader += theHeaderLine;
+ }
+
+ //! Return the length of array of light sources (THE_MAX_LIGHTS),
+ //! to be used for initialization occLightSources.
+ //! Default value is THE_MAX_LIGHTS_DEFAULT.
+ Standard_Integer NbLightsMax() const { return myNbLightsMax; }
+
+ //! Specify the length of array of light sources (THE_MAX_LIGHTS).
+ void SetNbLightsMax (Standard_Integer theNbLights) { myNbLightsMax = theNbLights; }
+
+ //! Return the length of array of clipping planes (THE_MAX_CLIP_PLANES),
+ //! to be used for initialization occClipPlaneEquations.
+ //! Default value is THE_MAX_CLIP_PLANES_DEFAULT.
+ Standard_Integer NbClipPlanesMax() const { return myNbClipPlanesMax; }
+
+ //! Specify the length of array of clipping planes (THE_MAX_CLIP_PLANES).
+ void SetNbClipPlanesMax (Standard_Integer theNbPlanes) { myNbClipPlanesMax = theNbPlanes; }
+
//! Attaches shader object to the program object.
Standard_EXPORT Standard_Boolean AttachShader (const Handle(Graphic3d_ShaderObject)& theShader);
//! @return the root folder with default GLSL programs.
Standard_EXPORT static const TCollection_AsciiString& ShadersFolder();
-public:
-
- DEFINE_STANDARD_RTTIEXT(Graphic3d_ShaderProgram,Standard_Transient)
-
private:
TCollection_AsciiString myID; //!< the unique identifier of program object
Graphic3d_ShaderVariableList myVariables; //!< the list of custom uniform variables
Graphic3d_ShaderAttributeList myAttributes; //!< the list of custom vertex attributes
TCollection_AsciiString myHeader; //!< GLSL header with version code and used extensions
+ Standard_Integer myNbLightsMax; //!< length of array of light sources (THE_MAX_LIGHTS)
+ Standard_Integer myNbClipPlanesMax; //!< length of array of clipping planes (THE_MAX_CLIP_PLANES)
};