0029915: Porting to VC 2017 : Regressions in Modeling Algorithms on VC 2017
[occt.git] / src / Graphic3d / Graphic3d_TextureSet.hxx
CommitLineData
cc8cbabe 1// Copyright (c) 2017 OPEN CASCADE SAS
2//
3// This file is part of Open CASCADE Technology software library.
4//
5// This library is free software; you can redistribute it and/or modify it under
6// the terms of the GNU Lesser General Public License version 2.1 as published
7// by the Free Software Foundation, with special exception defined in the file
8// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9// distribution for complete text of the license and disclaimer of any warranty.
10//
11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
13
14#ifndef _Graphic3d_TextureSet_HeaderFile
15#define _Graphic3d_TextureSet_HeaderFile
16
17#include <Graphic3d_TextureMap.hxx>
18#include <NCollection_Array1.hxx>
19
20//! Class holding array of textures to be mapped as a set.
21class Graphic3d_TextureSet : public Standard_Transient
22{
23 DEFINE_STANDARD_RTTIEXT(Graphic3d_TextureSet, Standard_Transient)
24public:
25
26 //! Class for iterating texture set.
27 class Iterator : public NCollection_Array1<Handle(Graphic3d_TextureMap)>::Iterator
28 {
29 public:
30 //! Empty constructor.
31 Iterator() {}
32
33 //! Constructor.
34 Iterator (const Handle(Graphic3d_TextureSet)& theSet)
35 {
36 if (!theSet.IsNull())
37 {
38 NCollection_Array1<Handle(Graphic3d_TextureMap)>::Iterator::Init (theSet->myTextures);
39 }
40 }
41 };
42
43public:
44
45 //! Empty constructor.
46 Graphic3d_TextureSet() {}
47
48 //! Constructor.
49 Graphic3d_TextureSet (Standard_Integer theNbTextures)
50 : myTextures (0, theNbTextures - 1) {}
51
52 //! Constructor for a single texture.
53 Graphic3d_TextureSet (const Handle(Graphic3d_TextureMap)& theTexture)
54 : myTextures (0, 0)
55 {
56 myTextures.ChangeFirst() = theTexture;
57 }
58
59 //! Return TRUE if texture array is empty.
60 Standard_Boolean IsEmpty() const { return myTextures.IsEmpty(); }
61
62 //! Return number of textures.
63 Standard_Integer Size() const { return myTextures.Size(); }
64
65 //! Return the lower index in texture set.
66 Standard_Integer Lower() const { return myTextures.Lower(); }
67
68 //! Return the upper index in texture set.
69 Standard_Integer Upper() const { return myTextures.Upper(); }
70
71 //! Return the first texture.
72 const Handle(Graphic3d_TextureMap)& First() const { return myTextures.First(); }
73
74 //! Return the first texture.
75 void SetFirst (const Handle(Graphic3d_TextureMap)& theTexture) { myTextures.ChangeFirst() = theTexture; }
76
77 //! Return the texture at specified position within [0, Size()) range.
78 const Handle(Graphic3d_TextureMap)& Value (Standard_Integer theIndex) const { return myTextures.Value (theIndex); }
79
80 //! Return the texture at specified position within [0, Size()) range.
81 void SetValue (Standard_Integer theIndex,
82 const Handle(Graphic3d_TextureMap)& theTexture) { myTextures.SetValue (theIndex, theTexture); }
83
84protected:
85
86 NCollection_Array1<Handle(Graphic3d_TextureMap)> myTextures;
87
88};
89
90#endif // _Graphic3d_TextureSet_HeaderFile