1 // Created by: NW,JPB,CAL
2 // Copyright (c) 1991-1999 Matra Datavision
3 // Copyright (c) 1999-2012 OPEN CASCADE SAS
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.
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.
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.
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 */
30 //-Design Declaration des variables specifiques aux groupes
33 //-Warning Un groupe est defini dans une structure
34 // Il s'agit de la plus petite entite editable
42 #define OCC1174 //SAV 08/01/03 : Added back face interior color controling
46 #include <Graphic3d_Group.jxx>
47 #include <Graphic3d_Group.pxx>
48 #include <Graphic3d_TextureMap.hxx>
52 void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& CTX) {
54 if (IsDeleted ()) return;
56 Standard_Real R, G, B;
58 Quantity_Color AColor;
59 Aspect_TypeOfLine ALType;
61 CTX->Values (AColor, ALType, AWidth);
62 AColor.Values (R, G, B, Quantity_TOC_RGB);
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;
72 MyGraphicDriver->LineContextGroup (MyCGroup, noinsert);
74 MyCGroup.ContextLine.IsSet = 1;
80 void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& CTX) {
82 if (IsDeleted ()) return;
84 Standard_Real R, G, B;
86 //Quantity_Color AColor;
87 Quantity_Color AIntColor;
88 Quantity_Color BackIntColor;
89 Quantity_Color AEdgeColor;
90 Aspect_TypeOfLine ALType;
91 Aspect_InteriorStyle AStyle;
93 CTX->Values (AStyle, AIntColor, BackIntColor, AEdgeColor, ALType, AWidth);
94 AIntColor.Values (R, G, B, Quantity_TOC_RGB);
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);
102 if ( CTX->Distinguish() )
103 BackIntColor.Values( R, G, B, Quantity_TOC_RGB );
105 MyCGroup.ContextFillArea.BackIntColor.r = float( R );
106 MyCGroup.ContextFillArea.BackIntColor.g = float( G );
107 MyCGroup.ContextFillArea.BackIntColor.b = float( B );
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 ());
118 /*** Front and Back face ***/
119 MyCGroup.ContextFillArea.Distinguish =
120 ( CTX->Distinguish () ? 1 : 0 );
121 MyCGroup.ContextFillArea.BackFace =
122 ( CTX->BackFace () ? 1 : 0 );
124 /*** Back Material ***/
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 ());
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 );
155 const Graphic3d_MaterialAspect ama = CTX->BackMaterial () ;
156 Standard_Boolean amt = ama.MaterialType(Graphic3d_MATERIAL_PHYSIC) ;
157 MyCGroup.ContextFillArea.Back.IsPhysic = ( amt ? 1 : 0 );
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 ());
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 ());
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 ());
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 ());
192 MyCGroup.ContextFillArea.Back.EnvReflexion =
193 float ((CTX->BackMaterial ()).EnvReflexion());
195 /*** Front Material ***/
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 ());
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 );
226 const Graphic3d_MaterialAspect amas = CTX->FrontMaterial () ;
227 Standard_Boolean amty = amas.MaterialType(Graphic3d_MATERIAL_PHYSIC) ;
228 MyCGroup.ContextFillArea.Front.IsPhysic = ( amty ? 1 : 0 );
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 ());
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 ());
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 ());
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 ());
262 MyCGroup.ContextFillArea.Front.EnvReflexion =
263 float ((CTX->FrontMaterial ()).EnvReflexion());
265 MyCGroup.ContextFillArea.IsDef = 1; // Definition material ok
267 /*** Texture map ***/
268 MyCGroup.ContextFillArea.Texture.TextureMap = CTX->TextureMap();
269 MyCGroup.ContextFillArea.Texture.doTextureMap = CTX->TextureMapState() ? 1 : 0;
271 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
272 Standard_Integer aPolyMode;
273 Standard_ShortReal aPolyFactor, aPolyUnits;
274 CTX->PolygonOffsets(aPolyMode, aPolyFactor, aPolyUnits);
275 MyCGroup.ContextFillArea.PolygonOffsetMode = aPolyMode;
276 MyCGroup.ContextFillArea.PolygonOffsetFactor = aPolyFactor;
277 MyCGroup.ContextFillArea.PolygonOffsetUnits = aPolyUnits;
278 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
281 MyGraphicDriver->FaceContextGroup (MyCGroup, noinsert);
283 MyCGroup.ContextFillArea.IsSet = 1;
289 void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& CTX) {
291 if (IsDeleted ()) return;
293 Standard_Real R, G, B;
294 Standard_Real AScale;
295 Quantity_Color AColor;
296 Aspect_TypeOfMarker AMType;
298 CTX->Values (AColor, AMType, AScale);
299 AColor.Values (R, G, B, Quantity_TOC_RGB);
301 MyCGroup.ContextMarker.Color.r = float (R);
302 MyCGroup.ContextMarker.Color.g = float (G);
303 MyCGroup.ContextMarker.Color.b = float (B);
304 MyCGroup.ContextMarker.MarkerType = int (AMType);
305 MyCGroup.ContextMarker.Scale = float (AScale);
306 MyCGroup.ContextMarker.IsDef = 1;
309 if ( AMType == Aspect_TOM_USERDEFINED )
311 CTX->GetTextureSize( MyMarkWidth, MyMarkHeight );
312 MyMarkArray = CTX->GetTexture();
313 MyGraphicDriver->MarkerContextGroup (MyCGroup, noinsert, MyMarkWidth, MyMarkHeight, MyMarkArray);
316 MyGraphicDriver->MarkerContextGroup (MyCGroup, noinsert);
318 MyCGroup.ContextMarker.IsSet = 1;
324 void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& CTX) {
326 if (IsDeleted ()) return;
328 Standard_CString AFont;
329 Standard_Real R, G, B;
330 Standard_Real Rs, Gs, Bs;
331 Standard_Real ASpace;
332 Standard_Real AnExpansion;
333 Quantity_Color AColor;
334 Aspect_TypeOfStyleText AStyle;
335 Aspect_TypeOfDisplayText ADisplayType;
336 Quantity_Color AColorSubTitle;
337 Standard_Boolean ATextZoomable;
338 Standard_Real ATextAngle;
339 Font_FontAspect ATextFontAspect;
341 CTX->Values (AColor, AFont, AnExpansion, ASpace, AStyle, ADisplayType,AColorSubTitle,ATextZoomable,ATextAngle,ATextFontAspect);
342 AColor.Values (R, G, B, Quantity_TOC_RGB);
343 AColorSubTitle.Values (Rs, Gs, Bs, Quantity_TOC_RGB);
345 MyCGroup.ContextText.Color.r = float (R);
346 MyCGroup.ContextText.Color.g = float (G);
347 MyCGroup.ContextText.Color.b = float (B);
348 MyCGroup.ContextText.Font = (char*)AFont;
349 MyCGroup.ContextText.Expan = float (AnExpansion);
350 MyCGroup.ContextText.Space = float (ASpace);
351 MyCGroup.ContextText.Style = int (AStyle);
352 MyCGroup.ContextText.DisplayType= int (ADisplayType);
353 MyCGroup.ContextText.ColorSubTitle.r = float (Rs);
354 MyCGroup.ContextText.ColorSubTitle.g = float (Gs);
355 MyCGroup.ContextText.ColorSubTitle.b = float (Bs);
356 MyCGroup.ContextText.TextZoomable = ATextZoomable;
357 MyCGroup.ContextText.TextAngle = float (ATextAngle);
358 MyCGroup.ContextText.TextFontAspect = (int)ATextFontAspect;
360 MyCGroup.ContextText.IsDef = 1;
363 MyGraphicDriver->TextContextGroup (MyCGroup, noinsert);
365 MyCGroup.ContextText.IsSet = 1;
371 void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& CTX) {
373 if (IsDeleted ()) return;
375 Standard_Real R, G, B;
376 Standard_Real AWidth;
377 Quantity_Color AColor;
378 Aspect_TypeOfLine ALType;
380 CTX->Values (AColor, ALType, AWidth);
381 AColor.Values (R, G, B, Quantity_TOC_RGB);
383 MyCGroup.ContextLine.Color.r = float (R);
384 MyCGroup.ContextLine.Color.g = float (G);
385 MyCGroup.ContextLine.Color.b = float (B);
386 MyCGroup.ContextLine.LineType = int (ALType);
387 MyCGroup.ContextLine.Width = float (AWidth);
388 MyCGroup.ContextLine.IsDef = 1;
391 MyGraphicDriver->LineContextGroup (MyCGroup, noinsert);
393 MyCGroup.ContextLine.IsSet = 1;
399 void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& CTX) {
401 if (IsDeleted ()) return;
403 Standard_Real R, G, B;
404 Standard_Real AWidth;
405 Quantity_Color AIntColor;
406 Quantity_Color BackIntColor;
407 Quantity_Color AEdgeColor;
408 Aspect_TypeOfLine ALType;
409 Aspect_InteriorStyle AStyle;
411 CTX->Values (AStyle, AIntColor, BackIntColor, AEdgeColor, ALType, AWidth);
412 AIntColor.Values (R, G, B, Quantity_TOC_RGB);
414 MyCGroup.ContextFillArea.Style = int (AStyle);
415 MyCGroup.ContextFillArea.IntColor.r = float (R);
416 MyCGroup.ContextFillArea.IntColor.g = float (G);
417 MyCGroup.ContextFillArea.IntColor.b = float (B);
419 if ( CTX->Distinguish() )
420 BackIntColor.Values( R, G, B, Quantity_TOC_RGB );
422 MyCGroup.ContextFillArea.BackIntColor.r = float( R );
423 MyCGroup.ContextFillArea.BackIntColor.g = float( G );
424 MyCGroup.ContextFillArea.BackIntColor.b = float( B );
426 MyCGroup.ContextFillArea.Edge = (CTX->Edge () ? 1 : 0);
427 AEdgeColor.Values (R, G, B, Quantity_TOC_RGB);
428 MyCGroup.ContextFillArea.EdgeColor.r = float (R);
429 MyCGroup.ContextFillArea.EdgeColor.g = float (G);
430 MyCGroup.ContextFillArea.EdgeColor.b = float (B);
431 MyCGroup.ContextFillArea.LineType = int (ALType);
432 MyCGroup.ContextFillArea.Width = float (AWidth);
433 MyCGroup.ContextFillArea.Hatch = int (CTX->HatchStyle ());
434 // Front and Back face
435 MyCGroup.ContextFillArea.Distinguish =
436 ( CTX->Distinguish () ? 1 : 0 );
437 MyCGroup.ContextFillArea.BackFace =
438 ( CTX->BackFace () ? 1 : 0 );
440 /*** Back Material ***/
442 MyCGroup.ContextFillArea.Back.Shininess =
443 float ((CTX->BackMaterial ()).Shininess ());
444 MyCGroup.ContextFillArea.Back.Ambient =
445 float ((CTX->BackMaterial ()).Ambient ());
446 MyCGroup.ContextFillArea.Back.Diffuse =
447 float ((CTX->BackMaterial ()).Diffuse ());
448 MyCGroup.ContextFillArea.Back.Specular =
449 float ((CTX->BackMaterial ()).Specular ());
450 MyCGroup.ContextFillArea.Back.Transparency =
451 float ((CTX->BackMaterial ()).Transparency ());
452 MyCGroup.ContextFillArea.Back.Emission =
453 float ((CTX->BackMaterial ()).Emissive ());
456 MyCGroup.ContextFillArea.Back.IsAmbient =
457 ( (CTX->BackMaterial ()).ReflectionMode
458 (Graphic3d_TOR_AMBIENT) ? 1 : 0 );
459 MyCGroup.ContextFillArea.Back.IsDiffuse =
460 ( (CTX->BackMaterial ()).ReflectionMode
461 (Graphic3d_TOR_DIFFUSE) ? 1 : 0 );
462 MyCGroup.ContextFillArea.Back.IsSpecular =
463 ( (CTX->BackMaterial ()).ReflectionMode
464 (Graphic3d_TOR_SPECULAR) ? 1 : 0 );
465 MyCGroup.ContextFillArea.Back.IsEmission =
466 ( (CTX->BackMaterial ()).ReflectionMode
467 (Graphic3d_TOR_EMISSION) ? 1 : 0 );
471 const Graphic3d_MaterialAspect ama = CTX->BackMaterial () ;
472 Standard_Boolean amt = ama.MaterialType(Graphic3d_MATERIAL_PHYSIC) ;
473 MyCGroup.ContextFillArea.Back.IsPhysic = ( amt ? 1 : 0 );
476 MyCGroup.ContextFillArea.Back.ColorSpec.r =
477 float (((CTX->BackMaterial ()).SpecularColor ()).Red ());
478 MyCGroup.ContextFillArea.Back.ColorSpec.g =
479 float (((CTX->BackMaterial ()).SpecularColor ()).Green ());
480 MyCGroup.ContextFillArea.Back.ColorSpec.b =
481 float (((CTX->BackMaterial ()).SpecularColor ()).Blue ());
484 MyCGroup.ContextFillArea.Back.ColorAmb.r =
485 float (((CTX->BackMaterial ()).AmbientColor ()).Red ());
486 MyCGroup.ContextFillArea.Back.ColorAmb.g =
487 float (((CTX->BackMaterial ()).AmbientColor ()).Green ());
488 MyCGroup.ContextFillArea.Back.ColorAmb.b =
489 float (((CTX->BackMaterial ()).AmbientColor ()).Blue ());
492 MyCGroup.ContextFillArea.Back.ColorDif.r =
493 float (((CTX->BackMaterial ()).DiffuseColor ()).Red ());
494 MyCGroup.ContextFillArea.Back.ColorDif.g =
495 float (((CTX->BackMaterial ()).DiffuseColor ()).Green ());
496 MyCGroup.ContextFillArea.Back.ColorDif.b =
497 float (((CTX->BackMaterial ()).DiffuseColor ()).Blue ());
500 MyCGroup.ContextFillArea.Back.ColorEms.r =
501 float (((CTX->BackMaterial ()).EmissiveColor ()).Red ());
502 MyCGroup.ContextFillArea.Back.ColorEms.g =
503 float (((CTX->BackMaterial ()).EmissiveColor ()).Green ());
504 MyCGroup.ContextFillArea.Back.ColorEms.b =
505 float (((CTX->BackMaterial ()).EmissiveColor ()).Blue ());
507 MyCGroup.ContextFillArea.Back.EnvReflexion =
508 float ((CTX->BackMaterial ()).EnvReflexion());
510 /*** Front Material ***/
512 MyCGroup.ContextFillArea.Front.Shininess =
513 float ((CTX->FrontMaterial ()).Shininess ());
514 MyCGroup.ContextFillArea.Front.Ambient =
515 float ((CTX->FrontMaterial ()).Ambient ());
516 MyCGroup.ContextFillArea.Front.Diffuse =
517 float ((CTX->FrontMaterial ()).Diffuse ());
518 MyCGroup.ContextFillArea.Front.Specular =
519 float ((CTX->FrontMaterial ()).Specular ());
520 MyCGroup.ContextFillArea.Front.Transparency =
521 float ((CTX->FrontMaterial ()).Transparency ());
522 MyCGroup.ContextFillArea.Front.Emission =
523 float ((CTX->FrontMaterial ()).Emissive ());
526 MyCGroup.ContextFillArea.Front.IsAmbient =
527 ( (CTX->FrontMaterial ()).ReflectionMode
528 (Graphic3d_TOR_AMBIENT) ? 1 : 0 );
529 MyCGroup.ContextFillArea.Front.IsDiffuse =
530 ( (CTX->FrontMaterial ()).ReflectionMode
531 (Graphic3d_TOR_DIFFUSE) ? 1 : 0 );
532 MyCGroup.ContextFillArea.Front.IsSpecular =
533 ( (CTX->FrontMaterial ()).ReflectionMode
534 (Graphic3d_TOR_SPECULAR) ? 1 : 0 );
535 MyCGroup.ContextFillArea.Front.IsEmission =
536 ( (CTX->FrontMaterial ()).ReflectionMode
537 (Graphic3d_TOR_EMISSION) ? 1 : 0 );
541 const Graphic3d_MaterialAspect amas = CTX->FrontMaterial () ;
542 Standard_Boolean amty = amas.MaterialType(Graphic3d_MATERIAL_PHYSIC) ;
543 MyCGroup.ContextFillArea.Front.IsPhysic = ( amty ? 1 : 0 );
546 MyCGroup.ContextFillArea.Front.ColorSpec.r =
547 float (((CTX->FrontMaterial ()).SpecularColor ()).Red ());
548 MyCGroup.ContextFillArea.Front.ColorSpec.g =
549 float (((CTX->FrontMaterial ()).SpecularColor ()).Green ());
550 MyCGroup.ContextFillArea.Front.ColorSpec.b =
551 float (((CTX->FrontMaterial ()).SpecularColor ()).Blue ());
554 MyCGroup.ContextFillArea.Front.ColorAmb.r =
555 float (((CTX->FrontMaterial ()).AmbientColor ()).Red ());
556 MyCGroup.ContextFillArea.Front.ColorAmb.g =
557 float (((CTX->FrontMaterial ()).AmbientColor ()).Green ());
558 MyCGroup.ContextFillArea.Front.ColorAmb.b =
559 float (((CTX->FrontMaterial ()).AmbientColor ()).Blue ());
562 MyCGroup.ContextFillArea.Front.ColorDif.r =
563 float (((CTX->FrontMaterial ()).DiffuseColor ()).Red ());
564 MyCGroup.ContextFillArea.Front.ColorDif.g =
565 float (((CTX->FrontMaterial ()).DiffuseColor ()).Green ());
566 MyCGroup.ContextFillArea.Front.ColorDif.b =
567 float (((CTX->FrontMaterial ()).DiffuseColor ()).Blue ());
570 MyCGroup.ContextFillArea.Front.ColorEms.r =
571 float (((CTX->FrontMaterial ()).EmissiveColor ()).Red ());
572 MyCGroup.ContextFillArea.Front.ColorEms.g =
573 float (((CTX->FrontMaterial ()).EmissiveColor ()).Green ());
574 MyCGroup.ContextFillArea.Front.ColorEms.b =
575 float (((CTX->FrontMaterial ()).EmissiveColor ()).Blue ());
577 MyCGroup.ContextFillArea.Front.EnvReflexion =
578 float ((CTX->FrontMaterial ()).EnvReflexion());
580 MyCGroup.ContextFillArea.IsDef = 1; // Material definition ok
582 MyCGroup.ContextFillArea.Texture.TextureMap = CTX->TextureMap();
583 MyCGroup.ContextFillArea.Texture.doTextureMap = CTX->TextureMapState() ? 1 : 0;
585 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
586 Standard_Integer aPolyMode;
587 Standard_ShortReal aPolyFactor, aPolyUnits;
588 CTX->PolygonOffsets(aPolyMode, aPolyFactor, aPolyUnits);
589 MyCGroup.ContextFillArea.PolygonOffsetMode = aPolyMode;
590 MyCGroup.ContextFillArea.PolygonOffsetFactor = (Standard_ShortReal)aPolyFactor;
591 MyCGroup.ContextFillArea.PolygonOffsetUnits = (Standard_ShortReal)aPolyUnits;
592 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
595 MyGraphicDriver->FaceContextGroup (MyCGroup, noinsert);
597 MyCGroup.ContextFillArea.IsSet = 1;
603 void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& CTX) {
605 if (IsDeleted ()) return;
607 Standard_Real R, G, B;
608 Standard_Real AScale;
609 Quantity_Color AColor;
610 Aspect_TypeOfMarker AMType;
612 CTX->Values (AColor, AMType, AScale);
613 AColor.Values (R, G, B, Quantity_TOC_RGB);
615 MyCGroup.ContextMarker.Color.r = float (R);
616 MyCGroup.ContextMarker.Color.g = float (G);
617 MyCGroup.ContextMarker.Color.b = float (B);
618 MyCGroup.ContextMarker.MarkerType = int (AMType);
619 MyCGroup.ContextMarker.Scale = float (AScale);
620 MyCGroup.ContextMarker.IsDef = 1;
623 if ( AMType == Aspect_TOM_USERDEFINED )
625 CTX->GetTextureSize( MyMarkWidth, MyMarkHeight );
626 MyMarkArray = CTX->GetTexture();
627 MyGraphicDriver->MarkerContextGroup (MyCGroup, noinsert, MyMarkWidth, MyMarkHeight, MyMarkArray);
630 MyGraphicDriver->MarkerContextGroup (MyCGroup, noinsert);
632 MyCGroup.ContextMarker.IsSet = 1;
638 void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& CTX) {
640 if (IsDeleted ()) return;
642 Standard_CString AFont;
643 Standard_Real R, G, B;
644 Standard_Real Rs, Gs, Bs;
645 Standard_Real ASpace;
646 Standard_Real AnExpansion;
647 Quantity_Color AColor;
648 Aspect_TypeOfStyleText AStyle;
649 Aspect_TypeOfDisplayText ADisplayType;
650 Quantity_Color AColorSubTitle;
651 Standard_Boolean ATextZoomable;
652 Standard_Real ATextAngle;
653 Font_FontAspect ATextFontAspect;
655 CTX->Values (AColor, AFont, AnExpansion, ASpace, AStyle, ADisplayType,AColorSubTitle,ATextZoomable,ATextAngle,ATextFontAspect);
656 AColor.Values (R, G, B, Quantity_TOC_RGB);
657 AColorSubTitle.Values (Rs, Gs, Bs, Quantity_TOC_RGB);
659 MyCGroup.ContextText.Color.r = float (R);
660 MyCGroup.ContextText.Color.g = float (G);
661 MyCGroup.ContextText.Color.b = float (B);
662 MyCGroup.ContextText.Font = (char*)AFont;
663 MyCGroup.ContextText.Expan = float (AnExpansion);
664 MyCGroup.ContextText.Space = float (ASpace);
665 MyCGroup.ContextText.Style = int (AStyle);
666 MyCGroup.ContextText.DisplayType= int (ADisplayType);
667 MyCGroup.ContextText.ColorSubTitle.r = float (Rs);
668 MyCGroup.ContextText.ColorSubTitle.g = float (Gs);
669 MyCGroup.ContextText.ColorSubTitle.b = float (Bs);
670 MyCGroup.ContextText.TextZoomable = ATextZoomable;
671 MyCGroup.ContextText.TextAngle = float (ATextAngle);
672 MyCGroup.ContextText.TextFontAspect = (int)ATextFontAspect;
673 MyCGroup.ContextText.IsDef = 1;
676 MyGraphicDriver->TextContextGroup (MyCGroup, noinsert);
678 MyCGroup.ContextText.IsSet = 1;
684 Standard_Boolean Graphic3d_Group::IsGroupPrimitivesAspectSet (const Graphic3d_GroupAspect theAspect) const {
686 case Graphic3d_ASPECT_LINE: return MyCGroup.ContextLine.IsSet;
687 case Graphic3d_ASPECT_TEXT: return MyCGroup.ContextText.IsSet;
688 case Graphic3d_ASPECT_MARKER: return MyCGroup.ContextMarker.IsSet;
689 case Graphic3d_ASPECT_FILL_AREA: return MyCGroup.ContextFillArea.IsSet;
690 default: return Standard_False;
695 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 {
697 Standard_Real R, G, B;
698 Standard_Real Rs, Gs, Bs;
699 Quantity_Color AColor;
701 Standard_Real AWidth;
702 Aspect_TypeOfLine ALType;
704 Standard_CString AFont;
705 Standard_Real ASpace;
706 Standard_Real AnExpansion;
708 Standard_Real AScale;
709 Aspect_TypeOfMarker AMType;
711 Quantity_Color AnIntColor;
712 Quantity_Color AnEdgeColor;
713 Aspect_InteriorStyle AStyle;
714 Standard_Boolean EdgeOn = Standard_False;
715 Graphic3d_MaterialAspect Front;
716 Graphic3d_MaterialAspect Back;
717 Aspect_TypeOfStyleText AStyleT;
718 Aspect_TypeOfDisplayText ADisplayType;
719 Quantity_Color AColorSubTitle;
721 if (MyCGroup.ContextLine.IsSet) {
722 R = Standard_Real (MyCGroup.ContextLine.Color.r);
723 G = Standard_Real (MyCGroup.ContextLine.Color.g);
724 B = Standard_Real (MyCGroup.ContextLine.Color.b);
725 ALType = Aspect_TypeOfLine (MyCGroup.ContextLine.LineType);
726 AWidth = Standard_Real (MyCGroup.ContextLine.Width);
729 R = Standard_Real (MyCGroup.Struct->ContextLine.Color.r);
730 G = Standard_Real (MyCGroup.Struct->ContextLine.Color.g);
731 B = Standard_Real (MyCGroup.Struct->ContextLine.Color.b);
732 ALType = Aspect_TypeOfLine (MyCGroup.Struct->ContextLine.LineType);
733 AWidth = Standard_Real (MyCGroup.Struct->ContextLine.Width);
735 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
736 CTXL->SetColor (AColor);
737 CTXL->SetType (ALType);
738 CTXL->SetWidth (AWidth);
740 if (MyCGroup.ContextText.IsSet) {
741 R = Standard_Real (MyCGroup.ContextText.Color.r);
742 G = Standard_Real (MyCGroup.ContextText.Color.g);
743 B = Standard_Real (MyCGroup.ContextText.Color.b);
744 Rs = Standard_Real (MyCGroup.ContextText.ColorSubTitle.r);
745 Gs = Standard_Real (MyCGroup.ContextText.ColorSubTitle.g);
746 Bs = Standard_Real (MyCGroup.ContextText.ColorSubTitle.b);
747 AFont = Standard_CString (MyCGroup.ContextText.Font);
748 AnExpansion = Standard_Real (MyCGroup.ContextText.Expan);
749 ASpace = Standard_Real (MyCGroup.ContextText.Space);
750 AStyleT = Aspect_TypeOfStyleText (MyCGroup.ContextText.Style);
751 ADisplayType= Aspect_TypeOfDisplayText (MyCGroup.ContextText.DisplayType);
754 R = Standard_Real (MyCGroup.Struct->ContextText.Color.r);
755 G = Standard_Real (MyCGroup.Struct->ContextText.Color.g);
756 B = Standard_Real (MyCGroup.Struct->ContextText.Color.b);
757 Rs = Standard_Real (MyCGroup.Struct->ContextText.ColorSubTitle.r);
758 Gs = Standard_Real (MyCGroup.Struct->ContextText.ColorSubTitle.g);
759 Bs = Standard_Real (MyCGroup.Struct->ContextText.ColorSubTitle.b);
760 AFont = Standard_CString (MyCGroup.Struct->ContextText.Font);
761 AnExpansion = Standard_Real (MyCGroup.Struct->ContextText.Expan);
762 ASpace = Standard_Real (MyCGroup.Struct->ContextText.Space);
763 AStyleT = Aspect_TypeOfStyleText (MyCGroup.Struct->ContextText.Style);
764 ADisplayType= Aspect_TypeOfDisplayText (MyCGroup.Struct->ContextText.DisplayType);
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) {
777 R = Standard_Real (MyCGroup.ContextMarker.Color.r);
778 G = Standard_Real (MyCGroup.ContextMarker.Color.g);
779 B = Standard_Real (MyCGroup.ContextMarker.Color.b);
780 AMType = Aspect_TypeOfMarker (MyCGroup.ContextMarker.MarkerType);
781 AScale = Standard_Real (MyCGroup.ContextMarker.Scale);
782 if( AMType == Aspect_TOM_USERDEFINED )
785 CTXM->SetTexture( MyMarkWidth, MyMarkHeight, MyMarkArray );
789 R = Standard_Real (MyCGroup.Struct->ContextMarker.Color.r);
790 G = Standard_Real (MyCGroup.Struct->ContextMarker.Color.g);
791 B = Standard_Real (MyCGroup.Struct->ContextMarker.Color.b);
792 AMType = Aspect_TypeOfMarker (MyCGroup.Struct->ContextMarker.MarkerType);
793 AScale = Standard_Real (MyCGroup.Struct->ContextMarker.Scale);
795 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
796 CTXM->SetColor (AColor);
797 CTXM->SetType (AMType);
798 CTXM->SetScale (AScale);
800 if (MyCGroup.ContextFillArea.IsSet) {
802 AStyle = Aspect_InteriorStyle (MyCGroup.ContextFillArea.Style);
803 R = Standard_Real (MyCGroup.ContextFillArea.IntColor.r);
804 G = Standard_Real (MyCGroup.ContextFillArea.IntColor.g);
805 B = Standard_Real (MyCGroup.ContextFillArea.IntColor.b);
806 AnIntColor.SetValues (R, G, B, Quantity_TOC_RGB);
808 if (MyCGroup.ContextFillArea.Edge == 1) EdgeOn = Standard_True;
809 R = Standard_Real (MyCGroup.ContextFillArea.EdgeColor.r);
810 G = Standard_Real (MyCGroup.ContextFillArea.EdgeColor.g);
811 B = Standard_Real (MyCGroup.ContextFillArea.EdgeColor.b);
812 AnEdgeColor.SetValues (R, G, B, Quantity_TOC_RGB);
813 ALType = Aspect_TypeOfLine (MyCGroup.ContextFillArea.LineType);
814 AWidth = Standard_Real (MyCGroup.ContextFillArea.Width);
817 Standard_Real (MyCGroup.ContextFillArea.Back.Shininess));
819 Standard_Real (MyCGroup.ContextFillArea.Back.Ambient));
821 Standard_Real (MyCGroup.ContextFillArea.Back.Diffuse));
823 Standard_Real (MyCGroup.ContextFillArea.Back.Specular));
824 Back.SetTransparency (
825 Standard_Real (MyCGroup.ContextFillArea.Back.Transparency));
827 Standard_Real (MyCGroup.ContextFillArea.Back.Emission));
828 if (MyCGroup.ContextFillArea.Back.IsAmbient == 1)
829 Back.SetReflectionModeOn (Graphic3d_TOR_AMBIENT);
831 Back.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
832 if (MyCGroup.ContextFillArea.Back.IsDiffuse == 1)
833 Back.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE);
835 Back.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
836 if (MyCGroup.ContextFillArea.Back.IsSpecular == 1)
837 Back.SetReflectionModeOn (Graphic3d_TOR_SPECULAR);
839 Back.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
841 R = Standard_Real (MyCGroup.ContextFillArea.Back.ColorSpec.r);
842 G = Standard_Real (MyCGroup.ContextFillArea.Back.ColorSpec.g);
843 B = Standard_Real (MyCGroup.ContextFillArea.Back.ColorSpec.b);
844 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
845 Back.SetSpecularColor (AColor);
847 R = Standard_Real (MyCGroup.ContextFillArea.Back.ColorAmb.r);
848 G = Standard_Real (MyCGroup.ContextFillArea.Back.ColorAmb.g);
849 B = Standard_Real (MyCGroup.ContextFillArea.Back.ColorAmb.b);
850 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
851 Back.SetAmbientColor (AColor);
853 R = Standard_Real (MyCGroup.ContextFillArea.Back.ColorDif.r);
854 G = Standard_Real (MyCGroup.ContextFillArea.Back.ColorDif.g);
855 B = Standard_Real (MyCGroup.ContextFillArea.Back.ColorDif.b);
856 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
857 Back.SetDiffuseColor (AColor);
859 R = Standard_Real (MyCGroup.ContextFillArea.Back.ColorEms.r);
860 G = Standard_Real (MyCGroup.ContextFillArea.Back.ColorEms.g);
861 B = Standard_Real (MyCGroup.ContextFillArea.Back.ColorEms.b);
862 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
863 Back.SetEmissiveColor (AColor);
865 Back.SetEnvReflexion (MyCGroup.ContextFillArea.Back.EnvReflexion);
868 Standard_Real (MyCGroup.ContextFillArea.Front.Shininess));
870 Standard_Real (MyCGroup.ContextFillArea.Front.Ambient));
872 Standard_Real (MyCGroup.ContextFillArea.Front.Diffuse));
874 Standard_Real (MyCGroup.ContextFillArea.Front.Specular));
875 Front.SetTransparency (
876 Standard_Real (MyCGroup.ContextFillArea.Front.Transparency));
878 Standard_Real (MyCGroup.ContextFillArea.Back.Emission));
879 if (MyCGroup.ContextFillArea.Front.IsAmbient == 1)
880 Front.SetReflectionModeOn (Graphic3d_TOR_AMBIENT);
882 Front.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
883 if (MyCGroup.ContextFillArea.Front.IsDiffuse == 1)
884 Front.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE);
886 Front.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
887 if (MyCGroup.ContextFillArea.Front.IsSpecular == 1)
888 Front.SetReflectionModeOn (Graphic3d_TOR_SPECULAR);
890 Front.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
892 R = Standard_Real (MyCGroup.ContextFillArea.Front.ColorSpec.r);
893 G = Standard_Real (MyCGroup.ContextFillArea.Front.ColorSpec.g);
894 B = Standard_Real (MyCGroup.ContextFillArea.Front.ColorSpec.b);
895 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
896 Front.SetSpecularColor (AColor);
898 R = Standard_Real (MyCGroup.ContextFillArea.Front.ColorAmb.r);
899 G = Standard_Real (MyCGroup.ContextFillArea.Front.ColorAmb.g);
900 B = Standard_Real (MyCGroup.ContextFillArea.Front.ColorAmb.b);
901 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
902 Front.SetAmbientColor (AColor);
904 R = Standard_Real (MyCGroup.ContextFillArea.Front.ColorDif.r);
905 G = Standard_Real (MyCGroup.ContextFillArea.Front.ColorDif.g);
906 B = Standard_Real (MyCGroup.ContextFillArea.Front.ColorDif.b);
907 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
908 Front.SetDiffuseColor (AColor);
910 R = Standard_Real (MyCGroup.ContextFillArea.Front.ColorEms.r);
911 G = Standard_Real (MyCGroup.ContextFillArea.Front.ColorEms.g);
912 B = Standard_Real (MyCGroup.ContextFillArea.Front.ColorEms.b);
913 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
914 Front.SetEmissiveColor (AColor);
916 Front.SetEnvReflexion (MyCGroup.ContextFillArea.Front.EnvReflexion);
924 CTXF->SetHatchStyle(Aspect_HatchStyle (MyCGroup.ContextFillArea.Hatch));
926 // Front and Back face
927 if (MyCGroup.ContextFillArea.Distinguish == 1)
928 CTXF->SetDistinguishOn ();
930 CTXF->SetDistinguishOff ();
931 if (MyCGroup.ContextFillArea.BackFace == 1)
932 CTXF->SuppressBackFace ();
934 CTXF->AllowBackFace ();
936 CTXF->SetTextureMap (MyCGroup.ContextFillArea.Texture.TextureMap);
937 if (MyCGroup.ContextFillArea.Texture.doTextureMap == 1)
939 CTXF->SetTextureMapOn();
943 CTXF->SetTextureMapOff();
946 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
947 CTXF->SetPolygonOffsets(MyCGroup.ContextFillArea.PolygonOffsetMode,
948 MyCGroup.ContextFillArea.PolygonOffsetFactor,
949 MyCGroup.ContextFillArea.PolygonOffsetUnits);
950 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
954 AStyle = Aspect_InteriorStyle (MyCGroup.Struct->ContextFillArea.Style);
955 R = Standard_Real (MyCGroup.Struct->ContextFillArea.IntColor.r);
956 G = Standard_Real (MyCGroup.Struct->ContextFillArea.IntColor.g);
957 B = Standard_Real (MyCGroup.Struct->ContextFillArea.IntColor.b);
958 AnIntColor.SetValues (R, G, B, Quantity_TOC_RGB);
960 if (MyCGroup.Struct->ContextFillArea.Edge == 1) EdgeOn = Standard_True;
961 R = Standard_Real (MyCGroup.Struct->ContextFillArea.EdgeColor.r);
962 G = Standard_Real (MyCGroup.Struct->ContextFillArea.EdgeColor.g);
963 B = Standard_Real (MyCGroup.Struct->ContextFillArea.EdgeColor.b);
964 AnEdgeColor.SetValues (R, G, B, Quantity_TOC_RGB);
965 ALType = Aspect_TypeOfLine (MyCGroup.Struct->ContextFillArea.LineType);
966 AWidth = Standard_Real (MyCGroup.Struct->ContextFillArea.Width);
969 Standard_Real (MyCGroup.Struct->ContextFillArea.Back.Shininess));
971 Standard_Real (MyCGroup.Struct->ContextFillArea.Back.Ambient));
973 Standard_Real (MyCGroup.Struct->ContextFillArea.Back.Diffuse));
975 Standard_Real (MyCGroup.Struct->ContextFillArea.Back.Specular));
976 Back.SetTransparency (
977 Standard_Real (MyCGroup.Struct->ContextFillArea.Back.Transparency));
979 Standard_Real (MyCGroup.Struct->ContextFillArea.Back.Emission));
980 if (MyCGroup.Struct->ContextFillArea.Back.IsAmbient == 1)
981 Back.SetReflectionModeOn (Graphic3d_TOR_AMBIENT);
983 Back.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
984 if (MyCGroup.Struct->ContextFillArea.Back.IsDiffuse == 1)
985 Back.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE);
987 Back.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
988 if (MyCGroup.Struct->ContextFillArea.Back.IsSpecular == 1)
989 Back.SetReflectionModeOn (Graphic3d_TOR_SPECULAR);
991 Back.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
993 R = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorSpec.r);
994 G = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorSpec.g);
995 B = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorSpec.b);
996 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
997 Back.SetSpecularColor (AColor);
999 R = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorAmb.r);
1000 G = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorAmb.g);
1001 B = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorAmb.b);
1002 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
1003 Back.SetAmbientColor (AColor);
1005 R = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorDif.r);
1006 G = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorDif.g);
1007 B = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorDif.b);
1008 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
1009 Back.SetDiffuseColor (AColor);
1011 R = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorEms.r);
1012 G = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorEms.g);
1013 B = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorEms.b);
1014 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
1015 Back.SetEmissiveColor (AColor);
1017 Back.SetEnvReflexion (MyCGroup.Struct->ContextFillArea.Back.EnvReflexion);
1019 Front.SetShininess (
1020 Standard_Real (MyCGroup.Struct->ContextFillArea.Front.Shininess));
1022 Standard_Real (MyCGroup.Struct->ContextFillArea.Front.Ambient));
1024 Standard_Real (MyCGroup.Struct->ContextFillArea.Front.Diffuse));
1026 Standard_Real (MyCGroup.Struct->ContextFillArea.Front.Specular));
1027 Front.SetTransparency (
1028 Standard_Real (MyCGroup.Struct->ContextFillArea.Front.Transparency));
1030 Standard_Real (MyCGroup.Struct->ContextFillArea.Front.Emission));
1031 if (MyCGroup.Struct->ContextFillArea.Front.IsAmbient == 1)
1032 Front.SetReflectionModeOn (Graphic3d_TOR_AMBIENT);
1034 Front.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
1035 if (MyCGroup.Struct->ContextFillArea.Front.IsDiffuse == 1)
1036 Front.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE);
1038 Front.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
1039 if (MyCGroup.Struct->ContextFillArea.Front.IsSpecular == 1)
1040 Front.SetReflectionModeOn (Graphic3d_TOR_SPECULAR);
1042 Front.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
1044 R = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorSpec.r);
1045 G = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorSpec.g);
1046 B = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorSpec.b);
1047 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
1048 Front.SetSpecularColor (AColor);
1050 R = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorAmb.r);
1051 G = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorAmb.g);
1052 B = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorAmb.b);
1053 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
1054 Front.SetAmbientColor (AColor);
1056 R = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorDif.r);
1057 G = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorDif.g);
1058 B = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorDif.b);
1059 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
1060 Front.SetDiffuseColor (AColor);
1062 R = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorEms.r);
1063 G = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorEms.g);
1064 B = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorEms.b);
1065 AColor.SetValues (R, G, B, Quantity_TOC_RGB);
1066 Front.SetEmissiveColor (AColor);
1068 Front.SetEnvReflexion (MyCGroup.Struct->ContextFillArea.Front.EnvReflexion);
1074 CTXF->SetEdgeOff ();
1076 CTXF->SetHatchStyle(Aspect_HatchStyle (MyCGroup.Struct->ContextFillArea.Hatch));
1078 // Front and Back face
1079 if (MyCGroup.Struct->ContextFillArea.Distinguish == 1)
1080 CTXF->SetDistinguishOn ();
1082 CTXF->SetDistinguishOff ();
1083 if (MyCGroup.Struct->ContextFillArea.BackFace == 1)
1084 CTXF->SuppressBackFace ();
1086 CTXF->AllowBackFace ();
1088 CTXF->SetTextureMap (MyCGroup.Struct->ContextFillArea.Texture.TextureMap);
1089 if (MyCGroup.Struct->ContextFillArea.Texture.doTextureMap == 1)
1091 CTXF->SetTextureMapOn();
1095 CTXF->SetTextureMapOff();
1098 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
1099 CTXF->SetPolygonOffsets(MyCGroup.Struct->ContextFillArea.PolygonOffsetMode,
1100 MyCGroup.Struct->ContextFillArea.PolygonOffsetFactor,
1101 MyCGroup.Struct->ContextFillArea.PolygonOffsetUnits);
1102 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
1104 CTXF->SetInteriorStyle (AStyle);
1105 CTXF->SetInteriorColor (AnIntColor);
1106 CTXF->SetEdgeColor (AnEdgeColor);
1107 CTXF->SetEdgeLineType (ALType);
1108 CTXF->SetEdgeWidth (AWidth);
1109 CTXF->SetBackMaterial (Back);
1110 CTXF->SetFrontMaterial (Front);
1113 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
1115 GroupPrimitivesAspect (CTXL, CTXT, CTXM, CTXF);