0030483: Visualization, Path Tracing - make Tile Size configurable
[occt.git] / src / OpenGl / OpenGl_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 _OpenGl_TextureSet_Header
15#define _OpenGl_TextureSet_Header
16
17#include <Graphic3d_TextureSet.hxx>
18
19class OpenGl_Texture;
20
21//! Class holding array of textures to be mapped as a set.
22class OpenGl_TextureSet : public Standard_Transient
23{
24 DEFINE_STANDARD_RTTIEXT(OpenGl_TextureSet, Standard_Transient)
25public:
26
27 //! Class for iterating texture set.
28 class Iterator : public NCollection_Array1<Handle(OpenGl_Texture)>::Iterator
29 {
30 public:
31 //! Empty constructor.
32 Iterator() {}
33
34 //! Constructor.
35 Iterator (const Handle(OpenGl_TextureSet)& theSet)
36 {
37 if (!theSet.IsNull())
38 {
39 NCollection_Array1<Handle(OpenGl_Texture)>::Iterator::Init (theSet->myTextures);
40 }
41 }
42 };
43
44public:
45
46 //! Empty constructor.
47 OpenGl_TextureSet() {}
48
49 //! Constructor.
50 OpenGl_TextureSet (Standard_Integer theNbTextures)
51 : myTextures (0, theNbTextures - 1) {}
52
53 //! Constructor for a single texture.
54 OpenGl_TextureSet (const Handle(OpenGl_Texture)& theTexture)
55 : myTextures (0, 0)
56 {
57 myTextures.ChangeFirst() = theTexture;
58 }
59
60 //! Return TRUE if texture array is empty.
61 Standard_Boolean IsEmpty() const { return myTextures.IsEmpty(); }
62
63 //! Return number of textures.
64 Standard_Integer Size() const { return myTextures.Size(); }
65
66 //! Return the lower index in texture set.
67 Standard_Integer Lower() const { return myTextures.Lower(); }
68
69 //! Return the upper index in texture set.
70 Standard_Integer Upper() const { return myTextures.Upper(); }
71
72 //! Return the first texture.
73 const Handle(OpenGl_Texture)& First() const { return myTextures.First(); }
74
75 //! Return the first texture.
76 Handle(OpenGl_Texture)& ChangeFirst() { return myTextures.ChangeFirst(); }
77
78 //! Return the texture at specified position within [0, Size()) range.
79 const Handle(OpenGl_Texture)& Value (Standard_Integer theIndex) const { return myTextures.Value (theIndex); }
80
81 //! Return the texture at specified position within [0, Size()) range.
82 Handle(OpenGl_Texture)& ChangeValue (Standard_Integer theIndex) { return myTextures.ChangeValue (theIndex); }
83
dc89236f 84 //! Return TRUE if texture color modulation has been enabled for the first texture
85 //! or if texture is not set at all.
86 Standard_EXPORT bool IsModulate() const;
87
cc8cbabe 88protected:
89
90 NCollection_Array1<Handle(OpenGl_Texture)> myTextures;
91
92};
93
94#endif //_OpenGl_TextureSet_Header