1 // Created on: 2013-09-26
2 // Created by: Denis BOGOLEPOV
3 // Copyright (c) 2013-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _OpenGl_ShaderManager_HeaderFile
17 #define _OpenGl_ShaderManager_HeaderFile
19 #include <Graphic3d_ShaderProgram.hxx>
20 #include <Graphic3d_StereoMode.hxx>
22 #include <NCollection_DataMap.hxx>
23 #include <NCollection_Sequence.hxx>
25 #include <OpenGl_SetOfShaderPrograms.hxx>
26 #include <OpenGl_ShaderStates.hxx>
27 #include <OpenGl_AspectFace.hxx>
28 #include <OpenGl_AspectLine.hxx>
29 #include <OpenGl_AspectText.hxx>
30 #include <OpenGl_AspectMarker.hxx>
31 #include <OpenGl_MaterialState.hxx>
32 #include <OpenGl_Texture.hxx>
35 class OpenGl_VertexBuffer;
37 //! List of shader programs.
38 typedef NCollection_Sequence<Handle(OpenGl_ShaderProgram)> OpenGl_ShaderProgramList;
40 //! This class is responsible for managing shader programs.
41 class OpenGl_ShaderManager : public Standard_Transient
43 DEFINE_STANDARD_RTTIEXT(OpenGl_ShaderManager, Standard_Transient)
44 friend class OpenGl_ShaderProgram;
47 //! Creates new empty shader manager.
48 Standard_EXPORT OpenGl_ShaderManager (OpenGl_Context* theContext);
50 //! Releases resources of shader manager.
51 Standard_EXPORT virtual ~OpenGl_ShaderManager();
53 //! Release all resources.
54 Standard_EXPORT void clear();
56 //! Return local camera transformation.
57 const gp_XYZ& LocalOrigin() const { return myLocalOrigin; }
59 //! Setup local camera transformation for compensating float precision issues.
60 void SetLocalOrigin (const gp_XYZ& theOrigin)
62 myLocalOrigin = theOrigin;
63 myHasLocalOrigin = !theOrigin.IsEqual (gp_XYZ(0.0, 0.0, 0.0), gp::Resolution());
66 //! Creates new shader program or re-use shared instance.
67 //! @param theProxy [IN] program definition
68 //! @param theShareKey [OUT] sharing key
69 //! @param theProgram [OUT] OpenGL program
70 //! @return true on success
71 Standard_EXPORT Standard_Boolean Create (const Handle(Graphic3d_ShaderProgram)& theProxy,
72 TCollection_AsciiString& theShareKey,
73 Handle(OpenGl_ShaderProgram)& theProgram);
75 //! Unregisters specified shader program.
76 Standard_EXPORT void Unregister (TCollection_AsciiString& theShareKey,
77 Handle(OpenGl_ShaderProgram)& theProgram);
79 //! Returns list of registered shader programs.
80 Standard_EXPORT const OpenGl_ShaderProgramList& ShaderPrograms() const;
82 //! Returns true if no program objects are registered in the manager.
83 Standard_EXPORT Standard_Boolean IsEmpty() const;
85 //! Bind program for filled primitives rendering
86 Standard_Boolean BindFaceProgram (const Handle(OpenGl_TextureSet)& theTextures,
87 const Graphic3d_TypeOfShadingModel theShadingModel,
88 const Graphic3d_AlphaMode theAlphaMode,
89 const Standard_Boolean theHasVertColor,
90 const Standard_Boolean theEnableEnvMap,
91 const Handle(OpenGl_ShaderProgram)& theCustomProgram)
93 if (!theCustomProgram.IsNull()
94 || myContext->caps->ffpEnable)
96 return bindProgramWithState (theCustomProgram);
99 const Graphic3d_TypeOfShadingModel aShadeModelOnFace = theShadingModel != Graphic3d_TOSM_UNLIT
100 && (theTextures.IsNull() || theTextures->IsModulate())
102 : Graphic3d_TOSM_UNLIT;
103 const Standard_Integer aBits = getProgramBits (theTextures, theAlphaMode, theHasVertColor, theEnableEnvMap);
104 Handle(OpenGl_ShaderProgram)& aProgram = getStdProgram (aShadeModelOnFace, aBits);
105 return bindProgramWithState (aProgram);
108 //! Bind program for line rendering
109 Standard_Boolean BindLineProgram (const Handle(OpenGl_TextureSet)& theTextures,
110 const Aspect_TypeOfLine theLineType,
111 const Graphic3d_TypeOfShadingModel theShadingModel,
112 const Graphic3d_AlphaMode theAlphaMode,
113 const Standard_Boolean theHasVertColor,
114 const Handle(OpenGl_ShaderProgram)& theCustomProgram)
116 if (!theCustomProgram.IsNull()
117 || myContext->caps->ffpEnable)
119 return bindProgramWithState (theCustomProgram);
122 Standard_Integer aBits = getProgramBits (theTextures, theAlphaMode, theHasVertColor, false);
123 if (theLineType != Aspect_TOL_SOLID)
125 aBits |= OpenGl_PO_StippleLine;
128 Handle(OpenGl_ShaderProgram)& aProgram = getStdProgram (theShadingModel, aBits);
129 return bindProgramWithState (aProgram);
132 //! Bind program for point rendering
133 Standard_Boolean BindMarkerProgram (const Handle(OpenGl_TextureSet)& theTextures,
134 const Graphic3d_TypeOfShadingModel theShadingModel,
135 const Graphic3d_AlphaMode theAlphaMode,
136 const Standard_Boolean theHasVertColor,
137 const Handle(OpenGl_ShaderProgram)& theCustomProgram)
139 if (!theCustomProgram.IsNull()
140 || myContext->caps->ffpEnable)
142 return bindProgramWithState (theCustomProgram);
145 const Standard_Integer aBits = getProgramBits (theTextures, theAlphaMode, theHasVertColor, false) | OpenGl_PO_Point;
146 Handle(OpenGl_ShaderProgram)& aProgram = getStdProgram (theShadingModel, aBits);
147 return bindProgramWithState (aProgram);
150 //! Bind program for rendering alpha-textured font.
151 Standard_Boolean BindFontProgram (const Handle(OpenGl_ShaderProgram)& theCustomProgram)
153 if (!theCustomProgram.IsNull()
154 || myContext->caps->ffpEnable)
156 return bindProgramWithState (theCustomProgram);
159 if (myFontProgram.IsNull())
161 prepareStdProgramFont();
164 return bindProgramWithState (myFontProgram);
167 //! Bind program for FBO blit operation.
168 Standard_Boolean BindFboBlitProgram()
170 if (myBlitProgram.IsNull())
172 prepareStdProgramFboBlit();
174 return !myBlitProgram.IsNull()
175 && myContext->BindProgram (myBlitProgram);
178 //! Bind program for blended order-independent transparency buffers compositing.
179 Standard_Boolean BindOitCompositingProgram (const Standard_Boolean theIsMSAAEnabled)
181 const Standard_Integer aProgramIdx = theIsMSAAEnabled ? 1 : 0;
182 if (myOitCompositingProgram[aProgramIdx].IsNull())
184 prepareStdProgramOitCompositing (theIsMSAAEnabled);
187 const Handle(OpenGl_ShaderProgram)& aProgram = myOitCompositingProgram [aProgramIdx];
188 return !aProgram.IsNull() && myContext->BindProgram (aProgram);
191 //! Bind program for rendering stereoscopic image.
192 Standard_Boolean BindStereoProgram (const Graphic3d_StereoMode theStereoMode)
194 if (theStereoMode < 0 || theStereoMode >= Graphic3d_StereoMode_NB)
196 return Standard_False;
199 if (myStereoPrograms[theStereoMode].IsNull())
201 prepareStdProgramStereo (myStereoPrograms[theStereoMode], theStereoMode);
203 const Handle(OpenGl_ShaderProgram)& aProgram = myStereoPrograms[theStereoMode];
204 return !aProgram.IsNull()
205 && myContext->BindProgram (aProgram);
208 //! Bind program for rendering bounding box.
209 Standard_Boolean BindBoundBoxProgram()
211 if (myBoundBoxProgram.IsNull())
213 prepareStdProgramBoundBox();
215 return bindProgramWithState (myBoundBoxProgram);
218 //! Returns bounding box vertex buffer.
219 const Handle(OpenGl_VertexBuffer)& BoundBoxVertBuffer() const { return myBoundBoxVertBuffer; }
223 //! Returns current state of OCCT light sources.
224 const OpenGl_LightSourceState& LightSourceState() const { return myLightSourceState; }
226 //! Updates state of OCCT light sources.
227 Standard_EXPORT void UpdateLightSourceStateTo (const Handle(Graphic3d_LightSet)& theLights);
229 //! Invalidate state of OCCT light sources.
230 Standard_EXPORT void UpdateLightSourceState();
232 //! Pushes current state of OCCT light sources to specified program.
233 Standard_EXPORT void PushLightSourceState (const Handle(OpenGl_ShaderProgram)& theProgram) const;
237 //! Returns current state of OCCT projection transform.
238 const OpenGl_ProjectionState& ProjectionState() const { return myProjectionState; }
240 //! Updates state of OCCT projection transform.
241 Standard_EXPORT void UpdateProjectionStateTo (const OpenGl_Mat4& theProjectionMatrix);
243 //! Pushes current state of OCCT projection transform to specified program.
244 Standard_EXPORT void PushProjectionState (const Handle(OpenGl_ShaderProgram)& theProgram) const;
248 //! Returns current state of OCCT model-world transform.
249 const OpenGl_ModelWorldState& ModelWorldState() const { return myModelWorldState; }
251 //! Updates state of OCCT model-world transform.
252 Standard_EXPORT void UpdateModelWorldStateTo (const OpenGl_Mat4& theModelWorldMatrix);
254 //! Pushes current state of OCCT model-world transform to specified program.
255 Standard_EXPORT void PushModelWorldState (const Handle(OpenGl_ShaderProgram)& theProgram) const;
259 //! Returns current state of OCCT world-view transform.
260 const OpenGl_WorldViewState& WorldViewState() const { return myWorldViewState; }
262 //! Updates state of OCCT world-view transform.
263 Standard_EXPORT void UpdateWorldViewStateTo (const OpenGl_Mat4& theWorldViewMatrix);
265 //! Pushes current state of OCCT world-view transform to specified program.
266 Standard_EXPORT void PushWorldViewState (const Handle(OpenGl_ShaderProgram)& theProgram) const;
270 //! Updates state of OCCT clipping planes.
271 Standard_EXPORT void UpdateClippingState();
273 //! Reverts state of OCCT clipping planes.
274 Standard_EXPORT void RevertClippingState();
276 //! Pushes current state of OCCT clipping planes to specified program.
277 Standard_EXPORT void PushClippingState (const Handle(OpenGl_ShaderProgram)& theProgram) const;
281 //! Returns current state of material.
282 const OpenGl_MaterialState& MaterialState() const { return myMaterialState; }
284 //! Updates state of material.
285 void UpdateMaterialStateTo (const OpenGl_Material& theFrontMat,
286 const OpenGl_Material& theBackMat,
287 const float theAlphaCutoff,
288 const bool theToDistinguish,
289 const bool theToMapTexture)
291 myMaterialState.Set (theFrontMat, theBackMat, theAlphaCutoff, theToDistinguish, theToMapTexture);
292 myMaterialState.Update();
295 //! Updates state of material.
296 void UpdateMaterialState()
298 myMaterialState.Update();
301 //! Pushes current state of material to specified program.
302 void PushMaterialState (const Handle(OpenGl_ShaderProgram)& theProgram) const;
306 //! Returns state of OIT uniforms.
307 const OpenGl_OitState& OitState() const { return myOitState; }
309 //! Set the state of OIT rendering pass.
310 //! @param theToEnableOitWrite [in] flag indicating whether the special output should be written for OIT algorithm.
311 //! @param theDepthFactor [in] the scalar factor of depth influence to the fragment's coverage.
312 void SetOitState (const bool theToEnableOitWrite, const float theDepthFactor)
314 myOitState.Set (theToEnableOitWrite, theDepthFactor);
318 //! Pushes state of OIT uniforms to the specified program.
319 Standard_EXPORT void PushOitState (const Handle(OpenGl_ShaderProgram)& theProgram) const;
323 //! Pushes current state of OCCT graphics parameters to specified program.
324 Standard_EXPORT void PushState (const Handle(OpenGl_ShaderProgram)& theProgram) const;
328 //! Overwrites context
329 void SetContext (OpenGl_Context* theCtx)
334 //! Returns true when provided context is the same as used one by shader manager.
335 bool IsSameContext (OpenGl_Context* theCtx) const
337 return myContext == theCtx;
340 //! Choose Shading Model for filled primitives.
341 //! Fallbacks to FACET model if there are no normal attributes.
342 Graphic3d_TypeOfShadingModel ChooseFaceShadingModel (Graphic3d_TypeOfShadingModel theCustomModel,
343 bool theHasNodalNormals) const
345 if (!myContext->ColorMask())
347 return Graphic3d_TOSM_UNLIT;
349 Graphic3d_TypeOfShadingModel aModel = theCustomModel != Graphic3d_TOSM_DEFAULT ? theCustomModel : myShadingModel;
352 case Graphic3d_TOSM_DEFAULT:
353 case Graphic3d_TOSM_UNLIT:
354 case Graphic3d_TOSM_FACET:
356 case Graphic3d_TOSM_VERTEX:
357 case Graphic3d_TOSM_FRAGMENT:
358 return theHasNodalNormals ? aModel : Graphic3d_TOSM_FACET;
360 return Graphic3d_TOSM_UNLIT;
363 //! Choose Shading Model for line primitives.
364 //! Fallbacks to UNLIT model if there are no normal attributes.
365 Graphic3d_TypeOfShadingModel ChooseLineShadingModel (Graphic3d_TypeOfShadingModel theCustomModel,
366 bool theHasNodalNormals) const
368 if (!myContext->ColorMask())
370 return Graphic3d_TOSM_UNLIT;
372 Graphic3d_TypeOfShadingModel aModel = theCustomModel != Graphic3d_TOSM_DEFAULT ? theCustomModel : myShadingModel;
375 case Graphic3d_TOSM_DEFAULT:
376 case Graphic3d_TOSM_UNLIT:
377 case Graphic3d_TOSM_FACET:
378 return Graphic3d_TOSM_UNLIT;
379 case Graphic3d_TOSM_VERTEX:
380 case Graphic3d_TOSM_FRAGMENT:
381 return theHasNodalNormals ? aModel : Graphic3d_TOSM_UNLIT;
383 return Graphic3d_TOSM_UNLIT;
386 //! Choose Shading Model for Marker primitives.
387 Graphic3d_TypeOfShadingModel ChooseMarkerShadingModel (Graphic3d_TypeOfShadingModel theCustomModel,
388 bool theHasNodalNormals) const
390 return ChooseLineShadingModel (theCustomModel, theHasNodalNormals);
393 //! Returns default Shading Model.
394 Graphic3d_TypeOfShadingModel ShadingModel() const { return myShadingModel; }
396 //! Sets shading model.
397 Standard_EXPORT void SetShadingModel (const Graphic3d_TypeOfShadingModel theModel);
399 //! Sets last view manger used with.
400 //! Helps to handle matrix states in multi-view configurations.
401 void SetLastView (const OpenGl_View* theLastView)
403 myLastView = theLastView;
406 //! Returns true when provided view is the same as cached one.
407 bool IsSameView (const OpenGl_View* theView) const
409 return myLastView == theView;
414 //! Define program bits.
415 Standard_Integer getProgramBits (const Handle(OpenGl_TextureSet)& theTextures,
416 Graphic3d_AlphaMode theAlphaMode,
417 Standard_Boolean theHasVertColor,
418 Standard_Boolean theEnableEnvMap)
421 Standard_Integer aBits = 0;
422 if (theAlphaMode == Graphic3d_AlphaMode_Mask)
424 aBits |= OpenGl_PO_AlphaTest;
427 const Standard_Integer aNbPlanes = myContext->Clipping().NbClippingOrCappingOn();
430 aBits |= OpenGl_PO_ClipPlanesN;
431 if (myContext->Clipping().HasClippingChains())
433 aBits |= OpenGl_PO_ClipChains;
438 aBits |= OpenGl_PO_ClipPlanes1;
440 else if (aNbPlanes == 2)
442 aBits |= OpenGl_PO_ClipPlanes2;
448 // Environment map overwrites material texture
449 aBits |= OpenGl_PO_TextureEnv;
451 else if (!theTextures.IsNull()
452 && !theTextures->IsEmpty()
453 && !theTextures->First().IsNull())
455 aBits |= theTextures->First()->IsAlpha() ? OpenGl_PO_TextureA : OpenGl_PO_TextureRGB;
459 aBits |= OpenGl_PO_VertColor;
462 if (myOitState.ToEnableWrite())
464 aBits |= OpenGl_PO_WriteOit;
469 //! Prepare standard GLSL program.
470 Handle(OpenGl_ShaderProgram)& getStdProgram (Graphic3d_TypeOfShadingModel theShadingModel,
471 Standard_Integer theBits)
473 if (theShadingModel == Graphic3d_TOSM_UNLIT
474 || (theBits & OpenGl_PO_TextureEnv) != 0)
476 // If environment map is enabled lighting calculations are
477 // not needed (in accordance with default OCCT behavior)
478 Handle(OpenGl_ShaderProgram)& aProgram = myUnlitPrograms->ChangeValue (Graphic3d_TOSM_UNLIT, theBits);
479 if (aProgram.IsNull())
481 prepareStdProgramUnlit (aProgram, theBits);
486 Handle(OpenGl_ShaderProgram)& aProgram = myLightPrograms->ChangeValue (theShadingModel, theBits);
487 if (aProgram.IsNull())
489 prepareStdProgramLight (aProgram, theShadingModel, theBits);
494 //! Prepare standard GLSL program for accessing point sprite alpha.
495 Standard_EXPORT TCollection_AsciiString pointSpriteAlphaSrc (const Standard_Integer theBits);
497 //! Prepare standard GLSL program for computing point sprite shading.
498 Standard_EXPORT TCollection_AsciiString pointSpriteShadingSrc (const TCollection_AsciiString theBaseColorSrc, const Standard_Integer theBits);
500 //! Prepare standard GLSL program for textured font.
501 Standard_EXPORT Standard_Boolean prepareStdProgramFont();
503 //! Prepare standard GLSL program for FBO blit operation.
504 Standard_EXPORT Standard_Boolean prepareStdProgramFboBlit();
506 //! Prepare standard GLSL programs for OIT compositing operation.
507 Standard_EXPORT Standard_Boolean prepareStdProgramOitCompositing (const Standard_Boolean theMsaa);
509 //! Prepare standard GLSL program without lighting.
510 Standard_EXPORT Standard_Boolean prepareStdProgramUnlit (Handle(OpenGl_ShaderProgram)& theProgram,
511 const Standard_Integer theBits);
513 //! Prepare standard GLSL program with lighting.
514 Standard_Boolean prepareStdProgramLight (Handle(OpenGl_ShaderProgram)& theProgram,
515 Graphic3d_TypeOfShadingModel theShadingModel,
516 Standard_Integer theBits)
518 switch (theShadingModel)
520 case Graphic3d_TOSM_UNLIT: return prepareStdProgramUnlit (theProgram, theBits);
521 case Graphic3d_TOSM_FACET: return prepareStdProgramPhong (theProgram, theBits, true);
522 case Graphic3d_TOSM_VERTEX: return prepareStdProgramGouraud(theProgram, theBits);
523 case Graphic3d_TOSM_DEFAULT:
524 case Graphic3d_TOSM_FRAGMENT: return prepareStdProgramPhong (theProgram, theBits, false);
529 //! Prepare standard GLSL program with per-vertex lighting.
530 Standard_EXPORT Standard_Boolean prepareStdProgramGouraud (Handle(OpenGl_ShaderProgram)& theProgram,
531 const Standard_Integer theBits);
533 //! Prepare standard GLSL program with per-pixel lighting.
534 //! @param theIsFlatNormal when TRUE, the Vertex normals will be ignored and Face normal will be computed instead
535 Standard_EXPORT Standard_Boolean prepareStdProgramPhong (Handle(OpenGl_ShaderProgram)& theProgram,
536 const Standard_Integer theBits,
537 const Standard_Boolean theIsFlatNormal = false);
539 //! Define computeLighting GLSL function depending on current lights configuration
540 //! @param theNbLights [out] number of defined light sources
541 //! @param theHasVertColor [in] flag to use getVertColor() instead of Ambient and Diffuse components of active material
542 Standard_EXPORT TCollection_AsciiString stdComputeLighting (Standard_Integer& theNbLights,
543 Standard_Boolean theHasVertColor);
545 //! Bind specified program to current context and apply state.
546 Standard_EXPORT Standard_Boolean bindProgramWithState (const Handle(OpenGl_ShaderProgram)& theProgram);
548 //! Set pointer myLightPrograms to active lighting programs set from myMapOfLightPrograms
549 Standard_EXPORT void switchLightPrograms();
551 //! Prepare standard GLSL program for stereoscopic image.
552 Standard_EXPORT Standard_Boolean prepareStdProgramStereo (Handle(OpenGl_ShaderProgram)& theProgram,
553 const Graphic3d_StereoMode theStereoMode);
555 //! Prepare standard GLSL program for bounding box.
556 Standard_EXPORT Standard_Boolean prepareStdProgramBoundBox();
560 //! Packed properties of light source
561 struct OpenGl_ShaderLightParameters
564 OpenGl_Vec4 Position;
565 OpenGl_Vec4 Direction;
566 OpenGl_Vec4 Parameters;
568 //! Returns packed (serialized) representation of light source properties
569 const OpenGl_Vec4* Packed() const { return reinterpret_cast<const OpenGl_Vec4*> (this); }
570 static Standard_Integer NbOfVec4() { return 4; }
573 //! Packed light source type information
574 struct OpenGl_ShaderLightType
576 Standard_Integer Type;
577 Standard_Integer IsHeadlight;
579 //! Returns packed (serialized) representation of light source type
580 const OpenGl_Vec2i* Packed() const { return reinterpret_cast<const OpenGl_Vec2i*> (this); }
581 static Standard_Integer NbOfVec2i() { return 1; }
584 //! Fake OpenGL program for tracking FFP state in the way consistent to programmable pipeline.
585 class OpenGl_ShaderProgramFFP : public OpenGl_ShaderProgram
587 DEFINE_STANDARD_RTTI_INLINE(OpenGl_ShaderProgramFFP, OpenGl_ShaderProgram)
588 friend class OpenGl_ShaderManager;
590 OpenGl_ShaderProgramFFP() {}
595 //! Append clipping plane definition to temporary buffers.
596 void addClippingPlane (Standard_Integer& thePlaneId,
597 const Graphic3d_ClipPlane& thePlane,
598 const Graphic3d_Vec4d& theEq,
599 const Standard_Integer theChainFwd) const
601 myClipChainArray.SetValue (thePlaneId, theChainFwd);
602 OpenGl_Vec4& aPlaneEq = myClipPlaneArray.ChangeValue (thePlaneId);
603 aPlaneEq.x() = float(theEq.x());
604 aPlaneEq.y() = float(theEq.y());
605 aPlaneEq.z() = float(theEq.z());
606 aPlaneEq.w() = float(theEq.w());
607 if (myHasLocalOrigin)
609 const gp_XYZ aPos = thePlane.ToPlane().Position().Location().XYZ() - myLocalOrigin;
610 const Standard_Real aD = -(theEq.x() * aPos.X() + theEq.y() * aPos.Y() + theEq.z() * aPos.Z());
611 aPlaneEq.w() = float(aD);
618 Handle(OpenGl_ShaderProgramFFP) myFfpProgram;
620 Graphic3d_TypeOfShadingModel myShadingModel; //!< lighting shading model
621 OpenGl_ShaderProgramList myProgramList; //!< The list of shader programs
622 Handle(OpenGl_SetOfShaderPrograms) myLightPrograms; //!< pointer to active lighting programs matrix
623 Handle(OpenGl_SetOfShaderPrograms) myUnlitPrograms; //!< programs matrix without lighting
624 Handle(OpenGl_ShaderProgram) myFontProgram; //!< standard program for textured text
625 Handle(OpenGl_ShaderProgram) myBlitProgram; //!< standard program for FBO blit emulation
626 Handle(OpenGl_ShaderProgram) myBoundBoxProgram; //!< standard program for bounding box
627 Handle(OpenGl_ShaderProgram) myOitCompositingProgram[2]; //!< standard program for OIT compositing (default and MSAA).
628 OpenGl_MapOfShaderPrograms myMapOfLightPrograms; //!< map of lighting programs depending on lights configuration
630 Handle(OpenGl_ShaderProgram) myStereoPrograms[Graphic3d_StereoMode_NB]; //!< standard stereo programs
632 Handle(OpenGl_VertexBuffer) myBoundBoxVertBuffer; //!< bounding box vertex buffer
634 OpenGl_Context* myContext; //!< OpenGL context
638 OpenGl_ProjectionState myProjectionState; //!< State of OCCT projection transformation
639 OpenGl_ModelWorldState myModelWorldState; //!< State of OCCT model-world transformation
640 OpenGl_WorldViewState myWorldViewState; //!< State of OCCT world-view transformation
641 OpenGl_ClippingState myClippingState; //!< State of OCCT clipping planes
642 OpenGl_LightSourceState myLightSourceState; //!< State of OCCT light sources
643 OpenGl_MaterialState myMaterialState; //!< State of Front and Back materials
644 OpenGl_OitState myOitState; //!< State of OIT uniforms
646 gp_XYZ myLocalOrigin; //!< local camera transformation
647 Standard_Boolean myHasLocalOrigin; //!< flag indicating that local camera transformation has been set
649 mutable NCollection_Array1<OpenGl_ShaderLightType> myLightTypeArray;
650 mutable NCollection_Array1<OpenGl_ShaderLightParameters> myLightParamsArray;
651 mutable NCollection_Array1<OpenGl_Vec4> myClipPlaneArray;
652 mutable NCollection_Array1<OpenGl_Vec4d> myClipPlaneArrayFfp;
653 mutable NCollection_Array1<Standard_Integer> myClipChainArray;
657 const OpenGl_View* myLastView; //!< Pointer to the last view shader manager used with
661 DEFINE_STANDARD_HANDLE(OpenGl_ShaderManager, Standard_Transient)
663 #endif // _OpenGl_ShaderManager_HeaderFile