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_TextureSetPairIterator_Header
0015 #define _OpenGl_TextureSetPairIterator_Header
0016
0017 #include <OpenGl_TextureSet.hxx>
0018
0019
0020
0021 class OpenGl_TextureSetPairIterator
0022 {
0023 public:
0024
0025
0026 OpenGl_TextureSetPairIterator (const Handle(OpenGl_TextureSet)& theSet1,
0027 const Handle(OpenGl_TextureSet)& theSet2)
0028 : myIter1 (theSet1),
0029 myIter2 (theSet2),
0030 myTexture1 (NULL),
0031 myTexture2 (NULL),
0032 myUnitLower (IntegerLast()),
0033 myUnitUpper (IntegerFirst()),
0034 myUnitCurrent (0)
0035 {
0036 if (!theSet1.IsNull()
0037 && !theSet1->IsEmpty())
0038 {
0039 myUnitLower = Min (myUnitLower, theSet1->FirstUnit());
0040 myUnitUpper = Max (myUnitUpper, theSet1->LastUnit());
0041 }
0042 if (!theSet2.IsNull()
0043 && !theSet2->IsEmpty())
0044 {
0045 myUnitLower = Min (myUnitLower, theSet2->FirstUnit());
0046 myUnitUpper = Max (myUnitUpper, theSet2->LastUnit());
0047 }
0048 myUnitCurrent = myUnitLower;
0049 myTexture1 = (myIter1.More() && myIter1.Unit() == myUnitCurrent)
0050 ? myIter1.ChangeValue().get()
0051 : NULL;
0052 myTexture2 = (myIter2.More() && myIter2.Unit() == myUnitCurrent)
0053 ? myIter2.ChangeValue().get()
0054 : NULL;
0055 }
0056
0057
0058 bool More() const { return myUnitCurrent <= myUnitUpper; }
0059
0060
0061 Graphic3d_TextureUnit Unit() const { return (Graphic3d_TextureUnit )myUnitCurrent; }
0062
0063
0064 const OpenGl_Texture* Texture1() const { return myTexture1; }
0065
0066
0067 const OpenGl_Texture* Texture2() const { return myTexture2; }
0068
0069
0070 void Next()
0071 {
0072 ++myUnitCurrent;
0073 myTexture1 = myTexture2 = NULL;
0074 for (; myIter1.More(); myIter1.Next())
0075 {
0076 if (myIter1.Unit() >= myUnitCurrent)
0077 {
0078 myTexture1 = myIter1.Unit() == myUnitCurrent ? myIter1.ChangeValue().get() : NULL;
0079 break;
0080 }
0081 }
0082 for (; myIter2.More(); myIter2.Next())
0083 {
0084 if (myIter2.Unit() >= myUnitCurrent)
0085 {
0086 myTexture2 = myIter2.Unit() == myUnitCurrent ? myIter2.ChangeValue().get() : NULL;
0087 break;
0088 }
0089 }
0090 }
0091
0092 private:
0093
0094 OpenGl_TextureSet::Iterator myIter1;
0095 OpenGl_TextureSet::Iterator myIter2;
0096 OpenGl_Texture* myTexture1;
0097 OpenGl_Texture* myTexture2;
0098 Standard_Integer myUnitLower;
0099 Standard_Integer myUnitUpper;
0100 Standard_Integer myUnitCurrent;
0101
0102 };
0103
0104 #endif