0024428: Implementation of LGPL license
[occt.git] / src / AIS / AIS_TexturedShape.cdl
CommitLineData
b311480e 1-- Created on: 2001-07-02
2-- Created by: Mathias BOSSHARD
973c2be1 3-- Copyright (c) 2001-2014 OPEN CASCADE SAS
b311480e 4--
973c2be1 5-- This file is part of Open CASCADE Technology software library.
b311480e 6--
973c2be1 7-- This library is free software; you can redistribute it and / or modify it
8-- under the terms of the GNU Lesser General Public version 2.1 as published
9-- by the Free Software Foundation, with special exception defined in the file
10-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11-- distribution for complete text of the license and disclaimer of any warranty.
b311480e 12--
973c2be1 13-- Alternatively, this file may be used under the terms of Open CASCADE
14-- commercial license or contractual agreement.
7fd59977 15
16class TexturedShape from AIS inherits Shape from AIS
17
18 ---Purpose: This class allows to map textures on shapes
19 -- Textures are image files.
20 -- The texture itself is parametrized in (0,1)x(0,1).
21 -- Each face of a shape located in
22 -- UV space is provided with these parameters:
23 -- - Umin - starting position in U
24 -- - Umax - ending position in U
25 -- - Vmin - starting position in V
26 -- - Vmax - ending position in V
27 -- Each face is triangulated and a texel is assigned to each
28 -- node. Facets are then filled using a linear interpolation
29 -- of texture between each 'three texels'
30 -- User can act on :
31 -- - the number of occurences of the texture on the face
32 -- - the position of the origin of the texture
33 -- - the scale factor of the texture
34
35
36
37uses
38 Pnt from gp,
39 Shape from TopoDS,
40 NameOfTexture2D from Graphic3d,
41 AspectFillArea3d from Graphic3d,
42 Texture2Dmanual from Graphic3d,
43 PresentationManager3d from PrsMgr,
44 Presentation from Prs3d,
45 AsciiString from TCollection
46
47is
48
49 Create (shap: Shape from TopoDS)
50 returns mutable TexturedShape from AIS;
51 ---Purpose: Initializes the textured shape ashape.
52
53
54 ------------------------------------------------------------
2361d7e8 55 SetTextureFileName( me: mutable;
56 TextureFileName: AsciiString from TCollection)
7fd59977 57 is virtual;
2361d7e8 58 ---Purpose : Sets the name of the texture file to map. The accepted
59 -- file types are those used in Image_AlienPixMap with extensions
60 -- such as rgb, png, jpg and more.
7fd59977 61
62
63 ------------------------------------------------------------
64 SetTextureRepeat( me: mutable;
65 RepeatYN: Boolean from Standard;
66 URepeat: Real from Standard = 1.0;
67 VRepeat: Real from Standard = 1.0)
68 is virtual;
69
70
71 ---Purpose : Sets the number of occurrences of
72 -- the texture on each face. The texture itself is parameterized
73 -- in (0,1) by (0,1) . Each face of the shape to be textured is
74 -- parameterized in UV space (Umin,Umax) by (Vmin,Vmax). If
75 -- RepeatYN is set to false, texture coordinates are clamped in the
76 -- range (0,1)x(0,1) of the face.
77
78
79 ------------------------------------------------------------
80 SetTextureOrigin( me: mutable;
81 SetTextureOriginYN: Boolean from Standard;
82 UOrigin: Real from Standard = 0.0;
83 VOrigin: Real from Standard = 0.0)
84 is virtual;
85
86 ---Purpose : Use this method to change the origin of the
87 -- texture. The texel (0,0) will be mapped to the
88 -- surfel (UOrigin,VOrigin)
89 ------------------------------------------------------------
90
91
92
93 ------------------------------------------------------------
94 SetTextureScale( me: mutable;
95 SetTextureScaleYN: Boolean from Standard;
96 ScaleU: Real from Standard = 1.0;
97 ScaleV: Real from Standard = 1.0)
98 is virtual;
99
100
101 ---Purpose : Use this method to scale the texture (percent of
102 -- the face).
103 -- You can specify a scale factor for both U and V.
104 --
105 -- example : if you set ScaleU and ScaleV to 0.5 and
106 -- you enable texture repeat, the texture will appear
107 -- twice on the face in each direction.
108 ------------------------------------------------------------
109
110
111
112 ------------------------------------------------------------
113 ShowTriangles( me : mutable;
114 ShowTrianglesYN: Boolean from Standard = Standard_False)
115 is virtual;
116
117
118 ---Purpose : Use this method to show the triangulation of
119 -- the shape. This is not very esthetic but can be
120 -- usefull for debug ...
121 ------------------------------------------------------------
122
123
124
125 ------------------------------------------------------------
126 SetTextureMapOn(me: mutable);
127
128 ---Purpose : Enables texture mapping
129 ------------------------------------------------------------
130
131
132
133 ------------------------------------------------------------
134 SetTextureMapOff(me: mutable);
135
136 ---Purpose : Disables texture mapping
137 ------------------------------------------------------------
138
139
140
141 ------------------------------------------------------------
142 EnableTextureModulate(me: mutable);
143
144 ---Purpose : Enables texture modulation
145 ------------------------------------------------------------
146
147
148
149 ------------------------------------------------------------
150 DisableTextureModulate(me: mutable);
151
152 ---Purpose : Disables texture modulation
153 ------------------------------------------------------------
154
155
156
157 ------------------------------------------------------------
158 UpdateAttributes(me: mutable);
159
160 ---Purpose : Use this method to display the textured shape
161 -- without recomputing the whole presentation.
162 -- Use this method when ONLY the texture has been changed.
163 -- ie : myTShape->UpdateAttributes()
164 --
165 -- If other parameters (ie: scale factors,
166 -- texture origin, texture repeat ...) have changed,
167 -- the whole presentation has to be recomputed.
168 -- ie : if (myShape->DisplayMode() == 3)
169 -- myAISContext->RecomputePrsOnly(myShape);
170 -- else
171 -- {
172 -- myAISContext->SetDisplayMode(myShape,3,Standard_False);
173 -- myAISContext->Display(myShape, Standard_True);
174 -- }
175 ------------------------------------------------------------
176
177
178
179 ------------------------------------------------------------
180 Compute(me : mutable;
181 aPresentationManager : PresentationManager3d from PrsMgr;
182 aPresentation : mutable Presentation from Prs3d;
183 aMode : Integer from Standard = 0)
184 is redefined virtual protected;
185
186 ------------------------------------------------------------
187
7fd59977 188 ------------------------------------------------------------
189 --
190 -- QUERY METHODS
191 --
192 ------------------------------------------------------------
193
194
195 TextureMapState(me) returns Boolean from Standard;
196
197
198 URepeat(me) returns Real from Standard;
199
200
201 TextureRepeat(me) returns Boolean from Standard;
202
203
204 Deflection(me) returns Real from Standard;
205
206
207 TextureFile(me) returns CString from Standard;
208
209
210 VRepeat(me) returns Real from Standard;
211
212
213 ShowTriangles(me) returns Boolean from Standard;
214
215
216 TextureUOrigin(me) returns Real from Standard;
217
218
219 TextureVOrigin(me) returns Real from Standard;
220
221
222 TextureScaleU(me) returns Real from Standard;
223
224
225 TextureScaleV(me) returns Real from Standard;
226
227
228 TextureScale(me) returns Boolean from Standard;
229
230
231 TextureOrigin(me) returns Boolean from Standard;
232
233
234 TextureModulate(me) returns Boolean from Standard;
235
236
237fields
238 myPredefTexture : NameOfTexture2D from Graphic3d;
239 myTextureFile : AsciiString from TCollection;
240 DoRepeat : Boolean from Standard;
241 myURepeat : Real from Standard;
242 myVRepeat : Real from Standard;
243 DoMapTexture : Boolean from Standard;
244 DoSetTextureOrigin : Boolean from Standard;
245 myUOrigin : Real from Standard;
246 myVOrigin : Real from Standard;
247 DoSetTextureScale : Boolean from Standard;
248 myScaleU : Real from Standard;
249 myScaleV : Real from Standard;
250 DoShowTriangles : Boolean from Standard;
251 myDeflection : Real from Standard;
252 myAspect : AspectFillArea3d from Graphic3d;
253 mytexture : Texture2Dmanual from Graphic3d;
7fd59977 254 myModulate : Boolean from Standard;
255end TexturedShape;