1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
|
--
-- File: Graphic3d_MaterialAspect.cdl
-- Created: Mardi 27 Aout 1991
-- Author: NW,JPB,CAL
--
---Copyright: MatraDatavision 1991,1992,1993
--
-- 28-07-97 : PCT ; support for texture mapping
-- 08-04-98 : FGU ; support for emission
-- 26-03-99 : FMN ; Compatibilite ascendante: Ajout methodes SetColor() et Color()
-- 09-04-99 : GG ; Compatibilite ascendante:
-- NameOfPhysicalMaterial disparait.
-- 23-11-99 : GG : GER61351 Add Name() & Reset() methods
-- IMP150200: GG : Add IsEqual() IsDifferent() methods.
-- Add NumberOfMaterials() MaterialName() class methods
-- IMP171201: GG : Add MaterialName(), SetMaterialName()
-- instance methods and field MyRequestedMaterialName
class MaterialAspect from Graphic3d
---Version:
---Purpose: This class allows the definition of the type of a surface.
-- Keywords: Material, FillArea, Shininess, Ambient, Color, Diffuse,
-- Specular, Transparency, Emissive, ReflectionMode,
-- BackFace, FrontFace, Reflection, Absorbtion
---Warning:
---References:
uses
Color from Quantity,
NameOfMaterial from Graphic3d,
TypeOfReflection from Graphic3d,
TypeOfMaterial from Graphic3d,
AsciiString from TCollection
raises
MaterialDefinitionError from Graphic3d,
OutOfRange from Standard
is
Create
returns MaterialAspect from Graphic3d;
---Level: Public
---Purpose: Creates a material from default values.
---Material is generic
Create ( AName : NameOfMaterial from Graphic3d )
returns MaterialAspect from Graphic3d;
---Level: Public
---Purpose: Creates a generic material calls <AName>
---------------------------------------------------
-- Category: Methods to modify the class definition
---------------------------------------------------
IncreaseShine ( me : in out;
ADelta : Real from Standard )
is static;
---Level: Public
---Purpose: Increases or decreases the luminosity of <me>.
-- <ADelta> is a signed percentage.
---Category: Methods to modify the class definition
SetAmbient ( me : in out;
AValue : Real from Standard )
---Level: Public
---Purpose: Modifies the reflection properties of the surface.
-- Category: Methods to modify the class definition
-- Warning: Raises MaterialDefinitionError if <AValue> is
-- a negative value or greater than 1.0.
raises MaterialDefinitionError from Graphic3d is static;
SetDiffuse ( me : in out;
AValue : Real from Standard )
---Level: Public
---Purpose: Modifies the reflection properties of the surface.
-- Category: Methods to modify the class definition
-- Warning: Raises MaterialDefinitionError if <AValue> is a
-- negative value or greater than 1.0.
raises MaterialDefinitionError from Graphic3d is static;
SetEmissive ( me : in out;
AValue : Real from Standard )
---Level: Public
---Purpose: Modifies the reflection properties of the surface.
-- Category: Methods to modify the class definition
-- Warning: Raises MaterialDefinitionError if <AValue> is a
-- negative value or greater than 1.0.
raises MaterialDefinitionError from Graphic3d is static;
SetShininess ( me : in out;
AValue : Real from Standard )
---Level: Public
---Purpose: Modifies the luminosity of the surface.
-- Category: Methods to modify the class definition
-- Warning: Raises MaterialDefinitionError if <AValue> is a
-- negative value or greater than 1.0.
raises MaterialDefinitionError from Graphic3d is static;
SetSpecular ( me : in out;
AValue : Real from Standard )
---Level: Public
---Purpose: Modifies the reflection properties of the surface.
-- Category: Methods to modify the class definition
-- Warning: Raises MaterialDefinitionError if <AValue> is a
-- negative value or greater than 1.0.
raises MaterialDefinitionError from Graphic3d is static;
SetTransparency ( me : in out;
AValue : Real from Standard )
---Level: Public
---Purpose: Modifies the transparency coefficient of the surface.
-- <AValue> = 0. opaque. (default)
-- <AValue> = 1. transparent.
-- Transparency is applicable to materials that have at least
-- one of reflection modes (ambient, diffuse, specular or emissive)
-- enabled. See also SetReflectionModeOn() and SetReflectionModeOff() methods.
--
-- NOTE: In order for transparency specified through this method to
-- take effect, it is necessary to enable transparency
-- in the viewer. This can be done either directly -
-- see Visual3d_ViewManager::SetTransparency(Standard_Boolean),
-- or indirectly - by calling AIS_InteractiveObject::SetTransparency()
-- before an object is added to an interactive context, or by
-- calling AIS_InteractiveContext::SetTransparency() for a given
-- interactive object already displayed.
-- Category: Methods to modify the class definition
-- Warning: Raises MaterialDefinitionError if <AValue> is a
-- negative value or greater than 1.0.
raises MaterialDefinitionError from Graphic3d is static;
SetColor ( me : in out;
AColor : Color from Quantity )
is static;
---Level: Public
---Purpose: Modifies the ambient colour of the surface.
-- Category: Methods to modify the class definition
SetAmbientColor ( me : in out;
AColor : Color from Quantity )
is static;
---Level: Public
---Purpose: Modifies the ambient colour of the surface.
---Category: Methods to modify the class definition
SetDiffuseColor ( me : in out;
AColor : Color from Quantity )
is static;
---Level: Public
---Purpose: Modifies the difuse colour of the surface.
---Category: Methods to modify the class definition
SetSpecularColor ( me : in out;
AColor : Color from Quantity )
is static;
---Level: Public
---Purpose: Modifies the specular colour of the surface.
---Category: Methods to modify the class definition
SetEmissiveColor ( me : in out;
AColor : Color from Quantity )
is static;
---Level: Public
---Purpose: Modifies the emissive colour of the surface.
---Category: Methods to modify the class definition
SetReflectionModeOn ( me : in out;
AType : TypeOfReflection from Graphic3d )
is static;
---Level: Public
---Purpose: Activates the reflective properties of the surface <AType>.
--
-- TypeOfReflection : TOR_AMBIENT
-- TOR_DIFFUSE
-- TOR_SPECULAR
-- TOR_EMISSION
-- 1, 2, 3 or 4 types of reflection can be set for a given surface.
---Category: Methods to modify the class definition
SetReflectionModeOff ( me : in out;
AType : TypeOfReflection from Graphic3d )
is static;
---Level: Public
---Purpose: Deactivates the reflective properties of
-- the surface <AType>.
--
-- TypeOfReflection : TOR_AMBIENT
-- TOR_DIFFUSE
-- TOR_SPECULAR
-- TOR_EMISSION
-- 1, 2, 3 or 4 types of reflection can be set off for a given surface.
-- Disabling diffuse and specular reflectance is useful for efficient visualization
-- of large amounts of data as definition of normals for graphic primitives is not needed
-- when only "all-directional" reflectance is active.
--
-- NOTE: Disabling all four reflection modes also turns off the following effects:
-- 1. Lighting. Colors of primitives are not affected by the material properties when lighting is off.
-- 2. Transparency.
---Category: Methods to modify the class definition
SetMaterialType ( me : in out;
AType : TypeOfMaterial from Graphic3d )
is static;
---Level: Public
---Purpose: Set MyMaterialType to the value of parameter <AType>
--
-- TypeOfMaterial : MATERIAL_ASPECT
-- MATERIAL_PHYSIC
---Category: Methods to modify the class definition
SetMaterialName ( me : in out;
AName : CString from Standard )
is static;
---Level: Public
---Purpose: The current matarial become a "UserDefined" material.
-- Set the name of the "UserDefined" material.
---Category: Methods to modify the class definition
SetEnvReflexion(me : in out;
AValue : ShortReal from Standard );
Reset(me : out);
---Level: Public
---Purpose: Resets the material with the original values according to
-- the material name but leave the current color values untouched
-- for the material of type ASPECT.
---Category: Methods to modify the class definition
----------------------------
-- Category: Inquire methods
----------------------------
Color ( me )
returns Color from Quantity
is static;
---Level: Public
---Purpose: Returns the ambient colour of the surface.
---Category: Inquire methods
AmbientColor ( me )
returns Color from Quantity
is static;
---Level: Public
---Purpose: Returns the ambient colour of the surface.
---Category: Inquire methods
DiffuseColor ( me )
returns Color from Quantity
is static;
---Level: Public
---Purpose: Returns the diffuse colour of the surface.
---Category: Inquire methods
SpecularColor ( me )
returns Color from Quantity
is static;
---Level: Public
---Purpose: Returns the specular colour of the surface.
---Category: Inquire methods
EmissiveColor ( me )
returns Color from Quantity
is static;
---Level: Public
---Purpose: Returns the emissive colour of the surface.
---Category: Inquire methods
Ambient ( me )
returns Real from Standard
is static;
---Level: Public
---Purpose: Returns the reflection properties of the surface.
---Category: Inquire methods
Diffuse ( me )
returns Real from Standard
is static;
---Level: Public
---Purpose: Returns the reflection properties of the surface.
---Category: Inquire methods
Specular ( me )
returns Real from Standard
is static;
---Level: Public
---Purpose: Returns the reflection properties of the surface.
---Category: Inquire methods
Transparency ( me )
returns Real from Standard
is static;
---Level: Public
---Purpose: Returns the transparency coefficient of the surface.
---Category: Inquire methods
Emissive ( me )
returns Real from Standard
is static;
---Level: Public
---Purpose: Returns the emissive coefficient of the surface.
---Category: Inquire methods
Shininess ( me )
returns Real from Standard
is static;
---Level: Public
---Purpose: Returns the luminosity of the surface.
---Category: Inquire methods
ReflectionMode ( me;
AType : TypeOfReflection from Graphic3d )
returns Boolean from Standard
is static;
---Level: Public
---Purpose: Returns Standard_True if the reflection mode is active,
-- Standard_False otherwise.
---Category: Inquire methods
MaterialType ( me;
AType : TypeOfMaterial from Graphic3d )
returns Boolean from Standard
is static;
---Level: Public
---Purpose: Returns Standard_True if MyMaterialType equal the parameter AType,
-- Standard_False otherwise.
---Category: Inquire methods
EnvReflexion(me)
returns ShortReal from Standard;
Name(me)
returns NameOfMaterial from Graphic3d;
---Level: Public
---Purpose: Returns the material name.
---Category: Inquire methods
IsDifferent ( me;
Other : MaterialAspect from Graphic3d )
returns Boolean from Standard is static;
---Purpose: Returns Standard_True if the materials <me> and
-- <Other> are different.
---Category: Inquire methods
---C++: alias operator !=
IsEqual ( me;
Other : MaterialAspect from Graphic3d )
returns Boolean from Standard is static;
---Purpose: Returns Standard_True if the materials <me> and
-- <Other> are identical.
---Category: Inquire methods
---C++: alias operator ==
NumberOfMaterials(myclass) returns Integer from Standard;
---Purpose:
-- Returns the number of predefined textures.
---Level: Public
MaterialName(myclass; aRank: Integer from Standard)
returns CString from Standard
raises OutOfRange from Standard;
---Purpose:
-- Returns the name of the predefined material of rank <aRank>
-- Trigger: when <aRank> is < 1 or > NumberOfMaterials.
---Level: Public
MaterialName(me)
returns CString from Standard;
---Purpose:
-- Returns the name of this material
---Level: Public
MaterialType(myclass; aRank: Integer from Standard)
returns TypeOfMaterial from Graphic3d
raises OutOfRange from Standard;
---Purpose:
-- Returns the type of the predefined material of rank <aRank>
-- Trigger: when <aRank> is < 1 or > NumberOfMaterials.
---Level: Public
----------------------------
-- Category: Private methods
----------------------------
Init ( me : out; AName : NameOfMaterial from Graphic3d) is private;
--
fields
--
-- Class : Graphic3d_MaterialAspect
--
-- purpose : Declaration of variables specific to the definition
-- of materials.
--
-- Reminders : A material is defines by:
-- - A coefficient of transparency
-- - A coefficient of diffuse reflection
-- - A coefficient of ambiant reflection
-- - A coefficient of specular reflection
-- - A emissive coefficient
--
-- Two properties define a material :
-- - its transparency
-- - its reflection which is to say its properties of
-- - absorbtion and diffusion of light
--
-- The diffuse reflection is seen as a component
-- of the colour of the object.
-- The specular reflection is seen as a component
-- of the colour of the light source
--
-- To determine the three colours of reflection,
-- four things are required:
-- - A coefficient of diffuse reflection
-- - A coefficient of ambiant reflection
-- - A coefficient of specular reflection
--
-- ( Under GL, the Silicon graphics interface,
-- we need to determine 3 colours )
--
-- References : Getting started with DEC PHIGS, appendix C
-- Iris Advanced Graphics, unit D
--
--
-- the coefficient of diffuse reflection, the colour, and the activity
MyDiffuseCoef : ShortReal from Standard;
MyDiffuseColor : Color from Quantity;
MyDiffuseActivity : Boolean from Standard;
-- the coefficient of ambient reflection, the colour
-- and the activity
MyAmbientCoef : ShortReal from Standard;
MyAmbientColor : Color from Quantity;
MyAmbientActivity : Boolean from Standard;
-- the coefficient of specular reflection, the colour
-- and the activity
MySpecularCoef : ShortReal from Standard;
MySpecularColor : Color from Quantity;
MySpecularActivity : Boolean from Standard;
-- the coefficient of emissive reflection
MyEmissiveCoef : ShortReal from Standard;
MyEmissiveColor : Color from Quantity;
MyEmissiveActivity : Boolean from Standard;
-- the coefficient of transparency
MyTransparencyCoef : ShortReal from Standard;
-- the coefficient of luminosity
MyShininess : ShortReal from Standard;
-- the coeficient of reflexion for the environment texture
MyEnvReflexion : ShortReal from Standard;
-- the type of material
--MyMaterialType : Boolean from Standard;
MyMaterialType : TypeOfMaterial from Graphic3d;
-- the Name of material
MyMaterialName : NameOfMaterial from Graphic3d;
MyRequestedMaterialName : NameOfMaterial from Graphic3d;
-- the string name of the material
MyStringName : AsciiString from TCollection;
end MaterialAspect;
|