1 // Created by: NW,JPB,CAL
2 // Copyright (c) 1991-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License 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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 // modified: 1/07/97 ; PCT : ajout texture mapping
17 // 20/07/97 ; PCT : ajout transparence texture
18 // 08/04/98 ; FGU : Ajout emission surface
19 // 30/11/98 ; FMN : S4069. Textes always visible.
20 // 22/03/04 ; SAN : OCC4895 High-level interface for controlling polygon offsets */
25 //-Design Declaration des variables specifiques aux groupes
28 //-Warning Un groupe est defini dans une structure
29 // Il s'agit de la plus petite entite editable
37 #define OCC1174 //SAV 08/01/03 : Added back face interior color controling
41 #include <Graphic3d_Group.jxx>
42 #include <Graphic3d_Group.pxx>
43 #include <Graphic3d_TextureMap.hxx>
44 #include <Graphic3d_ShaderProgram.hxx>
48 void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& CTX) {
50 if (IsDeleted ()) return;
52 Standard_Real R, G, B;
54 Quantity_Color AColor;
55 Aspect_TypeOfLine ALType;
57 CTX->Values (AColor, ALType, AWidth);
58 AColor.Values (R, G, B, Quantity_TOC_RGB);
60 MyCGroup.ContextLine.Color.r = float (R);
61 MyCGroup.ContextLine.Color.g = float (G);
62 MyCGroup.ContextLine.Color.b = float (B);
63 MyCGroup.ContextLine.LineType = int (ALType);
64 MyCGroup.ContextLine.Width = float (AWidth);
65 MyCGroup.ContextLine.IsDef = 1;
67 MyCGroup.ContextLine.ShaderProgram = CTX->ShaderProgram();
70 MyGraphicDriver->LineContextGroup (MyCGroup, noinsert);
72 MyCGroup.ContextLine.IsSet = 1;
77 void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& CTX) {
79 if (IsDeleted ()) return;
81 Standard_Real R, G, B;
83 //Quantity_Color AColor;
84 Quantity_Color AIntColor;
85 Quantity_Color BackIntColor;
86 Quantity_Color AEdgeColor;
87 Aspect_TypeOfLine ALType;
88 Aspect_InteriorStyle AStyle;
90 CTX->Values (AStyle, AIntColor, BackIntColor, AEdgeColor, ALType, AWidth);
91 AIntColor.Values (R, G, B, Quantity_TOC_RGB);
93 MyCGroup.ContextFillArea.Style = int (AStyle);
94 MyCGroup.ContextFillArea.IntColor.r = float (R);
95 MyCGroup.ContextFillArea.IntColor.g = float (G);
96 MyCGroup.ContextFillArea.IntColor.b = float (B);
99 if ( CTX->Distinguish() )
100 BackIntColor.Values( R, G, B, Quantity_TOC_RGB );
102 MyCGroup.ContextFillArea.BackIntColor.r = float( R );
103 MyCGroup.ContextFillArea.BackIntColor.g = float( G );
104 MyCGroup.ContextFillArea.BackIntColor.b = float( B );
106 MyCGroup.ContextFillArea.Edge = (CTX->Edge () ? 1 : 0);
107 AEdgeColor.Values (R, G, B, Quantity_TOC_RGB);
108 MyCGroup.ContextFillArea.EdgeColor.r = float (R);
109 MyCGroup.ContextFillArea.EdgeColor.g = float (G);
110 MyCGroup.ContextFillArea.EdgeColor.b = float (B);
111 MyCGroup.ContextFillArea.LineType = int (ALType);
112 MyCGroup.ContextFillArea.Width = float (AWidth);
113 MyCGroup.ContextFillArea.Hatch = int (CTX->HatchStyle ());
115 /*** Front and Back face ***/
116 MyCGroup.ContextFillArea.Distinguish =
117 ( CTX->Distinguish () ? 1 : 0 );
118 MyCGroup.ContextFillArea.BackFace =
119 ( CTX->BackFace () ? 1 : 0 );
121 /*** Back Material ***/
123 MyCGroup.ContextFillArea.Back.Shininess =
124 float ((CTX->BackMaterial ()).Shininess ());
125 MyCGroup.ContextFillArea.Back.Ambient =
126 float ((CTX->BackMaterial ()).Ambient ());
127 MyCGroup.ContextFillArea.Back.Diffuse =
128 float ((CTX->BackMaterial ()).Diffuse ());
129 MyCGroup.ContextFillArea.Back.Specular =
130 float ((CTX->BackMaterial ()).Specular ());
131 MyCGroup.ContextFillArea.Back.Transparency =
132 float ((CTX->BackMaterial ()).Transparency ());
133 MyCGroup.ContextFillArea.Back.Emission =
134 float ((CTX->BackMaterial ()).Emissive ());
137 MyCGroup.ContextFillArea.Back.IsAmbient =
138 ( (CTX->BackMaterial ()).ReflectionMode
139 (Graphic3d_TOR_AMBIENT) ? 1 : 0 );
140 MyCGroup.ContextFillArea.Back.IsDiffuse =
141 ( (CTX->BackMaterial ()).ReflectionMode
142 (Graphic3d_TOR_DIFFUSE) ? 1 : 0 );
143 MyCGroup.ContextFillArea.Back.IsSpecular =
144 ( (CTX->BackMaterial ()).ReflectionMode
145 (Graphic3d_TOR_SPECULAR) ? 1 : 0 );
146 MyCGroup.ContextFillArea.Back.IsEmission =
147 ( (CTX->BackMaterial ()).ReflectionMode
148 (Graphic3d_TOR_EMISSION) ? 1 : 0 );
152 const Graphic3d_MaterialAspect ama = CTX->BackMaterial () ;
153 Standard_Boolean amt = ama.MaterialType(Graphic3d_MATERIAL_PHYSIC) ;
154 MyCGroup.ContextFillArea.Back.IsPhysic = ( amt ? 1 : 0 );
157 MyCGroup.ContextFillArea.Back.ColorSpec.r =
158 float (((CTX->BackMaterial ()).SpecularColor ()).Red ());
159 MyCGroup.ContextFillArea.Back.ColorSpec.g =
160 float (((CTX->BackMaterial ()).SpecularColor ()).Green ());
161 MyCGroup.ContextFillArea.Back.ColorSpec.b =
162 float (((CTX->BackMaterial ()).SpecularColor ()).Blue ());
166 MyCGroup.ContextFillArea.Back.ColorAmb.r =
167 float (((CTX->BackMaterial ()).AmbientColor ()).Red ());
168 MyCGroup.ContextFillArea.Back.ColorAmb.g =
169 float (((CTX->BackMaterial ()).AmbientColor ()).Green ());
170 MyCGroup.ContextFillArea.Back.ColorAmb.b =
171 float (((CTX->BackMaterial ()).AmbientColor ()).Blue ());
174 MyCGroup.ContextFillArea.Back.ColorDif.r =
175 float (((CTX->BackMaterial ()).DiffuseColor ()).Red ());
176 MyCGroup.ContextFillArea.Back.ColorDif.g =
177 float (((CTX->BackMaterial ()).DiffuseColor ()).Green ());
178 MyCGroup.ContextFillArea.Back.ColorDif.b =
179 float (((CTX->BackMaterial ()).DiffuseColor ()).Blue ());
182 MyCGroup.ContextFillArea.Back.ColorEms.r =
183 float (((CTX->BackMaterial ()).EmissiveColor ()).Red ());
184 MyCGroup.ContextFillArea.Back.ColorEms.g =
185 float (((CTX->BackMaterial ()).EmissiveColor ()).Green ());
186 MyCGroup.ContextFillArea.Back.ColorEms.b =
187 float (((CTX->BackMaterial ()).EmissiveColor ()).Blue ());
189 MyCGroup.ContextFillArea.Back.EnvReflexion =
190 float ((CTX->BackMaterial ()).EnvReflexion());
192 /*** Front Material ***/
194 MyCGroup.ContextFillArea.Front.Shininess =
195 float ((CTX->FrontMaterial ()).Shininess ());
196 MyCGroup.ContextFillArea.Front.Ambient =
197 float ((CTX->FrontMaterial ()).Ambient ());
198 MyCGroup.ContextFillArea.Front.Diffuse =
199 float ((CTX->FrontMaterial ()).Diffuse ());
200 MyCGroup.ContextFillArea.Front.Specular =
201 float ((CTX->FrontMaterial ()).Specular ());
202 MyCGroup.ContextFillArea.Front.Transparency =
203 float ((CTX->FrontMaterial ()).Transparency ());
204 MyCGroup.ContextFillArea.Front.Emission =
205 float ((CTX->FrontMaterial ()).Emissive ());
208 MyCGroup.ContextFillArea.Front.IsAmbient =
209 ( (CTX->FrontMaterial ()).ReflectionMode
210 (Graphic3d_TOR_AMBIENT) ? 1 : 0 );
211 MyCGroup.ContextFillArea.Front.IsDiffuse =
212 ( (CTX->FrontMaterial ()).ReflectionMode
213 (Graphic3d_TOR_DIFFUSE) ? 1 : 0 );
214 MyCGroup.ContextFillArea.Front.IsSpecular =
215 ( (CTX->FrontMaterial ()).ReflectionMode
216 (Graphic3d_TOR_SPECULAR) ? 1 : 0 );
217 MyCGroup.ContextFillArea.Front.IsEmission =
218 ( (CTX->FrontMaterial ()).ReflectionMode
219 (Graphic3d_TOR_EMISSION) ? 1 : 0 );
223 const Graphic3d_MaterialAspect amas = CTX->FrontMaterial () ;
224 Standard_Boolean amty = amas.MaterialType(Graphic3d_MATERIAL_PHYSIC) ;
225 MyCGroup.ContextFillArea.Front.IsPhysic = ( amty ? 1 : 0 );
228 MyCGroup.ContextFillArea.Front.ColorSpec.r =
229 float (((CTX->FrontMaterial ()).SpecularColor ()).Red ());
230 MyCGroup.ContextFillArea.Front.ColorSpec.g =
231 float (((CTX->FrontMaterial ()).SpecularColor ()).Green ());
232 MyCGroup.ContextFillArea.Front.ColorSpec.b =
233 float (((CTX->FrontMaterial ()).SpecularColor ()).Blue ());
236 MyCGroup.ContextFillArea.Front.ColorAmb.r =
237 float (((CTX->FrontMaterial ()).AmbientColor ()).Red ());
238 MyCGroup.ContextFillArea.Front.ColorAmb.g =
239 float (((CTX->FrontMaterial ()).AmbientColor ()).Green ());
240 MyCGroup.ContextFillArea.Front.ColorAmb.b =
241 float (((CTX->FrontMaterial ()).AmbientColor ()).Blue ());
244 MyCGroup.ContextFillArea.Front.ColorDif.r =
245 float (((CTX->FrontMaterial ()).DiffuseColor ()).Red ());
246 MyCGroup.ContextFillArea.Front.ColorDif.g =
247 float (((CTX->FrontMaterial ()).DiffuseColor ()).Green ());
248 MyCGroup.ContextFillArea.Front.ColorDif.b =
249 float (((CTX->FrontMaterial ()).DiffuseColor ()).Blue ());
252 MyCGroup.ContextFillArea.Front.ColorEms.r =
253 float (((CTX->FrontMaterial ()).EmissiveColor ()).Red ());
254 MyCGroup.ContextFillArea.Front.ColorEms.g =
255 float (((CTX->FrontMaterial ()).EmissiveColor ()).Green ());
256 MyCGroup.ContextFillArea.Front.ColorEms.b =
257 float (((CTX->FrontMaterial ()).EmissiveColor ()).Blue ());
259 MyCGroup.ContextFillArea.Front.EnvReflexion =
260 float ((CTX->FrontMaterial ()).EnvReflexion());
262 MyCGroup.ContextFillArea.IsDef = 1; // Definition material ok
264 /*** Texture map ***/
265 MyCGroup.ContextFillArea.Texture.TextureMap = CTX->TextureMap();
266 MyCGroup.ContextFillArea.Texture.doTextureMap = CTX->TextureMapState() ? 1 : 0;
268 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
269 Standard_Integer aPolyMode;
270 Standard_ShortReal aPolyFactor, aPolyUnits;
271 CTX->PolygonOffsets(aPolyMode, aPolyFactor, aPolyUnits);
272 MyCGroup.ContextFillArea.PolygonOffsetMode = aPolyMode;
273 MyCGroup.ContextFillArea.PolygonOffsetFactor = aPolyFactor;
274 MyCGroup.ContextFillArea.PolygonOffsetUnits = aPolyUnits;
275 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
277 MyCGroup.ContextFillArea.ShaderProgram = CTX->ShaderProgram();
280 MyGraphicDriver->FaceContextGroup (MyCGroup, noinsert);
282 MyCGroup.ContextFillArea.IsSet = 1;
287 void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& theCtx)
289 if (IsDeleted()) return;
291 Standard_Real aRed, aGreen, aBlue;
292 Standard_Real aScale;
293 Quantity_Color aColor;
294 Aspect_TypeOfMarker aMarkerType;
296 theCtx->Values (aColor, aMarkerType, aScale);
297 aColor.Values (aRed, aGreen, aBlue, Quantity_TOC_RGB);
299 MyCGroup.ContextMarker.IsDef = 1;
300 MyCGroup.ContextMarker.Color.r = Standard_ShortReal (aRed);
301 MyCGroup.ContextMarker.Color.g = Standard_ShortReal (aGreen);
302 MyCGroup.ContextMarker.Color.b = Standard_ShortReal (aBlue);
303 MyCGroup.ContextMarker.MarkerType = aMarkerType;
304 MyCGroup.ContextMarker.Scale = Standard_ShortReal (aScale);
305 MyCGroup.ContextMarker.MarkerImage = theCtx->GetMarkerImage();
307 MyCGroup.ContextMarker.ShaderProgram = theCtx->ShaderProgram();
310 MyGraphicDriver->MarkerContextGroup (MyCGroup, noinsert);
312 MyCGroup.ContextMarker.IsSet = 1;
317 void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& CTX) {
319 if (IsDeleted ()) return;
321 Standard_CString AFont;
322 Standard_Real R, G, B;
323 Standard_Real Rs, Gs, Bs;
324 Standard_Real ASpace;
325 Standard_Real AnExpansion;
326 Quantity_Color AColor;
327 Aspect_TypeOfStyleText AStyle;
328 Aspect_TypeOfDisplayText ADisplayType;
329 Quantity_Color AColorSubTitle;
330 Standard_Boolean ATextZoomable;
331 Standard_Real ATextAngle;
332 Font_FontAspect ATextFontAspect;
334 CTX->Values (AColor, AFont, AnExpansion, ASpace, AStyle, ADisplayType,AColorSubTitle,ATextZoomable,ATextAngle,ATextFontAspect);
335 AColor.Values (R, G, B, Quantity_TOC_RGB);
336 AColorSubTitle.Values (Rs, Gs, Bs, Quantity_TOC_RGB);
338 MyCGroup.ContextText.Color.r = float (R);
339 MyCGroup.ContextText.Color.g = float (G);
340 MyCGroup.ContextText.Color.b = float (B);
341 MyCGroup.ContextText.Font = (char*)AFont;
342 MyCGroup.ContextText.Expan = float (AnExpansion);
343 MyCGroup.ContextText.Space = float (ASpace);
344 MyCGroup.ContextText.Style = int (AStyle);
345 MyCGroup.ContextText.DisplayType= int (ADisplayType);
346 MyCGroup.ContextText.ColorSubTitle.r = float (Rs);
347 MyCGroup.ContextText.ColorSubTitle.g = float (Gs);
348 MyCGroup.ContextText.ColorSubTitle.b = float (Bs);
349 MyCGroup.ContextText.TextZoomable = ATextZoomable;
350 MyCGroup.ContextText.TextAngle = float (ATextAngle);
351 MyCGroup.ContextText.TextFontAspect = (int)ATextFontAspect;
353 MyCGroup.ContextText.ShaderProgram = CTX->ShaderProgram();
355 MyCGroup.ContextText.IsDef = 1;
358 MyGraphicDriver->TextContextGroup (MyCGroup, noinsert);
360 MyCGroup.ContextText.IsSet = 1;
365 void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& CTX) {
367 if (IsDeleted ()) return;
369 Standard_Real R, G, B;
370 Standard_Real AWidth;
371 Quantity_Color AColor;
372 Aspect_TypeOfLine ALType;
374 CTX->Values (AColor, ALType, AWidth);
375 AColor.Values (R, G, B, Quantity_TOC_RGB);
377 MyCGroup.ContextLine.Color.r = float (R);
378 MyCGroup.ContextLine.Color.g = float (G);
379 MyCGroup.ContextLine.Color.b = float (B);
380 MyCGroup.ContextLine.LineType = int (ALType);
381 MyCGroup.ContextLine.Width = float (AWidth);
382 MyCGroup.ContextLine.IsDef = 1;
384 MyCGroup.ContextLine.ShaderProgram = CTX->ShaderProgram();
387 MyGraphicDriver->LineContextGroup (MyCGroup, noinsert);
389 MyCGroup.ContextLine.IsSet = 1;
394 void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& CTX) {
396 if (IsDeleted ()) return;
398 Standard_Real R, G, B;
399 Standard_Real AWidth;
400 Quantity_Color AIntColor;
401 Quantity_Color BackIntColor;
402 Quantity_Color AEdgeColor;
403 Aspect_TypeOfLine ALType;
404 Aspect_InteriorStyle AStyle;
406 CTX->Values (AStyle, AIntColor, BackIntColor, AEdgeColor, ALType, AWidth);
407 AIntColor.Values (R, G, B, Quantity_TOC_RGB);
409 MyCGroup.ContextFillArea.Style = int (AStyle);
410 MyCGroup.ContextFillArea.IntColor.r = float (R);
411 MyCGroup.ContextFillArea.IntColor.g = float (G);
412 MyCGroup.ContextFillArea.IntColor.b = float (B);
414 if ( CTX->Distinguish() )
415 BackIntColor.Values( R, G, B, Quantity_TOC_RGB );
417 MyCGroup.ContextFillArea.BackIntColor.r = float( R );
418 MyCGroup.ContextFillArea.BackIntColor.g = float( G );
419 MyCGroup.ContextFillArea.BackIntColor.b = float( B );
421 MyCGroup.ContextFillArea.Edge = (CTX->Edge () ? 1 : 0);
422 AEdgeColor.Values (R, G, B, Quantity_TOC_RGB);
423 MyCGroup.ContextFillArea.EdgeColor.r = float (R);
424 MyCGroup.ContextFillArea.EdgeColor.g = float (G);
425 MyCGroup.ContextFillArea.EdgeColor.b = float (B);
426 MyCGroup.ContextFillArea.LineType = int (ALType);
427 MyCGroup.ContextFillArea.Width = float (AWidth);
428 MyCGroup.ContextFillArea.Hatch = int (CTX->HatchStyle ());
429 // Front and Back face
430 MyCGroup.ContextFillArea.Distinguish =
431 ( CTX->Distinguish () ? 1 : 0 );
432 MyCGroup.ContextFillArea.BackFace =
433 ( CTX->BackFace () ? 1 : 0 );
435 /*** Back Material ***/
437 MyCGroup.ContextFillArea.Back.Shininess =
438 float ((CTX->BackMaterial ()).Shininess ());
439 MyCGroup.ContextFillArea.Back.Ambient =
440 float ((CTX->BackMaterial ()).Ambient ());
441 MyCGroup.ContextFillArea.Back.Diffuse =
442 float ((CTX->BackMaterial ()).Diffuse ());
443 MyCGroup.ContextFillArea.Back.Specular =
444 float ((CTX->BackMaterial ()).Specular ());
445 MyCGroup.ContextFillArea.Back.Transparency =
446 float ((CTX->BackMaterial ()).Transparency ());
447 MyCGroup.ContextFillArea.Back.Emission =
448 float ((CTX->BackMaterial ()).Emissive ());
451 MyCGroup.ContextFillArea.Back.IsAmbient =
452 ( (CTX->BackMaterial ()).ReflectionMode
453 (Graphic3d_TOR_AMBIENT) ? 1 : 0 );
454 MyCGroup.ContextFillArea.Back.IsDiffuse =
455 ( (CTX->BackMaterial ()).ReflectionMode
456 (Graphic3d_TOR_DIFFUSE) ? 1 : 0 );
457 MyCGroup.ContextFillArea.Back.IsSpecular =
458 ( (CTX->BackMaterial ()).ReflectionMode
459 (Graphic3d_TOR_SPECULAR) ? 1 : 0 );
460 MyCGroup.ContextFillArea.Back.IsEmission =
461 ( (CTX->BackMaterial ()).ReflectionMode
462 (Graphic3d_TOR_EMISSION) ? 1 : 0 );
466 const Graphic3d_MaterialAspect ama = CTX->BackMaterial () ;
467 Standard_Boolean amt = ama.MaterialType(Graphic3d_MATERIAL_PHYSIC) ;
468 MyCGroup.ContextFillArea.Back.IsPhysic = ( amt ? 1 : 0 );
471 MyCGroup.ContextFillArea.Back.ColorSpec.r =
472 float (((CTX->BackMaterial ()).SpecularColor ()).Red ());
473 MyCGroup.ContextFillArea.Back.ColorSpec.g =
474 float (((CTX->BackMaterial ()).SpecularColor ()).Green ());
475 MyCGroup.ContextFillArea.Back.ColorSpec.b =
476 float (((CTX->BackMaterial ()).SpecularColor ()).Blue ());
479 MyCGroup.ContextFillArea.Back.ColorAmb.r =
480 float (((CTX->BackMaterial ()).AmbientColor ()).Red ());
481 MyCGroup.ContextFillArea.Back.ColorAmb.g =
482 float (((CTX->BackMaterial ()).AmbientColor ()).Green ());
483 MyCGroup.ContextFillArea.Back.ColorAmb.b =
484 float (((CTX->BackMaterial ()).AmbientColor ()).Blue ());
487 MyCGroup.ContextFillArea.Back.ColorDif.r =
488 float (((CTX->BackMaterial ()).DiffuseColor ()).Red ());
489 MyCGroup.ContextFillArea.Back.ColorDif.g =
490 float (((CTX->BackMaterial ()).DiffuseColor ()).Green ());
491 MyCGroup.ContextFillArea.Back.ColorDif.b =
492 float (((CTX->BackMaterial ()).DiffuseColor ()).Blue ());
495 MyCGroup.ContextFillArea.Back.ColorEms.r =
496 float (((CTX->BackMaterial ()).EmissiveColor ()).Red ());
497 MyCGroup.ContextFillArea.Back.ColorEms.g =
498 float (((CTX->BackMaterial ()).EmissiveColor ()).Green ());
499 MyCGroup.ContextFillArea.Back.ColorEms.b =
500 float (((CTX->BackMaterial ()).EmissiveColor ()).Blue ());
502 MyCGroup.ContextFillArea.Back.EnvReflexion =
503 float ((CTX->BackMaterial ()).EnvReflexion());
505 /*** Front Material ***/
507 MyCGroup.ContextFillArea.Front.Shininess =
508 float ((CTX->FrontMaterial ()).Shininess ());
509 MyCGroup.ContextFillArea.Front.Ambient =
510 float ((CTX->FrontMaterial ()).Ambient ());
511 MyCGroup.ContextFillArea.Front.Diffuse =
512 float ((CTX->FrontMaterial ()).Diffuse ());
513 MyCGroup.ContextFillArea.Front.Specular =
514 float ((CTX->FrontMaterial ()).Specular ());
515 MyCGroup.ContextFillArea.Front.Transparency =
516 float ((CTX->FrontMaterial ()).Transparency ());
517 MyCGroup.ContextFillArea.Front.Emission =
518 float ((CTX->FrontMaterial ()).Emissive ());
521 MyCGroup.ContextFillArea.Front.IsAmbient =
522 ( (CTX->FrontMaterial ()).ReflectionMode
523 (Graphic3d_TOR_AMBIENT) ? 1 : 0 );
524 MyCGroup.ContextFillArea.Front.IsDiffuse =
525 ( (CTX->FrontMaterial ()).ReflectionMode
526 (Graphic3d_TOR_DIFFUSE) ? 1 : 0 );
527 MyCGroup.ContextFillArea.Front.IsSpecular =
528 ( (CTX->FrontMaterial ()).ReflectionMode
529 (Graphic3d_TOR_SPECULAR) ? 1 : 0 );
530 MyCGroup.ContextFillArea.Front.IsEmission =
531 ( (CTX->FrontMaterial ()).ReflectionMode
532 (Graphic3d_TOR_EMISSION) ? 1 : 0 );
536 const Graphic3d_MaterialAspect amas = CTX->FrontMaterial () ;
537 Standard_Boolean amty = amas.MaterialType(Graphic3d_MATERIAL_PHYSIC) ;
538 MyCGroup.ContextFillArea.Front.IsPhysic = ( amty ? 1 : 0 );
541 MyCGroup.ContextFillArea.Front.ColorSpec.r =
542 float (((CTX->FrontMaterial ()).SpecularColor ()).Red ());
543 MyCGroup.ContextFillArea.Front.ColorSpec.g =
544 float (((CTX->FrontMaterial ()).SpecularColor ()).Green ());
545 MyCGroup.ContextFillArea.Front.ColorSpec.b =
546 float (((CTX->FrontMaterial ()).SpecularColor ()).Blue ());
549 MyCGroup.ContextFillArea.Front.ColorAmb.r =
550 float (((CTX->FrontMaterial ()).AmbientColor ()).Red ());
551 MyCGroup.ContextFillArea.Front.ColorAmb.g =
552 float (((CTX->FrontMaterial ()).AmbientColor ()).Green ());
553 MyCGroup.ContextFillArea.Front.ColorAmb.b =
554 float (((CTX->FrontMaterial ()).AmbientColor ()).Blue ());
557 MyCGroup.ContextFillArea.Front.ColorDif.r =
558 float (((CTX->FrontMaterial ()).DiffuseColor ()).Red ());
559 MyCGroup.ContextFillArea.Front.ColorDif.g =
560 float (((CTX->FrontMaterial ()).DiffuseColor ()).Green ());
561 MyCGroup.ContextFillArea.Front.ColorDif.b =
562 float (((CTX->FrontMaterial ()).DiffuseColor ()).Blue ());
565 MyCGroup.ContextFillArea.Front.ColorEms.r =
566 float (((CTX->FrontMaterial ()).EmissiveColor ()).Red ());
567 MyCGroup.ContextFillArea.Front.ColorEms.g =
568 float (((CTX->FrontMaterial ()).EmissiveColor ()).Green ());
569 MyCGroup.ContextFillArea.Front.ColorEms.b =
570 float (((CTX->FrontMaterial ()).EmissiveColor ()).Blue ());
572 MyCGroup.ContextFillArea.Front.EnvReflexion =
573 float ((CTX->FrontMaterial ()).EnvReflexion());
575 MyCGroup.ContextFillArea.IsDef = 1; // Material definition ok
577 MyCGroup.ContextFillArea.Texture.TextureMap = CTX->TextureMap();
578 MyCGroup.ContextFillArea.Texture.doTextureMap = CTX->TextureMapState() ? 1 : 0;
580 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
581 Standard_Integer aPolyMode;
582 Standard_ShortReal aPolyFactor, aPolyUnits;
583 CTX->PolygonOffsets(aPolyMode, aPolyFactor, aPolyUnits);
584 MyCGroup.ContextFillArea.PolygonOffsetMode = aPolyMode;
585 MyCGroup.ContextFillArea.PolygonOffsetFactor = (Standard_ShortReal)aPolyFactor;
586 MyCGroup.ContextFillArea.PolygonOffsetUnits = (Standard_ShortReal)aPolyUnits;
587 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
589 MyCGroup.ContextFillArea.ShaderProgram = CTX->ShaderProgram();
592 MyGraphicDriver->FaceContextGroup (MyCGroup, noinsert);
594 MyCGroup.ContextFillArea.IsSet = 1;
599 void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& thCtx)
601 if (IsDeleted()) return;
603 Standard_Real aRed, aGreen, aBlue;
604 Standard_Real aScale;
605 Quantity_Color aColor;
606 Aspect_TypeOfMarker aMarkerType;
608 thCtx->Values (aColor, aMarkerType, aScale);
609 aColor.Values (aRed, aGreen, aBlue, Quantity_TOC_RGB);
611 MyCGroup.ContextMarker.IsDef = 1;
612 MyCGroup.ContextMarker.Color.r = Standard_ShortReal (aRed);
613 MyCGroup.ContextMarker.Color.g = Standard_ShortReal (aGreen);
614 MyCGroup.ContextMarker.Color.b = Standard_ShortReal (aBlue);
615 MyCGroup.ContextMarker.MarkerType = aMarkerType;
616 MyCGroup.ContextMarker.Scale = Standard_ShortReal (aScale);
617 MyCGroup.ContextMarker.MarkerImage = thCtx->GetMarkerImage();
619 MyCGroup.ContextMarker.ShaderProgram = thCtx->ShaderProgram();
622 MyGraphicDriver->MarkerContextGroup (MyCGroup, noinsert);
624 MyCGroup.ContextMarker.IsSet = 1;
629 void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& CTX) {
631 if (IsDeleted ()) return;
633 Standard_CString AFont;
634 Standard_Real R, G, B;
635 Standard_Real Rs, Gs, Bs;
636 Standard_Real ASpace;
637 Standard_Real AnExpansion;
638 Quantity_Color AColor;
639 Aspect_TypeOfStyleText AStyle;
640 Aspect_TypeOfDisplayText ADisplayType;
641 Quantity_Color AColorSubTitle;
642 Standard_Boolean ATextZoomable;
643 Standard_Real ATextAngle;
644 Font_FontAspect ATextFontAspect;
646 CTX->Values (AColor, AFont, AnExpansion, ASpace, AStyle, ADisplayType,AColorSubTitle,ATextZoomable,ATextAngle,ATextFontAspect);
647 AColor.Values (R, G, B, Quantity_TOC_RGB);
648 AColorSubTitle.Values (Rs, Gs, Bs, Quantity_TOC_RGB);
650 MyCGroup.ContextText.Color.r = float (R);
651 MyCGroup.ContextText.Color.g = float (G);
652 MyCGroup.ContextText.Color.b = float (B);
653 MyCGroup.ContextText.Font = (char*)AFont;
654 MyCGroup.ContextText.Expan = float (AnExpansion);
655 MyCGroup.ContextText.Space = float (ASpace);
656 MyCGroup.ContextText.Style = int (AStyle);
657 MyCGroup.ContextText.DisplayType= int (ADisplayType);
658 MyCGroup.ContextText.ColorSubTitle.r = float (Rs);
659 MyCGroup.ContextText.ColorSubTitle.g = float (Gs);
660 MyCGroup.ContextText.ColorSubTitle.b = float (Bs);
661 MyCGroup.ContextText.TextZoomable = ATextZoomable;
662 MyCGroup.ContextText.TextAngle = float (ATextAngle);
663 MyCGroup.ContextText.TextFontAspect = (int)ATextFontAspect;
664 MyCGroup.ContextText.IsDef = 1;
666 MyCGroup.ContextText.ShaderProgram = CTX->ShaderProgram();
669 MyGraphicDriver->TextContextGroup (MyCGroup, noinsert);
671 MyCGroup.ContextText.IsSet = 1;
676 Standard_Boolean Graphic3d_Group::IsGroupPrimitivesAspectSet (const Graphic3d_GroupAspect theAspect) const {
678 case Graphic3d_ASPECT_LINE: return MyCGroup.ContextLine.IsSet;
679 case Graphic3d_ASPECT_TEXT: return MyCGroup.ContextText.IsSet;
680 case Graphic3d_ASPECT_MARKER: return MyCGroup.ContextMarker.IsSet;
681 case Graphic3d_ASPECT_FILL_AREA: return MyCGroup.ContextFillArea.IsSet;
682 default: return Standard_False;
687 void Graphic3d_Group::GroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& CTXL, const Handle(Graphic3d_AspectText3d)& CTXT, const Handle(Graphic3d_AspectMarker3d)& CTXM, const Handle(Graphic3d_AspectFillArea3d)& CTXF) const {
689 Standard_Real R, G, B;
690 Standard_Real Rs, Gs, Bs;
691 Quantity_Color AColor;
693 Standard_Real AWidth;
694 Aspect_TypeOfLine ALType;
696 Standard_CString AFont;
697 Standard_Real ASpace;
698 Standard_Real AnExpansion;
700 Standard_Real AScale;
701 Aspect_TypeOfMarker AMType;
703 Quantity_Color AnIntColor;
704 Quantity_Color AnEdgeColor;
705 Aspect_InteriorStyle AStyle;
706 Standard_Boolean EdgeOn = Standard_False;
707 Graphic3d_MaterialAspect Front;
708 Graphic3d_MaterialAspect Back;
709 Aspect_TypeOfStyleText AStyleT;
710 Aspect_TypeOfDisplayText ADisplayType;
711 Quantity_Color AColorSubTitle;
713 if (MyCGroup.ContextLine.IsSet)
715 R = Standard_Real (MyCGroup.ContextLine.Color.r);
716 G = Standard_Real (MyCGroup.ContextLine.Color.g);
717 B = Standard_Real (MyCGroup.ContextLine.Color.b);
718 ALType = Aspect_TypeOfLine (MyCGroup.ContextLine.LineType);
719 AWidth = Standard_Real (MyCGroup.ContextLine.Width);
720 CTXL->SetShaderProgram (MyCGroup.ContextLine.ShaderProgram);
724 R = Standard_Real (MyCGroup.Struct->ContextLine.Color.r);
725 G = Standard_Real (MyCGroup.Struct->ContextLine.Color.g);
726 B = Standard_Real (MyCGroup.Struct->ContextLine.Color.b);
727 ALType = Aspect_TypeOfLine (MyCGroup.Struct->ContextLine.LineType);
728 AWidth = Standard_Real (MyCGroup.Struct->ContextLine.Width);
729 CTXL->SetShaderProgram (MyCGroup.Struct->ContextLine.ShaderProgram);
731 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
732 CTXL->SetColor (AColor);
733 CTXL->SetType (ALType);
734 CTXL->SetWidth (AWidth);
736 if (MyCGroup.ContextText.IsSet)
738 R = Standard_Real (MyCGroup.ContextText.Color.r);
739 G = Standard_Real (MyCGroup.ContextText.Color.g);
740 B = Standard_Real (MyCGroup.ContextText.Color.b);
741 Rs = Standard_Real (MyCGroup.ContextText.ColorSubTitle.r);
742 Gs = Standard_Real (MyCGroup.ContextText.ColorSubTitle.g);
743 Bs = Standard_Real (MyCGroup.ContextText.ColorSubTitle.b);
744 AFont = Standard_CString (MyCGroup.ContextText.Font);
745 AnExpansion = Standard_Real (MyCGroup.ContextText.Expan);
746 ASpace = Standard_Real (MyCGroup.ContextText.Space);
747 AStyleT = Aspect_TypeOfStyleText (MyCGroup.ContextText.Style);
748 ADisplayType= Aspect_TypeOfDisplayText (MyCGroup.ContextText.DisplayType);
749 CTXT->SetShaderProgram (MyCGroup.ContextText.ShaderProgram);
753 R = Standard_Real (MyCGroup.Struct->ContextText.Color.r);
754 G = Standard_Real (MyCGroup.Struct->ContextText.Color.g);
755 B = Standard_Real (MyCGroup.Struct->ContextText.Color.b);
756 Rs = Standard_Real (MyCGroup.Struct->ContextText.ColorSubTitle.r);
757 Gs = Standard_Real (MyCGroup.Struct->ContextText.ColorSubTitle.g);
758 Bs = Standard_Real (MyCGroup.Struct->ContextText.ColorSubTitle.b);
759 AFont = Standard_CString (MyCGroup.Struct->ContextText.Font);
760 AnExpansion = Standard_Real (MyCGroup.Struct->ContextText.Expan);
761 ASpace = Standard_Real (MyCGroup.Struct->ContextText.Space);
762 AStyleT = Aspect_TypeOfStyleText (MyCGroup.Struct->ContextText.Style);
763 ADisplayType = Aspect_TypeOfDisplayText (MyCGroup.Struct->ContextText.DisplayType);
764 CTXT->SetShaderProgram (MyCGroup.Struct->ContextText.ShaderProgram);
766 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
767 AColorSubTitle.SetValues (Rs, Gs, Bs, Quantity_TOC_RGB);
768 CTXT->SetColor (AColor);
769 CTXT->SetFont (AFont);
770 CTXT->SetExpansionFactor (AnExpansion);
771 CTXT->SetSpace (ASpace);
772 CTXT->SetStyle (AStyleT);
773 CTXT->SetDisplayType (ADisplayType);
774 CTXT->SetColorSubTitle (AColorSubTitle);
776 if (MyCGroup.ContextMarker.IsSet)
778 R = Standard_Real (MyCGroup.ContextMarker.Color.r);
779 G = Standard_Real (MyCGroup.ContextMarker.Color.g);
780 B = Standard_Real (MyCGroup.ContextMarker.Color.b);
781 AMType = MyCGroup.ContextMarker.MarkerType;
782 AScale = Standard_Real (MyCGroup.ContextMarker.Scale);
783 CTXT->SetShaderProgram (MyCGroup.ContextMarker.ShaderProgram);
785 if (AMType == Aspect_TOM_USERDEFINED)
787 CTXM->SetBitMap (MyMarkWidth, MyMarkHeight, MyMarkArray);
792 R = Standard_Real (MyCGroup.Struct->ContextMarker.Color.r);
793 G = Standard_Real (MyCGroup.Struct->ContextMarker.Color.g);
794 B = Standard_Real (MyCGroup.Struct->ContextMarker.Color.b);
795 AMType = MyCGroup.Struct->ContextMarker.MarkerType;
796 AScale = Standard_Real (MyCGroup.Struct->ContextMarker.Scale);
797 CTXT->SetShaderProgram (MyCGroup.Struct->ContextMarker.ShaderProgram);
799 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
800 CTXM->SetColor (AColor);
801 CTXM->SetType (AMType);
802 CTXM->SetScale (AScale);
804 if (MyCGroup.ContextFillArea.IsSet)
807 AStyle = Aspect_InteriorStyle (MyCGroup.ContextFillArea.Style);
808 R = Standard_Real (MyCGroup.ContextFillArea.IntColor.r);
809 G = Standard_Real (MyCGroup.ContextFillArea.IntColor.g);
810 B = Standard_Real (MyCGroup.ContextFillArea.IntColor.b);
811 AnIntColor.SetValues (R, G, B, Quantity_TOC_RGB);
813 if (MyCGroup.ContextFillArea.Edge == 1) EdgeOn = Standard_True;
814 R = Standard_Real (MyCGroup.ContextFillArea.EdgeColor.r);
815 G = Standard_Real (MyCGroup.ContextFillArea.EdgeColor.g);
816 B = Standard_Real (MyCGroup.ContextFillArea.EdgeColor.b);
817 AnEdgeColor.SetValues (R, G, B, Quantity_TOC_RGB);
818 ALType = Aspect_TypeOfLine (MyCGroup.ContextFillArea.LineType);
819 AWidth = Standard_Real (MyCGroup.ContextFillArea.Width);
822 Standard_Real (MyCGroup.ContextFillArea.Back.Shininess));
824 Standard_Real (MyCGroup.ContextFillArea.Back.Ambient));
826 Standard_Real (MyCGroup.ContextFillArea.Back.Diffuse));
828 Standard_Real (MyCGroup.ContextFillArea.Back.Specular));
829 Back.SetTransparency (
830 Standard_Real (MyCGroup.ContextFillArea.Back.Transparency));
832 Standard_Real (MyCGroup.ContextFillArea.Back.Emission));
833 if (MyCGroup.ContextFillArea.Back.IsAmbient == 1)
834 Back.SetReflectionModeOn (Graphic3d_TOR_AMBIENT);
836 Back.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
837 if (MyCGroup.ContextFillArea.Back.IsDiffuse == 1)
838 Back.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE);
840 Back.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
841 if (MyCGroup.ContextFillArea.Back.IsSpecular == 1)
842 Back.SetReflectionModeOn (Graphic3d_TOR_SPECULAR);
844 Back.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
846 R = Standard_Real (MyCGroup.ContextFillArea.Back.ColorSpec.r);
847 G = Standard_Real (MyCGroup.ContextFillArea.Back.ColorSpec.g);
848 B = Standard_Real (MyCGroup.ContextFillArea.Back.ColorSpec.b);
849 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
850 Back.SetSpecularColor (AColor);
852 R = Standard_Real (MyCGroup.ContextFillArea.Back.ColorAmb.r);
853 G = Standard_Real (MyCGroup.ContextFillArea.Back.ColorAmb.g);
854 B = Standard_Real (MyCGroup.ContextFillArea.Back.ColorAmb.b);
855 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
856 Back.SetAmbientColor (AColor);
858 R = Standard_Real (MyCGroup.ContextFillArea.Back.ColorDif.r);
859 G = Standard_Real (MyCGroup.ContextFillArea.Back.ColorDif.g);
860 B = Standard_Real (MyCGroup.ContextFillArea.Back.ColorDif.b);
861 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
862 Back.SetDiffuseColor (AColor);
864 R = Standard_Real (MyCGroup.ContextFillArea.Back.ColorEms.r);
865 G = Standard_Real (MyCGroup.ContextFillArea.Back.ColorEms.g);
866 B = Standard_Real (MyCGroup.ContextFillArea.Back.ColorEms.b);
867 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
868 Back.SetEmissiveColor (AColor);
870 Back.SetEnvReflexion (MyCGroup.ContextFillArea.Back.EnvReflexion);
873 Standard_Real (MyCGroup.ContextFillArea.Front.Shininess));
875 Standard_Real (MyCGroup.ContextFillArea.Front.Ambient));
877 Standard_Real (MyCGroup.ContextFillArea.Front.Diffuse));
879 Standard_Real (MyCGroup.ContextFillArea.Front.Specular));
880 Front.SetTransparency (
881 Standard_Real (MyCGroup.ContextFillArea.Front.Transparency));
883 Standard_Real (MyCGroup.ContextFillArea.Back.Emission));
884 if (MyCGroup.ContextFillArea.Front.IsAmbient == 1)
885 Front.SetReflectionModeOn (Graphic3d_TOR_AMBIENT);
887 Front.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
888 if (MyCGroup.ContextFillArea.Front.IsDiffuse == 1)
889 Front.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE);
891 Front.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
892 if (MyCGroup.ContextFillArea.Front.IsSpecular == 1)
893 Front.SetReflectionModeOn (Graphic3d_TOR_SPECULAR);
895 Front.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
897 R = Standard_Real (MyCGroup.ContextFillArea.Front.ColorSpec.r);
898 G = Standard_Real (MyCGroup.ContextFillArea.Front.ColorSpec.g);
899 B = Standard_Real (MyCGroup.ContextFillArea.Front.ColorSpec.b);
900 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
901 Front.SetSpecularColor (AColor);
903 R = Standard_Real (MyCGroup.ContextFillArea.Front.ColorAmb.r);
904 G = Standard_Real (MyCGroup.ContextFillArea.Front.ColorAmb.g);
905 B = Standard_Real (MyCGroup.ContextFillArea.Front.ColorAmb.b);
906 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
907 Front.SetAmbientColor (AColor);
909 R = Standard_Real (MyCGroup.ContextFillArea.Front.ColorDif.r);
910 G = Standard_Real (MyCGroup.ContextFillArea.Front.ColorDif.g);
911 B = Standard_Real (MyCGroup.ContextFillArea.Front.ColorDif.b);
912 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
913 Front.SetDiffuseColor (AColor);
915 R = Standard_Real (MyCGroup.ContextFillArea.Front.ColorEms.r);
916 G = Standard_Real (MyCGroup.ContextFillArea.Front.ColorEms.g);
917 B = Standard_Real (MyCGroup.ContextFillArea.Front.ColorEms.b);
918 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
919 Front.SetEmissiveColor (AColor);
921 Front.SetEnvReflexion (MyCGroup.ContextFillArea.Front.EnvReflexion);
929 CTXF->SetHatchStyle(Aspect_HatchStyle (MyCGroup.ContextFillArea.Hatch));
931 // Front and Back face
932 if (MyCGroup.ContextFillArea.Distinguish == 1)
933 CTXF->SetDistinguishOn ();
935 CTXF->SetDistinguishOff ();
936 if (MyCGroup.ContextFillArea.BackFace == 1)
937 CTXF->SuppressBackFace ();
939 CTXF->AllowBackFace ();
941 CTXF->SetTextureMap (MyCGroup.ContextFillArea.Texture.TextureMap);
942 if (MyCGroup.ContextFillArea.Texture.doTextureMap == 1)
944 CTXF->SetTextureMapOn();
948 CTXF->SetTextureMapOff();
950 CTXF->SetShaderProgram (MyCGroup.ContextFillArea.ShaderProgram);
952 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
953 CTXF->SetPolygonOffsets(MyCGroup.ContextFillArea.PolygonOffsetMode,
954 MyCGroup.ContextFillArea.PolygonOffsetFactor,
955 MyCGroup.ContextFillArea.PolygonOffsetUnits);
956 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
961 AStyle = Aspect_InteriorStyle (MyCGroup.Struct->ContextFillArea.Style);
962 R = Standard_Real (MyCGroup.Struct->ContextFillArea.IntColor.r);
963 G = Standard_Real (MyCGroup.Struct->ContextFillArea.IntColor.g);
964 B = Standard_Real (MyCGroup.Struct->ContextFillArea.IntColor.b);
965 AnIntColor.SetValues (R, G, B, Quantity_TOC_RGB);
967 if (MyCGroup.Struct->ContextFillArea.Edge == 1) EdgeOn = Standard_True;
968 R = Standard_Real (MyCGroup.Struct->ContextFillArea.EdgeColor.r);
969 G = Standard_Real (MyCGroup.Struct->ContextFillArea.EdgeColor.g);
970 B = Standard_Real (MyCGroup.Struct->ContextFillArea.EdgeColor.b);
971 AnEdgeColor.SetValues (R, G, B, Quantity_TOC_RGB);
972 ALType = Aspect_TypeOfLine (MyCGroup.Struct->ContextFillArea.LineType);
973 AWidth = Standard_Real (MyCGroup.Struct->ContextFillArea.Width);
976 Standard_Real (MyCGroup.Struct->ContextFillArea.Back.Shininess));
978 Standard_Real (MyCGroup.Struct->ContextFillArea.Back.Ambient));
980 Standard_Real (MyCGroup.Struct->ContextFillArea.Back.Diffuse));
982 Standard_Real (MyCGroup.Struct->ContextFillArea.Back.Specular));
983 Back.SetTransparency (
984 Standard_Real (MyCGroup.Struct->ContextFillArea.Back.Transparency));
986 Standard_Real (MyCGroup.Struct->ContextFillArea.Back.Emission));
987 if (MyCGroup.Struct->ContextFillArea.Back.IsAmbient == 1)
988 Back.SetReflectionModeOn (Graphic3d_TOR_AMBIENT);
990 Back.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
991 if (MyCGroup.Struct->ContextFillArea.Back.IsDiffuse == 1)
992 Back.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE);
994 Back.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
995 if (MyCGroup.Struct->ContextFillArea.Back.IsSpecular == 1)
996 Back.SetReflectionModeOn (Graphic3d_TOR_SPECULAR);
998 Back.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
1000 R = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorSpec.r);
1001 G = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorSpec.g);
1002 B = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorSpec.b);
1003 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
1004 Back.SetSpecularColor (AColor);
1006 R = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorAmb.r);
1007 G = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorAmb.g);
1008 B = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorAmb.b);
1009 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
1010 Back.SetAmbientColor (AColor);
1012 R = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorDif.r);
1013 G = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorDif.g);
1014 B = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorDif.b);
1015 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
1016 Back.SetDiffuseColor (AColor);
1018 R = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorEms.r);
1019 G = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorEms.g);
1020 B = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorEms.b);
1021 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
1022 Back.SetEmissiveColor (AColor);
1024 Back.SetEnvReflexion (MyCGroup.Struct->ContextFillArea.Back.EnvReflexion);
1026 Front.SetShininess (
1027 Standard_Real (MyCGroup.Struct->ContextFillArea.Front.Shininess));
1029 Standard_Real (MyCGroup.Struct->ContextFillArea.Front.Ambient));
1031 Standard_Real (MyCGroup.Struct->ContextFillArea.Front.Diffuse));
1033 Standard_Real (MyCGroup.Struct->ContextFillArea.Front.Specular));
1034 Front.SetTransparency (
1035 Standard_Real (MyCGroup.Struct->ContextFillArea.Front.Transparency));
1037 Standard_Real (MyCGroup.Struct->ContextFillArea.Front.Emission));
1038 if (MyCGroup.Struct->ContextFillArea.Front.IsAmbient == 1)
1039 Front.SetReflectionModeOn (Graphic3d_TOR_AMBIENT);
1041 Front.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
1042 if (MyCGroup.Struct->ContextFillArea.Front.IsDiffuse == 1)
1043 Front.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE);
1045 Front.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
1046 if (MyCGroup.Struct->ContextFillArea.Front.IsSpecular == 1)
1047 Front.SetReflectionModeOn (Graphic3d_TOR_SPECULAR);
1049 Front.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
1051 R = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorSpec.r);
1052 G = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorSpec.g);
1053 B = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorSpec.b);
1054 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
1055 Front.SetSpecularColor (AColor);
1057 R = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorAmb.r);
1058 G = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorAmb.g);
1059 B = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorAmb.b);
1060 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
1061 Front.SetAmbientColor (AColor);
1063 R = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorDif.r);
1064 G = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorDif.g);
1065 B = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorDif.b);
1066 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
1067 Front.SetDiffuseColor (AColor);
1069 R = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorEms.r);
1070 G = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorEms.g);
1071 B = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorEms.b);
1072 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
1073 Front.SetEmissiveColor (AColor);
1075 Front.SetEnvReflexion (MyCGroup.Struct->ContextFillArea.Front.EnvReflexion);
1081 CTXF->SetEdgeOff ();
1083 CTXF->SetHatchStyle(Aspect_HatchStyle (MyCGroup.Struct->ContextFillArea.Hatch));
1085 // Front and Back face
1086 if (MyCGroup.Struct->ContextFillArea.Distinguish == 1)
1087 CTXF->SetDistinguishOn ();
1089 CTXF->SetDistinguishOff ();
1090 if (MyCGroup.Struct->ContextFillArea.BackFace == 1)
1091 CTXF->SuppressBackFace ();
1093 CTXF->AllowBackFace ();
1095 CTXF->SetTextureMap (MyCGroup.Struct->ContextFillArea.Texture.TextureMap);
1096 if (MyCGroup.Struct->ContextFillArea.Texture.doTextureMap == 1)
1098 CTXF->SetTextureMapOn();
1102 CTXF->SetTextureMapOff();
1104 CTXF->SetShaderProgram (MyCGroup.Struct->ContextFillArea.ShaderProgram);
1106 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
1107 CTXF->SetPolygonOffsets(MyCGroup.Struct->ContextFillArea.PolygonOffsetMode,
1108 MyCGroup.Struct->ContextFillArea.PolygonOffsetFactor,
1109 MyCGroup.Struct->ContextFillArea.PolygonOffsetUnits);
1110 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
1112 CTXF->SetInteriorStyle (AStyle);
1113 CTXF->SetInteriorColor (AnIntColor);
1114 CTXF->SetEdgeColor (AnEdgeColor);
1115 CTXF->SetEdgeLineType (ALType);
1116 CTXF->SetEdgeWidth (AWidth);
1117 CTXF->SetBackMaterial (Back);
1118 CTXF->SetFrontMaterial (Front);
1121 void Graphic3d_Group::PrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& CTXL, const Handle(Graphic3d_AspectText3d)& CTXT, const Handle(Graphic3d_AspectMarker3d)& CTXM, const Handle(Graphic3d_AspectFillArea3d)& CTXF) const
1123 GroupPrimitivesAspect (CTXL, CTXT, CTXM, CTXF);