File indexing completed on 2026-09-22 08:59:04
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _OpenGl_TextureSet_Header
0015 #define _OpenGl_TextureSet_Header
0016
0017 #include <Graphic3d_TextureSet.hxx>
0018 #include <Graphic3d_TextureSetBits.hxx>
0019
0020 class OpenGl_Texture;
0021
0022
0023
0024 class OpenGl_TextureSet : public Standard_Transient
0025 {
0026 DEFINE_STANDARD_RTTIEXT(OpenGl_TextureSet, Standard_Transient)
0027 public:
0028
0029 struct TextureSlot
0030 {
0031 occ::handle<OpenGl_Texture> Texture;
0032 Graphic3d_TextureUnit Unit;
0033
0034 operator const occ::handle<OpenGl_Texture>&() const { return Texture; }
0035
0036 operator occ::handle<OpenGl_Texture>&() { return Texture; }
0037
0038 TextureSlot()
0039 : Unit(Graphic3d_TextureUnit_0)
0040 {
0041 }
0042 };
0043
0044
0045 class Iterator : public NCollection_Array1<TextureSlot>::Iterator
0046 {
0047 public:
0048
0049 Iterator() = default;
0050
0051
0052 Iterator(const occ::handle<OpenGl_TextureSet>& theSet)
0053 {
0054 if (!theSet.IsNull())
0055 {
0056 NCollection_Array1<TextureSlot>::Iterator::Init(theSet->myTextures);
0057 }
0058 }
0059
0060
0061 const occ::handle<OpenGl_Texture>& Value() const
0062 {
0063 return NCollection_Array1<TextureSlot>::Iterator::Value().Texture;
0064 }
0065
0066 occ::handle<OpenGl_Texture>& ChangeValue()
0067 {
0068 return NCollection_Array1<TextureSlot>::Iterator::ChangeValue().Texture;
0069 }
0070
0071
0072 Graphic3d_TextureUnit Unit() const
0073 {
0074 return NCollection_Array1<TextureSlot>::Iterator::Value().Unit;
0075 }
0076
0077 Graphic3d_TextureUnit& ChangeUnit()
0078 {
0079 return NCollection_Array1<TextureSlot>::Iterator::ChangeValue().Unit;
0080 }
0081 };
0082
0083 public:
0084
0085 OpenGl_TextureSet()
0086 : myTextureSetBits(Graphic3d_TextureSetBits_NONE)
0087 {
0088 }
0089
0090
0091 OpenGl_TextureSet(int theNbTextures)
0092 : myTextures(0, theNbTextures - 1),
0093 myTextureSetBits(Graphic3d_TextureSetBits_NONE)
0094 {
0095 }
0096
0097
0098 Standard_EXPORT OpenGl_TextureSet(const occ::handle<OpenGl_Texture>& theTexture);
0099
0100
0101 int TextureSetBits() const { return myTextureSetBits; }
0102
0103
0104 int& ChangeTextureSetBits() { return myTextureSetBits; }
0105
0106
0107 bool IsEmpty() const { return myTextures.IsEmpty(); }
0108
0109
0110 int Size() const { return myTextures.Length(); }
0111
0112
0113 int Lower() const { return myTextures.Lower(); }
0114
0115
0116 int Upper() const { return myTextures.Upper(); }
0117
0118
0119 const occ::handle<OpenGl_Texture>& First() const { return myTextures.First().Texture; }
0120
0121
0122 occ::handle<OpenGl_Texture>& ChangeFirst() { return myTextures.ChangeFirst().Texture; }
0123
0124
0125 Graphic3d_TextureUnit FirstUnit() const { return myTextures.First().Unit; }
0126
0127
0128 const occ::handle<OpenGl_Texture>& Last() const { return myTextures.Last().Texture; }
0129
0130
0131 occ::handle<OpenGl_Texture>& ChangeLast() { return myTextures.ChangeLast().Texture; }
0132
0133
0134 Graphic3d_TextureUnit LastUnit() const { return myTextures.Last().Unit; }
0135
0136
0137 Graphic3d_TextureUnit& ChangeLastUnit() { return myTextures.ChangeLast().Unit; }
0138
0139
0140 const occ::handle<OpenGl_Texture>& Value(int theIndex) const
0141 {
0142 return myTextures.Value(theIndex).Texture;
0143 }
0144
0145
0146 occ::handle<OpenGl_Texture>& ChangeValue(int theIndex)
0147 {
0148 return myTextures.ChangeValue(theIndex).Texture;
0149 }
0150
0151
0152
0153 Standard_EXPORT bool IsModulate() const;
0154
0155
0156 Standard_EXPORT bool HasNonPointSprite() const;
0157
0158
0159 Standard_EXPORT bool HasPointSprite() const;
0160
0161
0162 void InitZero()
0163 {
0164 myTextures.Init(TextureSlot());
0165 myTextureSetBits = Graphic3d_TextureSetBits_NONE;
0166 }
0167
0168 protected:
0169 NCollection_Array1<TextureSlot> myTextures;
0170 int myTextureSetBits;
0171 };
0172
0173 #endif