0024622: Add method to AIS_TexturedShape class to assign texture data directly from...
[occt.git] / src / Graphic3d / Graphic3d_TextureMap.cxx
1 // Created on: 1997-07-28
2 // Created by: Pierre CHALAMET
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #include <Graphic3d_TextureMap.ixx>
18 #include <Graphic3d_TextureParams.hxx>
19
20 // =======================================================================
21 // function : Graphic3d_TextureMap
22 // purpose  :
23 // =======================================================================
24 Graphic3d_TextureMap::Graphic3d_TextureMap (const TCollection_AsciiString& theFileName,
25                                             const Graphic3d_TypeOfTexture  theType)
26 : Graphic3d_TextureRoot (theFileName, theType)
27 {
28 }
29
30 // =======================================================================
31 // function : Graphic3d_TextureMap
32 // purpose  :
33 // =======================================================================
34 Graphic3d_TextureMap::Graphic3d_TextureMap (const Handle(Image_PixMap)&   thePixMap,
35                                             const Graphic3d_TypeOfTexture theType)
36 : Graphic3d_TextureRoot (thePixMap, theType)
37 {
38 }
39
40 // =======================================================================
41 // function : EnableSmooth
42 // purpose  :
43 // =======================================================================
44 void Graphic3d_TextureMap::EnableSmooth()
45 {
46   myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
47 }
48
49 // =======================================================================
50 // function : DisableSmooth
51 // purpose  :
52 // =======================================================================
53 void Graphic3d_TextureMap::DisableSmooth()
54 {
55   myParams->SetFilter (Graphic3d_TOTF_NEAREST);
56 }
57
58 // =======================================================================
59 // function : IsSmoothed
60 // purpose  :
61 // =======================================================================
62 Standard_Boolean Graphic3d_TextureMap::IsSmoothed() const
63 {
64   return myParams->Filter() != Graphic3d_TOTF_NEAREST;
65 }
66
67 // =======================================================================
68 // function : EnableModulate
69 // purpose  :
70 // =======================================================================
71 void Graphic3d_TextureMap::EnableModulate()
72 {
73   myParams->SetModulate (Standard_True);
74 }
75
76 // =======================================================================
77 // function : DisableModulate
78 // purpose  :
79 // =======================================================================
80 void Graphic3d_TextureMap::DisableModulate()
81 {
82   myParams->SetModulate (Standard_False);
83 }
84
85 // =======================================================================
86 // function : IsModulate
87 // purpose  :
88 // =======================================================================
89 Standard_Boolean Graphic3d_TextureMap::IsModulate() const
90 {
91   return myParams->IsModulate();
92 }
93
94 // =======================================================================
95 // function : EnableRepeat
96 // purpose  :
97 // =======================================================================
98 void Graphic3d_TextureMap::EnableRepeat()
99 {
100   myParams->SetRepeat (Standard_True);
101 }
102
103 // =======================================================================
104 // function : DisableRepeat
105 // purpose  :
106 // =======================================================================
107 void Graphic3d_TextureMap::DisableRepeat()
108 {
109   myParams->SetRepeat (Standard_False);
110 }
111
112 // =======================================================================
113 // function : IsRepeat
114 // purpose  :
115 // =======================================================================
116 Standard_Boolean Graphic3d_TextureMap::IsRepeat() const
117 {
118   return myParams->IsRepeat();
119 }
120
121 // =======================================================================
122 // function : AnisoFilter
123 // purpose  :
124 // =======================================================================
125 Graphic3d_LevelOfTextureAnisotropy Graphic3d_TextureMap::AnisoFilter() const
126 {
127   return myParams->AnisoFilter();
128 }
129
130 // =======================================================================
131 // function : SetAnisoFilter
132 // purpose  :
133 // =======================================================================
134 void Graphic3d_TextureMap::SetAnisoFilter (const Graphic3d_LevelOfTextureAnisotropy theLevel)
135 {
136   myParams->SetAnisoFilter (theLevel);
137 }