1 // Copyright (c) 2013-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
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.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #include <Graphic3d_TextureParams.hxx>
16 IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_TextureParams,Standard_Transient)
18 // =======================================================================
19 // function : Graphic3d_TextureParams
21 // =======================================================================
22 Graphic3d_TextureParams::Graphic3d_TextureParams()
23 : myGenPlaneS (0.0f, 0.0f, 0.0f, 0.0f),
24 myGenPlaneT (0.0f, 0.0f, 0.0f, 0.0f),
26 myTranslation(0.0f, 0.0f),
27 mySamplerRevision (0),
28 myTextureUnit(Graphic3d_TextureUnit_BaseColor),
29 myFilter (Graphic3d_TOTF_NEAREST),
30 myAnisoLevel (Graphic3d_LOTA_OFF),
31 myGenMode (Graphic3d_TOTM_MANUAL),
35 myToModulate (Standard_False),
36 myToRepeat (Standard_False)
41 // =======================================================================
42 // function : ~Graphic3d_TextureParams
44 // =======================================================================
45 Graphic3d_TextureParams::~Graphic3d_TextureParams()
50 // =======================================================================
51 // function : SetModulate
53 // =======================================================================
54 void Graphic3d_TextureParams::SetModulate (const Standard_Boolean theToModulate)
56 myToModulate = theToModulate;
59 // =======================================================================
60 // function : SetRepeat
62 // =======================================================================
63 void Graphic3d_TextureParams::SetRepeat (const Standard_Boolean theToRepeat)
65 if (myToRepeat != theToRepeat)
67 myToRepeat = theToRepeat;
68 updateSamplerRevision();
72 // =======================================================================
73 // function : SetFilter
75 // =======================================================================
76 void Graphic3d_TextureParams::SetFilter (const Graphic3d_TypeOfTextureFilter theFilter)
78 if (myFilter != theFilter)
81 updateSamplerRevision();
85 // =======================================================================
86 // function : SetAnisoFilter
88 // =======================================================================
89 void Graphic3d_TextureParams::SetAnisoFilter (const Graphic3d_LevelOfTextureAnisotropy theLevel)
91 if (myAnisoLevel != theLevel)
93 myAnisoLevel = theLevel;
94 updateSamplerRevision();
98 // =======================================================================
99 // function : SetRotation
101 // =======================================================================
102 void Graphic3d_TextureParams::SetRotation (const Standard_ShortReal theAngleDegrees)
104 myRotAngle = theAngleDegrees;
107 // =======================================================================
108 // function : SetScale
110 // =======================================================================
111 void Graphic3d_TextureParams::SetScale (const Graphic3d_Vec2 theScale)
116 // =======================================================================
117 // function : SetTranslation
119 // =======================================================================
120 void Graphic3d_TextureParams::SetTranslation (const Graphic3d_Vec2 theVec)
122 myTranslation = theVec;
125 // =======================================================================
126 // function : SetGenMode
128 // =======================================================================
129 void Graphic3d_TextureParams::SetGenMode (const Graphic3d_TypeOfTextureMode theMode,
130 const Graphic3d_Vec4 thePlaneS,
131 const Graphic3d_Vec4 thePlaneT)
134 myGenPlaneS = thePlaneS;
135 myGenPlaneT = thePlaneT;