Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:49

0001 // Copyright (c) 2017 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef _Graphic3d_TextureSet_HeaderFile
0015 #define _Graphic3d_TextureSet_HeaderFile
0016 
0017 #include <Graphic3d_TextureMap.hxx>
0018 #include <NCollection_Array1.hxx>
0019 
0020 //! Class holding array of textures to be mapped as a set.
0021 //! Textures should be defined in ascending order of texture units within the set.
0022 class Graphic3d_TextureSet : public Standard_Transient
0023 {
0024   DEFINE_STANDARD_RTTIEXT(Graphic3d_TextureSet, Standard_Transient)
0025 public:
0026 
0027   //! Class for iterating texture set.
0028   class Iterator : public NCollection_Array1<Handle(Graphic3d_TextureMap)>::Iterator
0029   {
0030   public:
0031     //! Empty constructor.
0032     Iterator() {}
0033 
0034     //! Constructor.
0035     Iterator (const Handle(Graphic3d_TextureSet)& theSet)
0036     {
0037       if (!theSet.IsNull())
0038       {
0039         NCollection_Array1<Handle(Graphic3d_TextureMap)>::Iterator::Init (theSet->myTextures);
0040       }
0041     }
0042   };
0043 
0044 public:
0045 
0046   //! Empty constructor.
0047   Graphic3d_TextureSet() {}
0048 
0049   //! Constructor.
0050   Graphic3d_TextureSet (Standard_Integer theNbTextures)
0051   : myTextures (0, theNbTextures - 1) {}
0052 
0053   //! Constructor for a single texture.
0054   Graphic3d_TextureSet (const Handle(Graphic3d_TextureMap)& theTexture)
0055   : myTextures (0, 0)
0056   {
0057     myTextures.ChangeFirst() = theTexture;
0058   }
0059 
0060   //! Return TRUE if texture array is empty.
0061   Standard_Boolean IsEmpty() const { return myTextures.IsEmpty(); }
0062 
0063   //! Return number of textures.
0064   Standard_Integer Size() const { return myTextures.Size(); }
0065 
0066   //! Return the lower index in texture set.
0067   Standard_Integer Lower() const { return myTextures.Lower(); }
0068 
0069   //! Return the upper index in texture set.
0070   Standard_Integer Upper() const { return myTextures.Upper(); }
0071 
0072   //! Return the first texture.
0073   const Handle(Graphic3d_TextureMap)& First() const { return myTextures.First(); }
0074 
0075   //! Return the first texture.
0076   void SetFirst (const Handle(Graphic3d_TextureMap)& theTexture) { myTextures.ChangeFirst() = theTexture; }
0077 
0078   //! Return the texture at specified position within [0, Size()) range.
0079   const Handle(Graphic3d_TextureMap)& Value (Standard_Integer theIndex) const { return myTextures.Value (theIndex); }
0080 
0081   //! Return the texture at specified position within [0, Size()) range.
0082   void SetValue (Standard_Integer theIndex,
0083                  const Handle(Graphic3d_TextureMap)& theTexture) { myTextures.SetValue (theIndex, theTexture); }
0084 
0085 protected:
0086 
0087   NCollection_Array1<Handle(Graphic3d_TextureMap)> myTextures;
0088 
0089 };
0090 
0091 #endif // _Graphic3d_TextureSet_HeaderFile