File indexing completed on 2025-01-18 10:04:36
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
0030 struct TextureSlot
0031 {
0032 Handle(OpenGl_Texture) Texture;
0033 Graphic3d_TextureUnit Unit;
0034
0035 operator const Handle(OpenGl_Texture)& () const { return Texture; }
0036 operator Handle(OpenGl_Texture)& () { return Texture; }
0037
0038 TextureSlot() : Unit (Graphic3d_TextureUnit_0) {}
0039 };
0040
0041
0042 class Iterator : public NCollection_Array1<TextureSlot>::Iterator
0043 {
0044 public:
0045
0046 Iterator() {}
0047
0048
0049 Iterator (const Handle(OpenGl_TextureSet)& theSet)
0050 {
0051 if (!theSet.IsNull())
0052 {
0053 NCollection_Array1<TextureSlot>::Iterator::Init (theSet->myTextures);
0054 }
0055 }
0056
0057
0058 const Handle(OpenGl_Texture)& Value() const { return NCollection_Array1<TextureSlot>::Iterator::Value().Texture; }
0059 Handle(OpenGl_Texture)& ChangeValue() { return NCollection_Array1<TextureSlot>::Iterator::ChangeValue().Texture; }
0060
0061
0062 Graphic3d_TextureUnit Unit() const { return NCollection_Array1<TextureSlot>::Iterator::Value().Unit; }
0063 Graphic3d_TextureUnit& ChangeUnit() { return NCollection_Array1<TextureSlot>::Iterator::ChangeValue().Unit; }
0064 };
0065
0066 public:
0067
0068
0069 OpenGl_TextureSet() : myTextureSetBits (Graphic3d_TextureSetBits_NONE) {}
0070
0071
0072 OpenGl_TextureSet (Standard_Integer theNbTextures)
0073 : myTextures (0, theNbTextures - 1),
0074 myTextureSetBits (Graphic3d_TextureSetBits_NONE) {}
0075
0076
0077 Standard_EXPORT OpenGl_TextureSet (const Handle(OpenGl_Texture)& theTexture);
0078
0079
0080 Standard_Integer TextureSetBits() const { return myTextureSetBits; }
0081
0082
0083 Standard_Integer& ChangeTextureSetBits() { return myTextureSetBits; }
0084
0085
0086 Standard_Boolean IsEmpty() const { return myTextures.IsEmpty(); }
0087
0088
0089 Standard_Integer Size() const { return myTextures.Size(); }
0090
0091
0092 Standard_Integer Lower() const { return myTextures.Lower(); }
0093
0094
0095 Standard_Integer Upper() const { return myTextures.Upper(); }
0096
0097
0098 const Handle(OpenGl_Texture)& First() const { return myTextures.First().Texture; }
0099
0100
0101 Handle(OpenGl_Texture)& ChangeFirst() { return myTextures.ChangeFirst().Texture; }
0102
0103
0104 Graphic3d_TextureUnit FirstUnit() const { return myTextures.First().Unit; }
0105
0106
0107 const Handle(OpenGl_Texture)& Last() const { return myTextures.Last().Texture; }
0108
0109
0110 Handle(OpenGl_Texture)& ChangeLast() { return myTextures.ChangeLast().Texture; }
0111
0112
0113 Graphic3d_TextureUnit LastUnit() const { return myTextures.Last().Unit; }
0114
0115
0116 Graphic3d_TextureUnit& ChangeLastUnit() { return myTextures.ChangeLast().Unit; }
0117
0118
0119 const Handle(OpenGl_Texture)& Value (Standard_Integer theIndex) const { return myTextures.Value (theIndex).Texture; }
0120
0121
0122 Handle(OpenGl_Texture)& ChangeValue (Standard_Integer theIndex) { return myTextures.ChangeValue (theIndex).Texture; }
0123
0124
0125
0126 Standard_EXPORT bool IsModulate() const;
0127
0128
0129 Standard_EXPORT bool HasNonPointSprite() const;
0130
0131
0132 Standard_EXPORT bool HasPointSprite() const;
0133
0134
0135 void InitZero()
0136 {
0137 myTextures.Init (TextureSlot());
0138 myTextureSetBits = Graphic3d_TextureSetBits_NONE;
0139 }
0140
0141 protected:
0142
0143 NCollection_Array1<TextureSlot> myTextures;
0144 Standard_Integer myTextureSetBits;
0145
0146 };
0147
0148 #endif