0023098: Cppcheck warnings/errors in QA files
[occt.git] / src / Graphic3d / Graphic3d_Group_8.cxx
CommitLineData
b311480e 1// Created by: NW,JPB,CAL
2// Copyright (c) 1991-1999 Matra Datavision
3// Copyright (c) 1999-2012 OPEN CASCADE SAS
4//
5// The content of this file is subject to the Open CASCADE Technology Public
6// License Version 6.5 (the "License"). You may not use the content of this file
7// except in compliance with the License. Please obtain a copy of the License
8// at http://www.opencascade.org and read it completely before using this file.
9//
10// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12//
13// The Original Code and all software distributed under the License is
14// distributed on an "AS IS" basis, without warranty of any kind, and the
15// Initial Developer hereby disclaims all such warranties, including without
16// limitation, any warranties of merchantability, fitness for a particular
17// purpose or non-infringement. Please see the License for the specific terms
18// and conditions governing the rights and limitations under the License.
19
7fd59977 20
7fd59977 21// modified: 1/07/97 ; PCT : ajout texture mapping
22// 20/07/97 ; PCT : ajout transparence texture
23// 08/04/98 ; FGU : Ajout emission surface
24// 30/11/98 ; FMN : S4069. Textes always visible.
25// 22/03/04 ; SAN : OCC4895 High-level interface for controlling polygon offsets */
26
7fd59977 27
28//-Version
29
30//-Design Declaration des variables specifiques aux groupes
31// de primitives
32
33//-Warning Un groupe est defini dans une structure
34// Il s'agit de la plus petite entite editable
35
36//-References
37
38//-Language C++ 2.0
39
40//-Declarations
41
42#define OCC1174 //SAV 08/01/03 : Added back face interior color controling
43
44
45// for the class
46#include <Graphic3d_Group.jxx>
47#include <Graphic3d_Group.pxx>
48#include <Graphic3d_TextureMap.hxx>
49
50//-Methods, in order
51
52void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& CTX) {
53
54 if (IsDeleted ()) return;
55
56 Standard_Real R, G, B;
57 Standard_Real AWidth;
58 Quantity_Color AColor;
59 Aspect_TypeOfLine ALType;
60
61 CTX->Values (AColor, ALType, AWidth);
62 AColor.Values (R, G, B, Quantity_TOC_RGB);
63
64 MyCGroup.ContextLine.Color.r = float (R);
65 MyCGroup.ContextLine.Color.g = float (G);
66 MyCGroup.ContextLine.Color.b = float (B);
67 MyCGroup.ContextLine.LineType = int (ALType);
68 MyCGroup.ContextLine.Width = float (AWidth);
69 MyCGroup.ContextLine.IsDef = 1;
70
71 int noinsert = 1;
72 MyGraphicDriver->LineContextGroup (MyCGroup, noinsert);
73
74 MyCGroup.ContextLine.IsSet = 1;
75
76 Update ();
77
78}
79
80void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& CTX) {
81
82 if (IsDeleted ()) return;
83
84 Standard_Real R, G, B;
85 Standard_Real AWidth;
86 //Quantity_Color AColor;
87 Quantity_Color AIntColor;
88 Quantity_Color BackIntColor;
89 Quantity_Color AEdgeColor;
90 Aspect_TypeOfLine ALType;
91 Aspect_InteriorStyle AStyle;
92
93 CTX->Values (AStyle, AIntColor, BackIntColor, AEdgeColor, ALType, AWidth);
94 AIntColor.Values (R, G, B, Quantity_TOC_RGB);
95
96 MyCGroup.ContextFillArea.Style = int (AStyle);
97 MyCGroup.ContextFillArea.IntColor.r = float (R);
98 MyCGroup.ContextFillArea.IntColor.g = float (G);
99 MyCGroup.ContextFillArea.IntColor.b = float (B);
100
101#ifdef OCC1174
102 if ( CTX->Distinguish() )
103 BackIntColor.Values( R, G, B, Quantity_TOC_RGB );
104#endif
105 MyCGroup.ContextFillArea.BackIntColor.r = float( R );
106 MyCGroup.ContextFillArea.BackIntColor.g = float( G );
107 MyCGroup.ContextFillArea.BackIntColor.b = float( B );
108
109 MyCGroup.ContextFillArea.Edge = (CTX->Edge () ? 1 : 0);
110 AEdgeColor.Values (R, G, B, Quantity_TOC_RGB);
111 MyCGroup.ContextFillArea.EdgeColor.r = float (R);
112 MyCGroup.ContextFillArea.EdgeColor.g = float (G);
113 MyCGroup.ContextFillArea.EdgeColor.b = float (B);
114 MyCGroup.ContextFillArea.LineType = int (ALType);
115 MyCGroup.ContextFillArea.Width = float (AWidth);
116 MyCGroup.ContextFillArea.Hatch = int (CTX->HatchStyle ());
117
118 /*** Front and Back face ***/
119 MyCGroup.ContextFillArea.Distinguish =
120 ( CTX->Distinguish () ? 1 : 0 );
121 MyCGroup.ContextFillArea.BackFace =
122 ( CTX->BackFace () ? 1 : 0 );
123
124 /*** Back Material ***/
125 // Light specificity
126 MyCGroup.ContextFillArea.Back.Shininess =
127 float ((CTX->BackMaterial ()).Shininess ());
128 MyCGroup.ContextFillArea.Back.Ambient =
129 float ((CTX->BackMaterial ()).Ambient ());
130 MyCGroup.ContextFillArea.Back.Diffuse =
131 float ((CTX->BackMaterial ()).Diffuse ());
132 MyCGroup.ContextFillArea.Back.Specular =
133 float ((CTX->BackMaterial ()).Specular ());
134 MyCGroup.ContextFillArea.Back.Transparency =
135 float ((CTX->BackMaterial ()).Transparency ());
136 MyCGroup.ContextFillArea.Back.Emission =
137 float ((CTX->BackMaterial ()).Emissive ());
138
139 // Reflection mode
140 MyCGroup.ContextFillArea.Back.IsAmbient =
141 ( (CTX->BackMaterial ()).ReflectionMode
142 (Graphic3d_TOR_AMBIENT) ? 1 : 0 );
143 MyCGroup.ContextFillArea.Back.IsDiffuse =
144 ( (CTX->BackMaterial ()).ReflectionMode
145 (Graphic3d_TOR_DIFFUSE) ? 1 : 0 );
146 MyCGroup.ContextFillArea.Back.IsSpecular =
147 ( (CTX->BackMaterial ()).ReflectionMode
148 (Graphic3d_TOR_SPECULAR) ? 1 : 0 );
149 MyCGroup.ContextFillArea.Back.IsEmission =
150 ( (CTX->BackMaterial ()).ReflectionMode
151 (Graphic3d_TOR_EMISSION) ? 1 : 0 );
152
153 // Material type
154 //JR/Hp
155 const Graphic3d_MaterialAspect ama = CTX->BackMaterial () ;
156 Standard_Boolean amt = ama.MaterialType(Graphic3d_MATERIAL_PHYSIC) ;
157 MyCGroup.ContextFillArea.Back.IsPhysic = ( amt ? 1 : 0 );
158
159 // Specular color
160 MyCGroup.ContextFillArea.Back.ColorSpec.r =
161 float (((CTX->BackMaterial ()).SpecularColor ()).Red ());
162 MyCGroup.ContextFillArea.Back.ColorSpec.g =
163 float (((CTX->BackMaterial ()).SpecularColor ()).Green ());
164 MyCGroup.ContextFillArea.Back.ColorSpec.b =
165 float (((CTX->BackMaterial ()).SpecularColor ()).Blue ());
166
167
168 // Ambient color
169 MyCGroup.ContextFillArea.Back.ColorAmb.r =
170 float (((CTX->BackMaterial ()).AmbientColor ()).Red ());
171 MyCGroup.ContextFillArea.Back.ColorAmb.g =
172 float (((CTX->BackMaterial ()).AmbientColor ()).Green ());
173 MyCGroup.ContextFillArea.Back.ColorAmb.b =
174 float (((CTX->BackMaterial ()).AmbientColor ()).Blue ());
175
176 // Diffuse color
177 MyCGroup.ContextFillArea.Back.ColorDif.r =
178 float (((CTX->BackMaterial ()).DiffuseColor ()).Red ());
179 MyCGroup.ContextFillArea.Back.ColorDif.g =
180 float (((CTX->BackMaterial ()).DiffuseColor ()).Green ());
181 MyCGroup.ContextFillArea.Back.ColorDif.b =
182 float (((CTX->BackMaterial ()).DiffuseColor ()).Blue ());
183
184 // Emissive color
185 MyCGroup.ContextFillArea.Back.ColorEms.r =
186 float (((CTX->BackMaterial ()).EmissiveColor ()).Red ());
187 MyCGroup.ContextFillArea.Back.ColorEms.g =
188 float (((CTX->BackMaterial ()).EmissiveColor ()).Green ());
189 MyCGroup.ContextFillArea.Back.ColorEms.b =
190 float (((CTX->BackMaterial ()).EmissiveColor ()).Blue ());
191
192 MyCGroup.ContextFillArea.Back.EnvReflexion =
193 float ((CTX->BackMaterial ()).EnvReflexion());
194
195 /*** Front Material ***/
196 // Light specificity
197 MyCGroup.ContextFillArea.Front.Shininess =
198 float ((CTX->FrontMaterial ()).Shininess ());
199 MyCGroup.ContextFillArea.Front.Ambient =
200 float ((CTX->FrontMaterial ()).Ambient ());
201 MyCGroup.ContextFillArea.Front.Diffuse =
202 float ((CTX->FrontMaterial ()).Diffuse ());
203 MyCGroup.ContextFillArea.Front.Specular =
204 float ((CTX->FrontMaterial ()).Specular ());
205 MyCGroup.ContextFillArea.Front.Transparency =
206 float ((CTX->FrontMaterial ()).Transparency ());
207 MyCGroup.ContextFillArea.Front.Emission =
208 float ((CTX->FrontMaterial ()).Emissive ());
209
210 // Reflection mode
211 MyCGroup.ContextFillArea.Front.IsAmbient =
212 ( (CTX->FrontMaterial ()).ReflectionMode
213 (Graphic3d_TOR_AMBIENT) ? 1 : 0 );
214 MyCGroup.ContextFillArea.Front.IsDiffuse =
215 ( (CTX->FrontMaterial ()).ReflectionMode
216 (Graphic3d_TOR_DIFFUSE) ? 1 : 0 );
217 MyCGroup.ContextFillArea.Front.IsSpecular =
218 ( (CTX->FrontMaterial ()).ReflectionMode
219 (Graphic3d_TOR_SPECULAR) ? 1 : 0 );
220 MyCGroup.ContextFillArea.Front.IsEmission =
221 ( (CTX->FrontMaterial ()).ReflectionMode
222 (Graphic3d_TOR_EMISSION) ? 1 : 0 );
223
224 // Material type
225 //JR/Hp
226 const Graphic3d_MaterialAspect amas = CTX->FrontMaterial () ;
227 Standard_Boolean amty = amas.MaterialType(Graphic3d_MATERIAL_PHYSIC) ;
228 MyCGroup.ContextFillArea.Front.IsPhysic = ( amty ? 1 : 0 );
229
230 // Specular color
231 MyCGroup.ContextFillArea.Front.ColorSpec.r =
232 float (((CTX->FrontMaterial ()).SpecularColor ()).Red ());
233 MyCGroup.ContextFillArea.Front.ColorSpec.g =
234 float (((CTX->FrontMaterial ()).SpecularColor ()).Green ());
235 MyCGroup.ContextFillArea.Front.ColorSpec.b =
236 float (((CTX->FrontMaterial ()).SpecularColor ()).Blue ());
237
238 // Ambient color
239 MyCGroup.ContextFillArea.Front.ColorAmb.r =
240 float (((CTX->FrontMaterial ()).AmbientColor ()).Red ());
241 MyCGroup.ContextFillArea.Front.ColorAmb.g =
242 float (((CTX->FrontMaterial ()).AmbientColor ()).Green ());
243 MyCGroup.ContextFillArea.Front.ColorAmb.b =
244 float (((CTX->FrontMaterial ()).AmbientColor ()).Blue ());
245
246 // Diffuse color
247 MyCGroup.ContextFillArea.Front.ColorDif.r =
248 float (((CTX->FrontMaterial ()).DiffuseColor ()).Red ());
249 MyCGroup.ContextFillArea.Front.ColorDif.g =
250 float (((CTX->FrontMaterial ()).DiffuseColor ()).Green ());
251 MyCGroup.ContextFillArea.Front.ColorDif.b =
252 float (((CTX->FrontMaterial ()).DiffuseColor ()).Blue ());
253
254 // Emissive color
255 MyCGroup.ContextFillArea.Front.ColorEms.r =
256 float (((CTX->FrontMaterial ()).EmissiveColor ()).Red ());
257 MyCGroup.ContextFillArea.Front.ColorEms.g =
258 float (((CTX->FrontMaterial ()).EmissiveColor ()).Green ());
259 MyCGroup.ContextFillArea.Front.ColorEms.b =
260 float (((CTX->FrontMaterial ()).EmissiveColor ()).Blue ());
261
262 MyCGroup.ContextFillArea.Front.EnvReflexion =
263 float ((CTX->FrontMaterial ()).EnvReflexion());
264
265 MyCGroup.ContextFillArea.IsDef = 1; // Definition material ok
266
267 /*** Texture map ***/
268 Handle(Graphic3d_TextureMap) GroupTextureMap = CTX->TextureMap();
60761105 269 if (! GroupTextureMap.IsNull() ) {
7fd59977 270 MyCGroup.ContextFillArea.Texture.TexId = GroupTextureMap->TextureId();
60761105 271 MyCGroup.ContextFillArea.Texture.doTextureMap =
272 CTX->TextureMapState () ? 1 : 0;
273 }
274 else {
7fd59977 275 MyCGroup.ContextFillArea.Texture.TexId = -1;
60761105 276 MyCGroup.ContextFillArea.Texture.doTextureMap = 0;
277 }
7fd59977 278
279 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
280 Standard_Integer aPolyMode;
60be1f9b 281 Standard_ShortReal aPolyFactor, aPolyUnits;
7fd59977 282 CTX->PolygonOffsets(aPolyMode, aPolyFactor, aPolyUnits);
283 MyCGroup.ContextFillArea.PolygonOffsetMode = aPolyMode;
284 MyCGroup.ContextFillArea.PolygonOffsetFactor = aPolyFactor;
285 MyCGroup.ContextFillArea.PolygonOffsetUnits = aPolyUnits;
286 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
287
288 int noinsert = 1;
289 MyGraphicDriver->FaceContextGroup (MyCGroup, noinsert);
290
291 MyCGroup.ContextFillArea.IsSet = 1;
292
293 Update ();
294
295}
296
297void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& CTX) {
298
299 if (IsDeleted ()) return;
300
301 Standard_Real R, G, B;
302 Standard_Real AScale;
303 Quantity_Color AColor;
304 Aspect_TypeOfMarker AMType;
305
306 CTX->Values (AColor, AMType, AScale);
307 AColor.Values (R, G, B, Quantity_TOC_RGB);
308
309 MyCGroup.ContextMarker.Color.r = float (R);
310 MyCGroup.ContextMarker.Color.g = float (G);
311 MyCGroup.ContextMarker.Color.b = float (B);
312 MyCGroup.ContextMarker.MarkerType = int (AMType);
313 MyCGroup.ContextMarker.Scale = float (AScale);
314 MyCGroup.ContextMarker.IsDef = 1;
315
316 int noinsert = 1;
317 if ( AMType == Aspect_TOM_USERDEFINED )
318 {
319 CTX->GetTextureSize( MyMarkWidth, MyMarkHeight );
320 MyMarkArray = CTX->GetTexture();
321 MyGraphicDriver->MarkerContextGroup (MyCGroup, noinsert, MyMarkWidth, MyMarkHeight, MyMarkArray);
322 }
323 else
324 MyGraphicDriver->MarkerContextGroup (MyCGroup, noinsert);
325
326 MyCGroup.ContextMarker.IsSet = 1;
327
328 Update ();
329
330}
331
332void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& CTX) {
333
334 if (IsDeleted ()) return;
335
336 Standard_CString AFont;
337 Standard_Real R, G, B;
338 Standard_Real Rs, Gs, Bs;
339 Standard_Real ASpace;
340 Standard_Real AnExpansion;
341 Quantity_Color AColor;
342 Aspect_TypeOfStyleText AStyle;
343 Aspect_TypeOfDisplayText ADisplayType;
344 Quantity_Color AColorSubTitle;
345 Standard_Boolean ATextZoomable;
346 Standard_Real ATextAngle;
347 OSD_FontAspect ATextFontAspect;
348
349 CTX->Values (AColor, AFont, AnExpansion, ASpace, AStyle, ADisplayType,AColorSubTitle,ATextZoomable,ATextAngle,ATextFontAspect);
350 AColor.Values (R, G, B, Quantity_TOC_RGB);
351 AColorSubTitle.Values (Rs, Gs, Bs, Quantity_TOC_RGB);
352
353 MyCGroup.ContextText.Color.r = float (R);
354 MyCGroup.ContextText.Color.g = float (G);
355 MyCGroup.ContextText.Color.b = float (B);
356 MyCGroup.ContextText.Font = (char*)AFont;
357 MyCGroup.ContextText.Expan = float (AnExpansion);
358 MyCGroup.ContextText.Space = float (ASpace);
359 MyCGroup.ContextText.Style = int (AStyle);
360 MyCGroup.ContextText.DisplayType= int (ADisplayType);
361 MyCGroup.ContextText.ColorSubTitle.r = float (Rs);
362 MyCGroup.ContextText.ColorSubTitle.g = float (Gs);
363 MyCGroup.ContextText.ColorSubTitle.b = float (Bs);
364 MyCGroup.ContextText.TextZoomable = ATextZoomable;
60be1f9b 365 MyCGroup.ContextText.TextAngle = float (ATextAngle);
7fd59977 366 MyCGroup.ContextText.TextFontAspect = (int)ATextFontAspect;
367
368 MyCGroup.ContextText.IsDef = 1;
369
370 int noinsert = 1;
371 MyGraphicDriver->TextContextGroup (MyCGroup, noinsert);
372
373 MyCGroup.ContextText.IsSet = 1;
374
375 Update ();
376
377}
378
379void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& CTX) {
380
381 if (IsDeleted ()) return;
382
383 Standard_Real R, G, B;
384 Standard_Real AWidth;
385 Quantity_Color AColor;
386 Aspect_TypeOfLine ALType;
387
388 CTX->Values (AColor, ALType, AWidth);
389 AColor.Values (R, G, B, Quantity_TOC_RGB);
390
391 MyCGroup.ContextLine.Color.r = float (R);
392 MyCGroup.ContextLine.Color.g = float (G);
393 MyCGroup.ContextLine.Color.b = float (B);
394 MyCGroup.ContextLine.LineType = int (ALType);
395 MyCGroup.ContextLine.Width = float (AWidth);
396 MyCGroup.ContextLine.IsDef = 1;
397
398 int noinsert = 0;
399 MyGraphicDriver->LineContextGroup (MyCGroup, noinsert);
400
401 MyCGroup.ContextLine.IsSet = 1;
402
403 Update ();
404
405}
406
407void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& CTX) {
408
409 if (IsDeleted ()) return;
410
411 Standard_Real R, G, B;
412 Standard_Real AWidth;
413 Quantity_Color AIntColor;
414 Quantity_Color BackIntColor;
415 Quantity_Color AEdgeColor;
416 Aspect_TypeOfLine ALType;
417 Aspect_InteriorStyle AStyle;
418
419 CTX->Values (AStyle, AIntColor, BackIntColor, AEdgeColor, ALType, AWidth);
420 AIntColor.Values (R, G, B, Quantity_TOC_RGB);
421
422 MyCGroup.ContextFillArea.Style = int (AStyle);
423 MyCGroup.ContextFillArea.IntColor.r = float (R);
424 MyCGroup.ContextFillArea.IntColor.g = float (G);
425 MyCGroup.ContextFillArea.IntColor.b = float (B);
426#ifdef OCC1174
427 if ( CTX->Distinguish() )
428 BackIntColor.Values( R, G, B, Quantity_TOC_RGB );
429#endif
430 MyCGroup.ContextFillArea.BackIntColor.r = float( R );
431 MyCGroup.ContextFillArea.BackIntColor.g = float( G );
432 MyCGroup.ContextFillArea.BackIntColor.b = float( B );
433
434 MyCGroup.ContextFillArea.Edge = (CTX->Edge () ? 1 : 0);
435 AEdgeColor.Values (R, G, B, Quantity_TOC_RGB);
436 MyCGroup.ContextFillArea.EdgeColor.r = float (R);
437 MyCGroup.ContextFillArea.EdgeColor.g = float (G);
438 MyCGroup.ContextFillArea.EdgeColor.b = float (B);
439 MyCGroup.ContextFillArea.LineType = int (ALType);
440 MyCGroup.ContextFillArea.Width = float (AWidth);
441 MyCGroup.ContextFillArea.Hatch = int (CTX->HatchStyle ());
442 // Front and Back face
443 MyCGroup.ContextFillArea.Distinguish =
444 ( CTX->Distinguish () ? 1 : 0 );
445 MyCGroup.ContextFillArea.BackFace =
446 ( CTX->BackFace () ? 1 : 0 );
447
448 /*** Back Material ***/
449 // Material state
450 MyCGroup.ContextFillArea.Back.Shininess =
451 float ((CTX->BackMaterial ()).Shininess ());
452 MyCGroup.ContextFillArea.Back.Ambient =
453 float ((CTX->BackMaterial ()).Ambient ());
454 MyCGroup.ContextFillArea.Back.Diffuse =
455 float ((CTX->BackMaterial ()).Diffuse ());
456 MyCGroup.ContextFillArea.Back.Specular =
457 float ((CTX->BackMaterial ()).Specular ());
458 MyCGroup.ContextFillArea.Back.Transparency =
459 float ((CTX->BackMaterial ()).Transparency ());
460 MyCGroup.ContextFillArea.Back.Emission =
461 float ((CTX->BackMaterial ()).Emissive ());
462
463 // Reflection mode
464 MyCGroup.ContextFillArea.Back.IsAmbient =
465 ( (CTX->BackMaterial ()).ReflectionMode
466 (Graphic3d_TOR_AMBIENT) ? 1 : 0 );
467 MyCGroup.ContextFillArea.Back.IsDiffuse =
468 ( (CTX->BackMaterial ()).ReflectionMode
469 (Graphic3d_TOR_DIFFUSE) ? 1 : 0 );
470 MyCGroup.ContextFillArea.Back.IsSpecular =
471 ( (CTX->BackMaterial ()).ReflectionMode
472 (Graphic3d_TOR_SPECULAR) ? 1 : 0 );
473 MyCGroup.ContextFillArea.Back.IsEmission =
474 ( (CTX->BackMaterial ()).ReflectionMode
475 (Graphic3d_TOR_EMISSION) ? 1 : 0 );
476
477 // Material type
478 //JR/Hp
479 const Graphic3d_MaterialAspect ama = CTX->BackMaterial () ;
480 Standard_Boolean amt = ama.MaterialType(Graphic3d_MATERIAL_PHYSIC) ;
481 MyCGroup.ContextFillArea.Back.IsPhysic = ( amt ? 1 : 0 );
482
483 // Specular color
484 MyCGroup.ContextFillArea.Back.ColorSpec.r =
485 float (((CTX->BackMaterial ()).SpecularColor ()).Red ());
486 MyCGroup.ContextFillArea.Back.ColorSpec.g =
487 float (((CTX->BackMaterial ()).SpecularColor ()).Green ());
488 MyCGroup.ContextFillArea.Back.ColorSpec.b =
489 float (((CTX->BackMaterial ()).SpecularColor ()).Blue ());
490
491 // Ambient color
492 MyCGroup.ContextFillArea.Back.ColorAmb.r =
493 float (((CTX->BackMaterial ()).AmbientColor ()).Red ());
494 MyCGroup.ContextFillArea.Back.ColorAmb.g =
495 float (((CTX->BackMaterial ()).AmbientColor ()).Green ());
496 MyCGroup.ContextFillArea.Back.ColorAmb.b =
497 float (((CTX->BackMaterial ()).AmbientColor ()).Blue ());
498
499 // Diffuse color
500 MyCGroup.ContextFillArea.Back.ColorDif.r =
501 float (((CTX->BackMaterial ()).DiffuseColor ()).Red ());
502 MyCGroup.ContextFillArea.Back.ColorDif.g =
503 float (((CTX->BackMaterial ()).DiffuseColor ()).Green ());
504 MyCGroup.ContextFillArea.Back.ColorDif.b =
505 float (((CTX->BackMaterial ()).DiffuseColor ()).Blue ());
506
507 // Emissive color
508 MyCGroup.ContextFillArea.Back.ColorEms.r =
509 float (((CTX->BackMaterial ()).EmissiveColor ()).Red ());
510 MyCGroup.ContextFillArea.Back.ColorEms.g =
511 float (((CTX->BackMaterial ()).EmissiveColor ()).Green ());
512 MyCGroup.ContextFillArea.Back.ColorEms.b =
513 float (((CTX->BackMaterial ()).EmissiveColor ()).Blue ());
514
515 MyCGroup.ContextFillArea.Back.EnvReflexion =
516 float ((CTX->BackMaterial ()).EnvReflexion());
517
518 /*** Front Material ***/
519 // Ligth specificity
520 MyCGroup.ContextFillArea.Front.Shininess =
521 float ((CTX->FrontMaterial ()).Shininess ());
522 MyCGroup.ContextFillArea.Front.Ambient =
523 float ((CTX->FrontMaterial ()).Ambient ());
524 MyCGroup.ContextFillArea.Front.Diffuse =
525 float ((CTX->FrontMaterial ()).Diffuse ());
526 MyCGroup.ContextFillArea.Front.Specular =
527 float ((CTX->FrontMaterial ()).Specular ());
528 MyCGroup.ContextFillArea.Front.Transparency =
529 float ((CTX->FrontMaterial ()).Transparency ());
530 MyCGroup.ContextFillArea.Front.Emission =
531 float ((CTX->FrontMaterial ()).Emissive ());
532
533 // Reflection mode
534 MyCGroup.ContextFillArea.Front.IsAmbient =
535 ( (CTX->FrontMaterial ()).ReflectionMode
536 (Graphic3d_TOR_AMBIENT) ? 1 : 0 );
537 MyCGroup.ContextFillArea.Front.IsDiffuse =
538 ( (CTX->FrontMaterial ()).ReflectionMode
539 (Graphic3d_TOR_DIFFUSE) ? 1 : 0 );
540 MyCGroup.ContextFillArea.Front.IsSpecular =
541 ( (CTX->FrontMaterial ()).ReflectionMode
542 (Graphic3d_TOR_SPECULAR) ? 1 : 0 );
543 MyCGroup.ContextFillArea.Front.IsEmission =
544 ( (CTX->FrontMaterial ()).ReflectionMode
545 (Graphic3d_TOR_EMISSION) ? 1 : 0 );
546
547 //Material type
548 //JR/Hp
549 const Graphic3d_MaterialAspect amas = CTX->FrontMaterial () ;
550 Standard_Boolean amty = amas.MaterialType(Graphic3d_MATERIAL_PHYSIC) ;
551 MyCGroup.ContextFillArea.Front.IsPhysic = ( amty ? 1 : 0 );
552
553 // Specular color
554 MyCGroup.ContextFillArea.Front.ColorSpec.r =
555 float (((CTX->FrontMaterial ()).SpecularColor ()).Red ());
556 MyCGroup.ContextFillArea.Front.ColorSpec.g =
557 float (((CTX->FrontMaterial ()).SpecularColor ()).Green ());
558 MyCGroup.ContextFillArea.Front.ColorSpec.b =
559 float (((CTX->FrontMaterial ()).SpecularColor ()).Blue ());
560
561 // Ambient color
562 MyCGroup.ContextFillArea.Front.ColorAmb.r =
563 float (((CTX->FrontMaterial ()).AmbientColor ()).Red ());
564 MyCGroup.ContextFillArea.Front.ColorAmb.g =
565 float (((CTX->FrontMaterial ()).AmbientColor ()).Green ());
566 MyCGroup.ContextFillArea.Front.ColorAmb.b =
567 float (((CTX->FrontMaterial ()).AmbientColor ()).Blue ());
568
569 // Diffuse color
570 MyCGroup.ContextFillArea.Front.ColorDif.r =
571 float (((CTX->FrontMaterial ()).DiffuseColor ()).Red ());
572 MyCGroup.ContextFillArea.Front.ColorDif.g =
573 float (((CTX->FrontMaterial ()).DiffuseColor ()).Green ());
574 MyCGroup.ContextFillArea.Front.ColorDif.b =
575 float (((CTX->FrontMaterial ()).DiffuseColor ()).Blue ());
576
577 // Emissive color
578 MyCGroup.ContextFillArea.Front.ColorEms.r =
579 float (((CTX->FrontMaterial ()).EmissiveColor ()).Red ());
580 MyCGroup.ContextFillArea.Front.ColorEms.g =
581 float (((CTX->FrontMaterial ()).EmissiveColor ()).Green ());
582 MyCGroup.ContextFillArea.Front.ColorEms.b =
583 float (((CTX->FrontMaterial ()).EmissiveColor ()).Blue ());
584
585 MyCGroup.ContextFillArea.Front.EnvReflexion =
586 float ((CTX->FrontMaterial ()).EnvReflexion());
587
588 MyCGroup.ContextFillArea.IsDef = 1; // Material definition ok
589
590 Handle(Graphic3d_TextureMap) GroupTextureMap = CTX->TextureMap();
591 if (! GroupTextureMap.IsNull() )
592 MyCGroup.ContextFillArea.Texture.TexId = GroupTextureMap->TextureId();
593 else
594 MyCGroup.ContextFillArea.Texture.TexId = -1;
595
596 MyCGroup.ContextFillArea.Texture.doTextureMap =
597 CTX->TextureMapState () ? 1 : 0;
598
599 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
600 Standard_Integer aPolyMode;
60be1f9b 601 Standard_ShortReal aPolyFactor, aPolyUnits;
7fd59977 602 CTX->PolygonOffsets(aPolyMode, aPolyFactor, aPolyUnits);
603 MyCGroup.ContextFillArea.PolygonOffsetMode = aPolyMode;
604 MyCGroup.ContextFillArea.PolygonOffsetFactor = aPolyFactor;
605 MyCGroup.ContextFillArea.PolygonOffsetUnits = aPolyUnits;
606 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
607
608 int noinsert = 0;
609 MyGraphicDriver->FaceContextGroup (MyCGroup, noinsert);
610
611 MyCGroup.ContextFillArea.IsSet = 1;
612
613 Update ();
614
615}
616
617void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& CTX) {
618
619 if (IsDeleted ()) return;
620
621 Standard_Real R, G, B;
622 Standard_Real AScale;
623 Quantity_Color AColor;
624 Aspect_TypeOfMarker AMType;
625
626 CTX->Values (AColor, AMType, AScale);
627 AColor.Values (R, G, B, Quantity_TOC_RGB);
628
629 MyCGroup.ContextMarker.Color.r = float (R);
630 MyCGroup.ContextMarker.Color.g = float (G);
631 MyCGroup.ContextMarker.Color.b = float (B);
632 MyCGroup.ContextMarker.MarkerType = int (AMType);
633 MyCGroup.ContextMarker.Scale = float (AScale);
634 MyCGroup.ContextMarker.IsDef = 1;
635
636 int noinsert = 0;
637 if ( AMType == Aspect_TOM_USERDEFINED )
638 {
639 CTX->GetTextureSize( MyMarkWidth, MyMarkHeight );
640 MyMarkArray = CTX->GetTexture();
641 MyGraphicDriver->MarkerContextGroup (MyCGroup, noinsert, MyMarkWidth, MyMarkHeight, MyMarkArray);
642 }
643 else
644 MyGraphicDriver->MarkerContextGroup (MyCGroup, noinsert);
645
646 MyCGroup.ContextMarker.IsSet = 1;
647
648 Update ();
649
650}
651
652void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& CTX) {
653
654 if (IsDeleted ()) return;
655
656 Standard_CString AFont;
657 Standard_Real R, G, B;
658 Standard_Real Rs, Gs, Bs;
659 Standard_Real ASpace;
660 Standard_Real AnExpansion;
661 Quantity_Color AColor;
662 Aspect_TypeOfStyleText AStyle;
663 Aspect_TypeOfDisplayText ADisplayType;
664 Quantity_Color AColorSubTitle;
665 Standard_Boolean ATextZoomable;
666 Standard_Real ATextAngle;
667 OSD_FontAspect ATextFontAspect;
668
669 CTX->Values (AColor, AFont, AnExpansion, ASpace, AStyle, ADisplayType,AColorSubTitle,ATextZoomable,ATextAngle,ATextFontAspect);
670 AColor.Values (R, G, B, Quantity_TOC_RGB);
671 AColorSubTitle.Values (Rs, Gs, Bs, Quantity_TOC_RGB);
672
673 MyCGroup.ContextText.Color.r = float (R);
674 MyCGroup.ContextText.Color.g = float (G);
675 MyCGroup.ContextText.Color.b = float (B);
676 MyCGroup.ContextText.Font = (char*)AFont;
677 MyCGroup.ContextText.Expan = float (AnExpansion);
678 MyCGroup.ContextText.Space = float (ASpace);
679 MyCGroup.ContextText.Style = int (AStyle);
680 MyCGroup.ContextText.DisplayType= int (ADisplayType);
681 MyCGroup.ContextText.ColorSubTitle.r = float (Rs);
682 MyCGroup.ContextText.ColorSubTitle.g = float (Gs);
683 MyCGroup.ContextText.ColorSubTitle.b = float (Bs);
684 MyCGroup.ContextText.TextZoomable = ATextZoomable;
60be1f9b 685 MyCGroup.ContextText.TextAngle = float (ATextAngle);
7fd59977 686 MyCGroup.ContextText.TextFontAspect = (int)ATextFontAspect;
687 MyCGroup.ContextText.IsDef = 1;
688
689 int noinsert = 0;
690 MyGraphicDriver->TextContextGroup (MyCGroup, noinsert);
691
692 MyCGroup.ContextText.IsSet = 1;
693
694 Update ();
695
696}
697
698Standard_Boolean Graphic3d_Group::IsGroupPrimitivesAspectSet (const Graphic3d_GroupAspect theAspect) const {
699 switch (theAspect) {
700 case Graphic3d_ASPECT_LINE: return MyCGroup.ContextLine.IsSet;
701 case Graphic3d_ASPECT_TEXT: return MyCGroup.ContextText.IsSet;
702 case Graphic3d_ASPECT_MARKER: return MyCGroup.ContextMarker.IsSet;
703 case Graphic3d_ASPECT_FILL_AREA: return MyCGroup.ContextFillArea.IsSet;
704 default: return Standard_False;
705 }
706}
707
708
709void Graphic3d_Group::GroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& CTXL, const Handle(Graphic3d_AspectText3d)& CTXT, const Handle(Graphic3d_AspectMarker3d)& CTXM, const Handle(Graphic3d_AspectFillArea3d)& CTXF) const {
710
711 Standard_Real R, G, B;
712 Standard_Real Rs, Gs, Bs;
713 Quantity_Color AColor;
714
715 Standard_Real AWidth;
716 Aspect_TypeOfLine ALType;
717
718 Standard_CString AFont;
719 Standard_Real ASpace;
720 Standard_Real AnExpansion;
721
722 Standard_Real AScale;
723 Aspect_TypeOfMarker AMType;
724
725 Quantity_Color AnIntColor;
726 Quantity_Color AnEdgeColor;
727 Aspect_InteriorStyle AStyle;
728 Standard_Boolean EdgeOn = Standard_False;
729 Graphic3d_MaterialAspect Front;
730 Graphic3d_MaterialAspect Back;
731 Aspect_TypeOfStyleText AStyleT;
732 Aspect_TypeOfDisplayText ADisplayType;
733 Quantity_Color AColorSubTitle;
734
735 if (MyCGroup.ContextLine.IsSet) {
736 R = Standard_Real (MyCGroup.ContextLine.Color.r);
737 G = Standard_Real (MyCGroup.ContextLine.Color.g);
738 B = Standard_Real (MyCGroup.ContextLine.Color.b);
739 ALType = Aspect_TypeOfLine (MyCGroup.ContextLine.LineType);
740 AWidth = Standard_Real (MyCGroup.ContextLine.Width);
741 }
742 else {
743 R = Standard_Real (MyCGroup.Struct->ContextLine.Color.r);
744 G = Standard_Real (MyCGroup.Struct->ContextLine.Color.g);
745 B = Standard_Real (MyCGroup.Struct->ContextLine.Color.b);
746 ALType = Aspect_TypeOfLine (MyCGroup.Struct->ContextLine.LineType);
747 AWidth = Standard_Real (MyCGroup.Struct->ContextLine.Width);
748 }
749 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
750 CTXL->SetColor (AColor);
751 CTXL->SetType (ALType);
752 CTXL->SetWidth (AWidth);
753
754 if (MyCGroup.ContextText.IsSet) {
755 R = Standard_Real (MyCGroup.ContextText.Color.r);
756 G = Standard_Real (MyCGroup.ContextText.Color.g);
757 B = Standard_Real (MyCGroup.ContextText.Color.b);
758 Rs = Standard_Real (MyCGroup.ContextText.ColorSubTitle.r);
759 Gs = Standard_Real (MyCGroup.ContextText.ColorSubTitle.g);
760 Bs = Standard_Real (MyCGroup.ContextText.ColorSubTitle.b);
761 AFont = Standard_CString (MyCGroup.ContextText.Font);
762 AnExpansion = Standard_Real (MyCGroup.ContextText.Expan);
763 ASpace = Standard_Real (MyCGroup.ContextText.Space);
764 AStyleT = Aspect_TypeOfStyleText (MyCGroup.ContextText.Style);
765 ADisplayType= Aspect_TypeOfDisplayText (MyCGroup.ContextText.DisplayType);
766 }
767 else {
768 R = Standard_Real (MyCGroup.Struct->ContextText.Color.r);
769 G = Standard_Real (MyCGroup.Struct->ContextText.Color.g);
770 B = Standard_Real (MyCGroup.Struct->ContextText.Color.b);
771 Rs = Standard_Real (MyCGroup.Struct->ContextText.ColorSubTitle.r);
772 Gs = Standard_Real (MyCGroup.Struct->ContextText.ColorSubTitle.g);
773 Bs = Standard_Real (MyCGroup.Struct->ContextText.ColorSubTitle.b);
774 AFont = Standard_CString (MyCGroup.Struct->ContextText.Font);
775 AnExpansion = Standard_Real (MyCGroup.Struct->ContextText.Expan);
776 ASpace = Standard_Real (MyCGroup.Struct->ContextText.Space);
777 AStyleT = Aspect_TypeOfStyleText (MyCGroup.Struct->ContextText.Style);
778 ADisplayType= Aspect_TypeOfDisplayText (MyCGroup.Struct->ContextText.DisplayType);
779 }
780 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
781 AColorSubTitle.SetValues (Rs, Gs, Bs, Quantity_TOC_RGB);
782 CTXT->SetColor (AColor);
783 CTXT->SetFont (AFont);
784 CTXT->SetExpansionFactor (AnExpansion);
785 CTXT->SetSpace (ASpace);
786 CTXT->SetStyle (AStyleT);
787 CTXT->SetDisplayType (ADisplayType);
788 CTXT->SetColorSubTitle (AColorSubTitle);
789
790 if (MyCGroup.ContextMarker.IsSet) {
791 R = Standard_Real (MyCGroup.ContextMarker.Color.r);
792 G = Standard_Real (MyCGroup.ContextMarker.Color.g);
793 B = Standard_Real (MyCGroup.ContextMarker.Color.b);
794 AMType = Aspect_TypeOfMarker (MyCGroup.ContextMarker.MarkerType);
795 AScale = Standard_Real (MyCGroup.ContextMarker.Scale);
796 if( AMType == Aspect_TOM_USERDEFINED )
797 {
798
799 CTXM->SetTexture( MyMarkWidth, MyMarkHeight, MyMarkArray );
800 }
801 }
802 else {
803 R = Standard_Real (MyCGroup.Struct->ContextMarker.Color.r);
804 G = Standard_Real (MyCGroup.Struct->ContextMarker.Color.g);
805 B = Standard_Real (MyCGroup.Struct->ContextMarker.Color.b);
806 AMType = Aspect_TypeOfMarker (MyCGroup.Struct->ContextMarker.MarkerType);
807 AScale = Standard_Real (MyCGroup.Struct->ContextMarker.Scale);
808 }
809 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
810 CTXM->SetColor (AColor);
811 CTXM->SetType (AMType);
812 CTXM->SetScale (AScale);
813
814 if (MyCGroup.ContextFillArea.IsSet) {
815 // Interior
816 AStyle = Aspect_InteriorStyle (MyCGroup.ContextFillArea.Style);
817 R = Standard_Real (MyCGroup.ContextFillArea.IntColor.r);
818 G = Standard_Real (MyCGroup.ContextFillArea.IntColor.g);
819 B = Standard_Real (MyCGroup.ContextFillArea.IntColor.b);
820 AnIntColor.SetValues (R, G, B, Quantity_TOC_RGB);
821 // Edges
822 if (MyCGroup.ContextFillArea.Edge == 1) EdgeOn = Standard_True;
823 R = Standard_Real (MyCGroup.ContextFillArea.EdgeColor.r);
824 G = Standard_Real (MyCGroup.ContextFillArea.EdgeColor.g);
825 B = Standard_Real (MyCGroup.ContextFillArea.EdgeColor.b);
826 AnEdgeColor.SetValues (R, G, B, Quantity_TOC_RGB);
827 ALType = Aspect_TypeOfLine (MyCGroup.ContextFillArea.LineType);
828 AWidth = Standard_Real (MyCGroup.ContextFillArea.Width);
829 // Back Material
830 Back.SetShininess (
831 Standard_Real (MyCGroup.ContextFillArea.Back.Shininess));
832 Back.SetAmbient (
833 Standard_Real (MyCGroup.ContextFillArea.Back.Ambient));
834 Back.SetDiffuse (
835 Standard_Real (MyCGroup.ContextFillArea.Back.Diffuse));
836 Back.SetSpecular (
837 Standard_Real (MyCGroup.ContextFillArea.Back.Specular));
838 Back.SetTransparency (
839 Standard_Real (MyCGroup.ContextFillArea.Back.Transparency));
840 Back.SetEmissive (
841 Standard_Real (MyCGroup.ContextFillArea.Back.Emission));
842 if (MyCGroup.ContextFillArea.Back.IsAmbient == 1)
843 Back.SetReflectionModeOn (Graphic3d_TOR_AMBIENT);
844 else
845 Back.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
846 if (MyCGroup.ContextFillArea.Back.IsDiffuse == 1)
847 Back.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE);
848 else
849 Back.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
850 if (MyCGroup.ContextFillArea.Back.IsSpecular == 1)
851 Back.SetReflectionModeOn (Graphic3d_TOR_SPECULAR);
852 else
853 Back.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
854
855 R = Standard_Real (MyCGroup.ContextFillArea.Back.ColorSpec.r);
856 G = Standard_Real (MyCGroup.ContextFillArea.Back.ColorSpec.g);
857 B = Standard_Real (MyCGroup.ContextFillArea.Back.ColorSpec.b);
858 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
859 Back.SetSpecularColor (AColor);
860
861 R = Standard_Real (MyCGroup.ContextFillArea.Back.ColorAmb.r);
862 G = Standard_Real (MyCGroup.ContextFillArea.Back.ColorAmb.g);
863 B = Standard_Real (MyCGroup.ContextFillArea.Back.ColorAmb.b);
864 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
865 Back.SetAmbientColor (AColor);
866
867 R = Standard_Real (MyCGroup.ContextFillArea.Back.ColorDif.r);
868 G = Standard_Real (MyCGroup.ContextFillArea.Back.ColorDif.g);
869 B = Standard_Real (MyCGroup.ContextFillArea.Back.ColorDif.b);
870 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
871 Back.SetDiffuseColor (AColor);
872
873 R = Standard_Real (MyCGroup.ContextFillArea.Back.ColorEms.r);
874 G = Standard_Real (MyCGroup.ContextFillArea.Back.ColorEms.g);
875 B = Standard_Real (MyCGroup.ContextFillArea.Back.ColorEms.b);
876 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
877 Back.SetEmissiveColor (AColor);
878
879 Back.SetEnvReflexion (MyCGroup.ContextFillArea.Back.EnvReflexion);
880 // Front Material
881 Front.SetShininess (
882 Standard_Real (MyCGroup.ContextFillArea.Front.Shininess));
883 Front.SetAmbient (
884 Standard_Real (MyCGroup.ContextFillArea.Front.Ambient));
885 Front.SetDiffuse (
886 Standard_Real (MyCGroup.ContextFillArea.Front.Diffuse));
887 Front.SetSpecular (
888 Standard_Real (MyCGroup.ContextFillArea.Front.Specular));
889 Front.SetTransparency (
890 Standard_Real (MyCGroup.ContextFillArea.Front.Transparency));
891 Front.SetEmissive (
892 Standard_Real (MyCGroup.ContextFillArea.Back.Emission));
893 if (MyCGroup.ContextFillArea.Front.IsAmbient == 1)
894 Front.SetReflectionModeOn (Graphic3d_TOR_AMBIENT);
895 else
896 Front.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
897 if (MyCGroup.ContextFillArea.Front.IsDiffuse == 1)
898 Front.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE);
899 else
900 Front.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
901 if (MyCGroup.ContextFillArea.Front.IsSpecular == 1)
902 Front.SetReflectionModeOn (Graphic3d_TOR_SPECULAR);
903 else
904 Front.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
905
906 R = Standard_Real (MyCGroup.ContextFillArea.Front.ColorSpec.r);
907 G = Standard_Real (MyCGroup.ContextFillArea.Front.ColorSpec.g);
908 B = Standard_Real (MyCGroup.ContextFillArea.Front.ColorSpec.b);
909 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
910 Front.SetSpecularColor (AColor);
911
912 R = Standard_Real (MyCGroup.ContextFillArea.Front.ColorAmb.r);
913 G = Standard_Real (MyCGroup.ContextFillArea.Front.ColorAmb.g);
914 B = Standard_Real (MyCGroup.ContextFillArea.Front.ColorAmb.b);
915 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
916 Front.SetAmbientColor (AColor);
917
918 R = Standard_Real (MyCGroup.ContextFillArea.Front.ColorDif.r);
919 G = Standard_Real (MyCGroup.ContextFillArea.Front.ColorDif.g);
920 B = Standard_Real (MyCGroup.ContextFillArea.Front.ColorDif.b);
921 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
922 Front.SetDiffuseColor (AColor);
923
924 R = Standard_Real (MyCGroup.ContextFillArea.Front.ColorEms.r);
925 G = Standard_Real (MyCGroup.ContextFillArea.Front.ColorEms.g);
926 B = Standard_Real (MyCGroup.ContextFillArea.Front.ColorEms.b);
927 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
928 Front.SetEmissiveColor (AColor);
929
930 Front.SetEnvReflexion (MyCGroup.ContextFillArea.Front.EnvReflexion);
931
932 // Edges
933 if (EdgeOn)
934 CTXF->SetEdgeOn ();
935 else
936 CTXF->SetEdgeOff ();
937 // Hatch
938 CTXF->SetHatchStyle(Aspect_HatchStyle (MyCGroup.ContextFillArea.Hatch));
939 // Materials
940 // Front and Back face
941 if (MyCGroup.ContextFillArea.Distinguish == 1)
942 CTXF->SetDistinguishOn ();
943 else
944 CTXF->SetDistinguishOff ();
945 if (MyCGroup.ContextFillArea.BackFace == 1)
946 CTXF->SuppressBackFace ();
947 else
948 CTXF->AllowBackFace ();
949 // Texture
950 // Pb sur les textures
951 //if (MyCGroup.ContextFillArea.Texture.TexId == -1)
952 //else
953 if (MyCGroup.ContextFillArea.Texture.doTextureMap == 1)
954 CTXF->SetTextureMapOn ();
955 else
956 CTXF->SetTextureMapOff ();
957
958 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
959 CTXF->SetPolygonOffsets(MyCGroup.ContextFillArea.PolygonOffsetMode,
960 MyCGroup.ContextFillArea.PolygonOffsetFactor,
961 MyCGroup.ContextFillArea.PolygonOffsetUnits);
962 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
963 }
964 else {
965 // Interior
966 AStyle = Aspect_InteriorStyle (MyCGroup.Struct->ContextFillArea.Style);
967 R = Standard_Real (MyCGroup.Struct->ContextFillArea.IntColor.r);
968 G = Standard_Real (MyCGroup.Struct->ContextFillArea.IntColor.g);
969 B = Standard_Real (MyCGroup.Struct->ContextFillArea.IntColor.b);
970 AnIntColor.SetValues (R, G, B, Quantity_TOC_RGB);
971 // Edges
972 if (MyCGroup.Struct->ContextFillArea.Edge == 1) EdgeOn = Standard_True;
973 R = Standard_Real (MyCGroup.Struct->ContextFillArea.EdgeColor.r);
974 G = Standard_Real (MyCGroup.Struct->ContextFillArea.EdgeColor.g);
975 B = Standard_Real (MyCGroup.Struct->ContextFillArea.EdgeColor.b);
976 AnEdgeColor.SetValues (R, G, B, Quantity_TOC_RGB);
977 ALType = Aspect_TypeOfLine (MyCGroup.Struct->ContextFillArea.LineType);
978 AWidth = Standard_Real (MyCGroup.Struct->ContextFillArea.Width);
979 // Back Material
980 Back.SetShininess (
981 Standard_Real (MyCGroup.Struct->ContextFillArea.Back.Shininess));
982 Back.SetAmbient (
983 Standard_Real (MyCGroup.Struct->ContextFillArea.Back.Ambient));
984 Back.SetDiffuse (
985 Standard_Real (MyCGroup.Struct->ContextFillArea.Back.Diffuse));
986 Back.SetSpecular (
987 Standard_Real (MyCGroup.Struct->ContextFillArea.Back.Specular));
988 Back.SetTransparency (
989 Standard_Real (MyCGroup.Struct->ContextFillArea.Back.Transparency));
990 Back.SetEmissive (
991 Standard_Real (MyCGroup.Struct->ContextFillArea.Back.Emission));
992 if (MyCGroup.Struct->ContextFillArea.Back.IsAmbient == 1)
993 Back.SetReflectionModeOn (Graphic3d_TOR_AMBIENT);
994 else
995 Back.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
996 if (MyCGroup.Struct->ContextFillArea.Back.IsDiffuse == 1)
997 Back.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE);
998 else
999 Back.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
1000 if (MyCGroup.Struct->ContextFillArea.Back.IsSpecular == 1)
1001 Back.SetReflectionModeOn (Graphic3d_TOR_SPECULAR);
1002 else
1003 Back.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
1004
1005 R = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorSpec.r);
1006 G = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorSpec.g);
1007 B = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorSpec.b);
1008 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
1009 Back.SetSpecularColor (AColor);
1010
1011 R = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorAmb.r);
1012 G = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorAmb.g);
1013 B = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorAmb.b);
1014 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
1015 Back.SetAmbientColor (AColor);
1016
1017 R = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorDif.r);
1018 G = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorDif.g);
1019 B = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorDif.b);
1020 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
1021 Back.SetDiffuseColor (AColor);
1022
1023 R = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorEms.r);
1024 G = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorEms.g);
1025 B = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorEms.b);
1026 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
1027 Back.SetEmissiveColor (AColor);
1028
1029 Back.SetEnvReflexion (MyCGroup.Struct->ContextFillArea.Back.EnvReflexion);
1030 // Front Material
1031 Front.SetShininess (
1032 Standard_Real (MyCGroup.Struct->ContextFillArea.Front.Shininess));
1033 Front.SetAmbient (
1034 Standard_Real (MyCGroup.Struct->ContextFillArea.Front.Ambient));
1035 Front.SetDiffuse (
1036 Standard_Real (MyCGroup.Struct->ContextFillArea.Front.Diffuse));
1037 Front.SetSpecular (
1038 Standard_Real (MyCGroup.Struct->ContextFillArea.Front.Specular));
1039 Front.SetTransparency (
1040 Standard_Real (MyCGroup.Struct->ContextFillArea.Front.Transparency));
1041 Front.SetEmissive (
1042 Standard_Real (MyCGroup.Struct->ContextFillArea.Front.Emission));
1043 if (MyCGroup.Struct->ContextFillArea.Front.IsAmbient == 1)
1044 Front.SetReflectionModeOn (Graphic3d_TOR_AMBIENT);
1045 else
1046 Front.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
1047 if (MyCGroup.Struct->ContextFillArea.Front.IsDiffuse == 1)
1048 Front.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE);
1049 else
1050 Front.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
1051 if (MyCGroup.Struct->ContextFillArea.Front.IsSpecular == 1)
1052 Front.SetReflectionModeOn (Graphic3d_TOR_SPECULAR);
1053 else
1054 Front.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
1055
1056 R = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorSpec.r);
1057 G = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorSpec.g);
1058 B = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorSpec.b);
1059 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
1060 Front.SetSpecularColor (AColor);
1061
1062 R = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorAmb.r);
1063 G = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorAmb.g);
1064 B = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorAmb.b);
1065 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
1066 Front.SetAmbientColor (AColor);
1067
1068 R = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorDif.r);
1069 G = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorDif.g);
1070 B = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorDif.b);
1071 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
1072 Front.SetDiffuseColor (AColor);
1073
1074 R = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorEms.r);
1075 G = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorEms.g);
1076 B = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorEms.b);
1077 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
1078 Front.SetEmissiveColor (AColor);
1079
1080 Front.SetEnvReflexion (MyCGroup.Struct->ContextFillArea.Front.EnvReflexion);
1081
1082 // Edges
1083 if (EdgeOn)
1084 CTXF->SetEdgeOn ();
1085 else
1086 CTXF->SetEdgeOff ();
1087 // Hatch
1088 CTXF->SetHatchStyle(Aspect_HatchStyle (MyCGroup.Struct->ContextFillArea.Hatch));
1089 // Materials
1090 // Front and Back face
1091 if (MyCGroup.Struct->ContextFillArea.Distinguish == 1)
1092 CTXF->SetDistinguishOn ();
1093 else
1094 CTXF->SetDistinguishOff ();
1095 if (MyCGroup.Struct->ContextFillArea.BackFace == 1)
1096 CTXF->SuppressBackFace ();
1097 else
1098 CTXF->AllowBackFace ();
1099 // Texture
1100 if (MyCGroup.Struct->ContextFillArea.Texture.doTextureMap == 1)
1101 CTXF->SetTextureMapOn ();
1102 else
1103 CTXF->SetTextureMapOff ();
1104
1105 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
1106 CTXF->SetPolygonOffsets(MyCGroup.Struct->ContextFillArea.PolygonOffsetMode,
1107 MyCGroup.Struct->ContextFillArea.PolygonOffsetFactor,
1108 MyCGroup.Struct->ContextFillArea.PolygonOffsetUnits);
1109 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
1110 }
1111 CTXF->SetInteriorStyle (AStyle);
1112 CTXF->SetInteriorColor (AnIntColor);
1113 CTXF->SetEdgeColor (AnEdgeColor);
1114 CTXF->SetEdgeLineType (ALType);
1115 CTXF->SetEdgeWidth (AWidth);
1116 CTXF->SetBackMaterial (Back);
1117 CTXF->SetFrontMaterial (Front);
1118}
1119
1120void Graphic3d_Group::PrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& CTXL, const Handle(Graphic3d_AspectText3d)& CTXT, const Handle(Graphic3d_AspectMarker3d)& CTXM, const Handle(Graphic3d_AspectFillArea3d)& CTXF) const {
1121
1122 GroupPrimitivesAspect (CTXL, CTXT, CTXM, CTXF);
1123
1124}