File indexing completed on 2025-01-18 10:04:35
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef _OpenGl_SetOfShaderPrograms_HeaderFile
0017 #define _OpenGl_SetOfShaderPrograms_HeaderFile
0018
0019 #include <Graphic3d_ShaderFlags.hxx>
0020 #include <Graphic3d_TypeOfShadingModel.hxx>
0021 #include <NCollection_DataMap.hxx>
0022
0023 class OpenGl_ShaderProgram;
0024
0025
0026 class OpenGl_SetOfPrograms : public Standard_Transient
0027 {
0028 DEFINE_STANDARD_RTTI_INLINE(OpenGl_SetOfPrograms, Standard_Transient)
0029 public:
0030
0031
0032 OpenGl_SetOfPrograms() {}
0033
0034
0035 Handle(OpenGl_ShaderProgram)& ChangeValue (Standard_Integer theProgramBits) { return myPrograms[theProgramBits]; }
0036
0037 protected:
0038 Handle(OpenGl_ShaderProgram) myPrograms[Graphic3d_ShaderFlags_NB];
0039 };
0040
0041
0042 class OpenGl_SetOfShaderPrograms : public Standard_Transient
0043 {
0044 DEFINE_STANDARD_RTTI_INLINE(OpenGl_SetOfShaderPrograms, Standard_Transient)
0045 public:
0046
0047
0048 OpenGl_SetOfShaderPrograms() {}
0049
0050
0051 OpenGl_SetOfShaderPrograms (const Handle(OpenGl_SetOfPrograms)& thePrograms)
0052 {
0053 for (Standard_Integer aSetIter = 0; aSetIter < Graphic3d_TypeOfShadingModel_NB - 1; ++aSetIter)
0054 {
0055 myPrograms[aSetIter] = thePrograms;
0056 }
0057 }
0058
0059
0060 Handle(OpenGl_ShaderProgram)& ChangeValue (Graphic3d_TypeOfShadingModel theShadingModel,
0061 Standard_Integer theProgramBits)
0062 {
0063 Handle(OpenGl_SetOfPrograms)& aSet = myPrograms[theShadingModel - 1];
0064 if (aSet.IsNull())
0065 {
0066 aSet = new OpenGl_SetOfPrograms();
0067 }
0068 return aSet->ChangeValue (theProgramBits);
0069 }
0070
0071 protected:
0072 Handle(OpenGl_SetOfPrograms) myPrograms[Graphic3d_TypeOfShadingModel_NB - 1];
0073 };
0074
0075 typedef NCollection_DataMap<TCollection_AsciiString, Handle(OpenGl_SetOfShaderPrograms)> OpenGl_MapOfShaderPrograms;
0076
0077 #endif