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.
19 #include <Graphic3d_ArrayOfPoints.hxx>
20 #include <Graphic3d_ArrayOfPrimitives.hxx>
21 #include <Graphic3d_AspectFillArea3d.hxx>
22 #include <Graphic3d_AspectLine3d.hxx>
23 #include <Graphic3d_AspectMarker3d.hxx>
24 #include <Graphic3d_AspectText3d.hxx>
25 #include <Graphic3d_CStructure.hxx>
26 #include <Graphic3d_Group.hxx>
27 #include <Graphic3d_GroupDefinitionError.hxx>
28 #include <Graphic3d_ShaderProgram.hxx>
29 #include <Graphic3d_Structure.hxx>
30 #include "Graphic3d_Structure.pxx"
31 #include <Graphic3d_StructureManager.hxx>
32 #include <Graphic3d_TextureMap.hxx>
33 #include <Graphic3d_TransModeFlags.hxx>
34 #include <Message.hxx>
35 #include <Message_Messenger.hxx>
36 #include <NCollection_String.hxx>
37 #include <Standard_OutOfRange.hxx>
38 #include <Standard_Type.hxx>
39 #include <TCollection_AsciiString.hxx>
40 #include <TCollection_ExtendedString.hxx>
42 #define MyContainsFacet myCBitFields.bool2
44 // =======================================================================
45 // function : Graphic3d_Group
47 // =======================================================================
48 Graphic3d_Group::Graphic3d_Group (const Handle(Graphic3d_Structure)& theStruct)
49 : myIsClosed (Standard_False)
51 // A small commentary on the usage of This!
53 // Graphic3d_Group is created in a structure. Graphic3d_Structure is a
54 // manager of Graphic3d_Group. In the constructor of Graphic3d_Group
55 // a method Add of Graphic3d_Structure is called. It allows adding
56 // the instance of Graphic3d_Group in its manager. So there are 2 references
57 // to <me> and everything works well.
59 // This () is the instance of the class, the current group
60 //Handle(Graphic3d_Group) me = Handle(Graphic3d_Group)::DownCast (This());
62 myStructure = theStruct.operator->();
64 MyContainsFacet = Standard_False,
66 ContextLine.IsDef = 0;
67 ContextText.IsDef = 0;
68 ContextMarker.IsDef = 0;
69 ContextFillArea.IsDef = 0;
71 ContextLine.IsSet = 0;
72 ContextText.IsSet = 0;
73 ContextMarker.IsSet = 0;
74 ContextFillArea.IsSet = 0;
77 // =======================================================================
80 // =======================================================================
81 void Graphic3d_Group::Clear (Standard_Boolean theUpdateStructureMgr)
88 ContextLine.IsSet = 0,
89 ContextText.IsSet = 0,
90 ContextMarker.IsSet = 0,
91 ContextFillArea.IsSet = 0;
93 ContextLine.IsDef = 0,
94 ContextText.IsDef = 0,
95 ContextMarker.IsDef = 0,
96 ContextFillArea.IsDef = 0;
102 myStructure->GroupsWithFacet (-1);
103 MyContainsFacet = Standard_False;
106 // clear method could be used on Graphic3d_Structure destruction,
107 // and its structure manager could be already destroyed, in that
108 // case we don't need to update it;
109 if (theUpdateStructureMgr)
115 // =======================================================================
116 // function : Destroy
118 // =======================================================================
119 void Graphic3d_Group::Destroy()
121 // tell graphics driver to clear internal resources of the group
122 Clear (Standard_False);
125 // =======================================================================
128 // =======================================================================
129 void Graphic3d_Group::Remove()
138 myStructure->GroupsWithFacet (-1);
139 MyContainsFacet = Standard_False;
141 myStructure->Remove (this);
148 // =======================================================================
149 // function : IsDeleted
151 // =======================================================================
152 Standard_Boolean Graphic3d_Group::IsDeleted() const
154 return myStructure == NULL
155 || myStructure->IsDeleted();
158 // =======================================================================
159 // function : ContainsFacet
161 // =======================================================================
162 Standard_Boolean Graphic3d_Group::ContainsFacet() const
164 return MyContainsFacet;
167 // =======================================================================
168 // function : IsEmpty
170 // =======================================================================
171 Standard_Boolean Graphic3d_Group::IsEmpty() const
175 return Standard_True;
178 return !myStructure->IsInfinite()
179 && !myBounds.IsValid();
182 // =======================================================================
183 // function : SetMinMaxValues
185 // =======================================================================
186 void Graphic3d_Group::SetMinMaxValues (const Standard_Real theXMin, const Standard_Real theYMin, const Standard_Real theZMin,
187 const Standard_Real theXMax, const Standard_Real theYMax, const Standard_Real theZMax)
189 myBounds = Graphic3d_BndBox4f (Graphic3d_Vec4 (static_cast<Standard_ShortReal> (theXMin),
190 static_cast<Standard_ShortReal> (theYMin),
191 static_cast<Standard_ShortReal> (theZMin),
193 Graphic3d_Vec4 (static_cast<Standard_ShortReal> (theXMax),
194 static_cast<Standard_ShortReal> (theYMax),
195 static_cast<Standard_ShortReal> (theZMax),
199 // =======================================================================
200 // function : MinMaxValues
202 // =======================================================================
203 void Graphic3d_Group::MinMaxValues (Standard_Real& theXMin, Standard_Real& theYMin, Standard_Real& theZMin,
204 Standard_Real& theXMax, Standard_Real& theYMax, Standard_Real& theZMax) const
206 MinMaxCoord (theXMin, theYMin, theZMin,
207 theXMax, theYMax, theZMax);
210 // =======================================================================
211 // function : Structure
213 // =======================================================================
214 Handle(Graphic3d_Structure) Graphic3d_Group::Structure() const
219 // =======================================================================
220 // function : MinMaxCoord
222 // =======================================================================
223 void Graphic3d_Group::MinMaxCoord (Standard_Real& theXMin, Standard_Real& theYMin, Standard_Real& theZMin,
224 Standard_Real& theXMax, Standard_Real& theYMax, Standard_Real& theZMax) const
229 theXMin = theYMin = theZMin = ShortRealFirst();
230 theXMax = theYMax = theZMax = ShortRealLast();
232 else if (myBounds.IsValid())
234 const Graphic3d_Vec4& aMinPt = myBounds.CornerMin();
235 const Graphic3d_Vec4& aMaxPt = myBounds.CornerMax();
236 theXMin = Standard_Real (aMinPt.x());
237 theYMin = Standard_Real (aMinPt.y());
238 theZMin = Standard_Real (aMinPt.z());
239 theXMax = Standard_Real (aMaxPt.x());
240 theYMax = Standard_Real (aMaxPt.y());
241 theZMax = Standard_Real (aMaxPt.z());
245 // for consistency with old API
246 theXMin = theYMin = theZMin = ShortRealLast();
247 theXMax = theYMax = theZMax = ShortRealFirst();
251 // =======================================================================
254 // =======================================================================
255 void Graphic3d_Group::Update() const
262 if (myStructure->StructureManager()->UpdateMode() == Aspect_TOU_ASAP)
264 myStructure->StructureManager()->Update();
268 // =======================================================================
269 // function : SetGroupPrimitivesAspect
271 // =======================================================================
272 void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& theAspLine)
279 Standard_Real aWidth;
280 Quantity_Color aColor;
281 Aspect_TypeOfLine aLType;
282 theAspLine->Values (aColor, aLType, aWidth);
284 ContextLine.IsDef = 1;
285 ContextLine.Color.r = float (aColor.Red());
286 ContextLine.Color.g = float (aColor.Green());
287 ContextLine.Color.b = float (aColor.Blue());
288 ContextLine.LineType = aLType;
289 ContextLine.Width = float (aWidth);
290 ContextLine.ShaderProgram = theAspLine->ShaderProgram();
292 UpdateAspectLine (Standard_True);
294 ContextLine.IsSet = 1;
299 // =======================================================================
300 // function : SetGroupPrimitivesAspect
302 // =======================================================================
303 void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspFill)
310 Standard_Real anRGB[3];
311 Standard_Real aWidth;
312 Quantity_Color anIntColor;
313 Quantity_Color aBackIntColor;
314 Quantity_Color anEdgeColor;
315 Aspect_TypeOfLine aLType;
316 Aspect_InteriorStyle aStyle;
317 theAspFill->Values (aStyle, anIntColor, aBackIntColor, anEdgeColor, aLType, aWidth);
319 anIntColor.Values (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
320 ContextFillArea.Style = aStyle;
321 ContextFillArea.IntColor.r = float (anRGB[0]);
322 ContextFillArea.IntColor.g = float (anRGB[1]);
323 ContextFillArea.IntColor.b = float (anRGB[2]);
325 if (theAspFill->Distinguish())
327 aBackIntColor.Values (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
329 ContextFillArea.BackIntColor.r = float (anRGB[0]);
330 ContextFillArea.BackIntColor.g = float (anRGB[1]);
331 ContextFillArea.BackIntColor.b = float (anRGB[2]);
334 ContextFillArea.Edge = theAspFill->Edge() ? 1 : 0;
335 ContextFillArea.EdgeColor.r = float (anEdgeColor.Red());
336 ContextFillArea.EdgeColor.g = float (anEdgeColor.Green());
337 ContextFillArea.EdgeColor.b = float (anEdgeColor.Blue());
338 ContextFillArea.LineType = aLType;
339 ContextFillArea.Width = float (aWidth);
340 ContextFillArea.Hatch = theAspFill->HatchStyle();
342 // Front and Back face
343 ContextFillArea.Distinguish = theAspFill->Distinguish() ? 1 : 0;
344 ContextFillArea.BackFace = theAspFill->BackFace() ? 1 : 0;
347 const Graphic3d_MaterialAspect& aBack = theAspFill->BackMaterial();
349 // Material properties
350 ContextFillArea.Back.Shininess = float (aBack.Shininess());
351 ContextFillArea.Back.Ambient = float (aBack.Ambient());
352 ContextFillArea.Back.Diffuse = float (aBack.Diffuse());
353 ContextFillArea.Back.Specular = float (aBack.Specular());
354 ContextFillArea.Back.Transparency = float (aBack.Transparency());
355 ContextFillArea.Back.Emission = float (aBack.Emissive());
356 ContextFillArea.Back.RefractionIndex = float (aBack.RefractionIndex());
357 ContextFillArea.Back.BSDF = aBack.BSDF();
360 ContextFillArea.Back.IsAmbient = aBack.ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0;
361 ContextFillArea.Back.IsDiffuse = aBack.ReflectionMode (Graphic3d_TOR_DIFFUSE) ? 1 : 0;
362 ContextFillArea.Back.IsSpecular = aBack.ReflectionMode (Graphic3d_TOR_SPECULAR) ? 1 : 0;
363 ContextFillArea.Back.IsEmission = aBack.ReflectionMode (Graphic3d_TOR_EMISSION) ? 1 : 0;
366 ContextFillArea.Back.IsPhysic = aBack.MaterialType (Graphic3d_MATERIAL_PHYSIC) ? 1 : 0;
369 ContextFillArea.Back.ColorSpec.r = float (aBack.SpecularColor().Red());
370 ContextFillArea.Back.ColorSpec.g = float (aBack.SpecularColor().Green());
371 ContextFillArea.Back.ColorSpec.b = float (aBack.SpecularColor().Blue());
374 ContextFillArea.Back.ColorAmb.r = float (aBack.AmbientColor().Red());
375 ContextFillArea.Back.ColorAmb.g = float (aBack.AmbientColor().Green());
376 ContextFillArea.Back.ColorAmb.b = float (aBack.AmbientColor().Blue());
379 ContextFillArea.Back.ColorDif.r = float (aBack.DiffuseColor().Red());
380 ContextFillArea.Back.ColorDif.g = float (aBack.DiffuseColor().Green());
381 ContextFillArea.Back.ColorDif.b = float (aBack.DiffuseColor().Blue());
384 ContextFillArea.Back.ColorEms.r = float (aBack.EmissiveColor().Red());
385 ContextFillArea.Back.ColorEms.g = float (aBack.EmissiveColor().Green());
386 ContextFillArea.Back.ColorEms.b = float (aBack.EmissiveColor().Blue());
388 ContextFillArea.Back.EnvReflexion = float (aBack.EnvReflexion());
391 const Graphic3d_MaterialAspect& aFront = theAspFill->FrontMaterial();
393 // Material properties
394 ContextFillArea.Front.Shininess = float (aFront.Shininess());
395 ContextFillArea.Front.Ambient = float (aFront.Ambient());
396 ContextFillArea.Front.Diffuse = float (aFront.Diffuse());
397 ContextFillArea.Front.Specular = float (aFront.Specular());
398 ContextFillArea.Front.Transparency = float (aFront.Transparency());
399 ContextFillArea.Front.Emission = float (aFront.Emissive());
400 ContextFillArea.Front.RefractionIndex = float (aFront.RefractionIndex());
401 ContextFillArea.Front.BSDF = aFront.BSDF();
404 ContextFillArea.Front.IsAmbient = aFront.ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0;
405 ContextFillArea.Front.IsDiffuse = aFront.ReflectionMode (Graphic3d_TOR_DIFFUSE) ? 1 : 0;
406 ContextFillArea.Front.IsSpecular = aFront.ReflectionMode (Graphic3d_TOR_SPECULAR) ? 1 : 0;
407 ContextFillArea.Front.IsEmission = aFront.ReflectionMode (Graphic3d_TOR_EMISSION) ? 1 : 0;
410 ContextFillArea.Front.IsPhysic = aFront.MaterialType (Graphic3d_MATERIAL_PHYSIC) ? 1 : 0;
413 ContextFillArea.Front.ColorSpec.r = float (aFront.SpecularColor().Red());
414 ContextFillArea.Front.ColorSpec.g = float (aFront.SpecularColor().Green());
415 ContextFillArea.Front.ColorSpec.b = float (aFront.SpecularColor().Blue());
418 ContextFillArea.Front.ColorAmb.r = float (aFront.AmbientColor().Red());
419 ContextFillArea.Front.ColorAmb.g = float (aFront.AmbientColor().Green());
420 ContextFillArea.Front.ColorAmb.b = float (aFront.AmbientColor().Blue());
423 ContextFillArea.Front.ColorDif.r = float (aFront.DiffuseColor().Red());
424 ContextFillArea.Front.ColorDif.g = float (aFront.DiffuseColor().Green());
425 ContextFillArea.Front.ColorDif.b = float (aFront.DiffuseColor().Blue());
428 ContextFillArea.Front.ColorEms.r = float (aFront.EmissiveColor().Red());
429 ContextFillArea.Front.ColorEms.g = float (aFront.EmissiveColor().Green());
430 ContextFillArea.Front.ColorEms.b = float (aFront.EmissiveColor().Blue());
432 ContextFillArea.Front.EnvReflexion = float (aFront.EnvReflexion());
434 ContextFillArea.IsDef = 1; // Definition material ok
437 ContextFillArea.Texture.TextureMap = theAspFill->TextureMap();
438 ContextFillArea.Texture.doTextureMap = theAspFill->TextureMapState() ? 1 : 0;
440 Standard_Integer aPolyMode;
441 Standard_ShortReal aPolyFactor, aPolyUnits;
442 theAspFill->PolygonOffsets (aPolyMode, aPolyFactor, aPolyUnits);
443 ContextFillArea.PolygonOffsetMode = aPolyMode;
444 ContextFillArea.PolygonOffsetFactor = aPolyFactor;
445 ContextFillArea.PolygonOffsetUnits = aPolyUnits;
447 ContextFillArea.ShaderProgram = theAspFill->ShaderProgram();
449 UpdateAspectFace (Standard_True);
451 ContextFillArea.IsSet = 1;
456 // =======================================================================
457 // function : SetGroupPrimitivesAspect
459 // =======================================================================
460 void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& theAspMarker)
467 Standard_Real aScale;
468 Quantity_Color aColor;
469 Aspect_TypeOfMarker aMarkerType;
470 theAspMarker->Values (aColor, aMarkerType, aScale);
472 ContextMarker.IsDef = 1;
473 ContextMarker.Color.r = Standard_ShortReal (aColor.Red());
474 ContextMarker.Color.g = Standard_ShortReal (aColor.Green());
475 ContextMarker.Color.b = Standard_ShortReal (aColor.Blue());
476 ContextMarker.MarkerType = aMarkerType;
477 ContextMarker.Scale = Standard_ShortReal (aScale);
478 ContextMarker.MarkerImage = theAspMarker->GetMarkerImage();
479 ContextMarker.ShaderProgram = theAspMarker->ShaderProgram();
481 UpdateAspectMarker (Standard_True);
483 ContextMarker.IsSet = 1;
488 // =======================================================================
489 // function : SetGroupPrimitivesAspect
491 // =======================================================================
492 void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& theAspText)
499 Standard_Real anExpansion, aSpace, aTextAngle;
500 Quantity_Color aColor, aColorSubTitle;
501 Standard_CString aFont;
502 Aspect_TypeOfStyleText aStyle;
503 Aspect_TypeOfDisplayText aDisplayType;
504 Standard_Boolean isTextZoomable;
505 Font_FontAspect aTextFontAspect;
506 theAspText->Values (aColor, aFont, anExpansion, aSpace, aStyle, aDisplayType,
507 aColorSubTitle, isTextZoomable, aTextAngle, aTextFontAspect);
509 ContextText.IsDef = 1;
510 ContextText.Color.r = float (aColor.Red());
511 ContextText.Color.g = float (aColor.Green());
512 ContextText.Color.b = float (aColor.Blue());
513 ContextText.Font = (char* )aFont;
514 ContextText.Expan = float (anExpansion);
515 ContextText.Space = float (aSpace);
516 ContextText.Style = aStyle;
517 ContextText.DisplayType = aDisplayType;
518 ContextText.ColorSubTitle.r = float (aColorSubTitle.Red());
519 ContextText.ColorSubTitle.g = float (aColorSubTitle.Green());
520 ContextText.ColorSubTitle.b = float (aColorSubTitle.Blue());
521 ContextText.TextZoomable = isTextZoomable;
522 ContextText.TextAngle = float (aTextAngle);
523 ContextText.TextFontAspect = aTextFontAspect;
524 ContextText.ShaderProgram = theAspText->ShaderProgram();
526 UpdateAspectText (Standard_True);
528 ContextText.IsSet = 1;
533 // =======================================================================
534 // function : SetPrimitivesAspect
536 // =======================================================================
537 void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& theAspLine)
544 Standard_Real aWidth;
545 Quantity_Color aColor;
546 Aspect_TypeOfLine aLType;
547 theAspLine->Values (aColor, aLType, aWidth);
549 ContextLine.IsDef = 1;
550 ContextLine.Color.r = float (aColor.Red());
551 ContextLine.Color.g = float (aColor.Green());
552 ContextLine.Color.b = float (aColor.Blue());
553 ContextLine.LineType = aLType;
554 ContextLine.Width = float (aWidth);
555 ContextLine.ShaderProgram = theAspLine->ShaderProgram();
557 UpdateAspectLine (Standard_False);
559 ContextLine.IsSet = 1;
564 // =======================================================================
565 // function : SetPrimitivesAspect
567 // =======================================================================
568 void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspFill)
575 Standard_Real anRGB[3];
576 Standard_Real aWidth;
577 Quantity_Color anIntColor;
578 Quantity_Color aBackIntColor;
579 Quantity_Color anEdgeColor;
580 Aspect_TypeOfLine aLType;
581 Aspect_InteriorStyle aStyle;
582 theAspFill->Values (aStyle, anIntColor, aBackIntColor, anEdgeColor, aLType, aWidth);
584 anIntColor.Values (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
585 ContextFillArea.Style = aStyle;
586 ContextFillArea.IntColor.r = float (anRGB[0]);
587 ContextFillArea.IntColor.g = float (anRGB[1]);
588 ContextFillArea.IntColor.b = float (anRGB[2]);
590 if (theAspFill->Distinguish())
592 aBackIntColor.Values (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
594 ContextFillArea.BackIntColor.r = float(anRGB[0]);
595 ContextFillArea.BackIntColor.g = float(anRGB[1]);
596 ContextFillArea.BackIntColor.b = float(anRGB[2]);
599 ContextFillArea.Edge = theAspFill->Edge() ? 1 : 0;
600 ContextFillArea.EdgeColor.r = float (anEdgeColor.Red());
601 ContextFillArea.EdgeColor.g = float (anEdgeColor.Green());
602 ContextFillArea.EdgeColor.b = float (anEdgeColor.Blue());
603 ContextFillArea.LineType = aLType;
604 ContextFillArea.Width = float (aWidth);
605 ContextFillArea.Hatch = theAspFill->HatchStyle();
607 // Front and Back face
608 ContextFillArea.Distinguish = theAspFill->Distinguish() ? 1 : 0;
609 ContextFillArea.BackFace = theAspFill->BackFace() ? 1 : 0;
612 const Graphic3d_MaterialAspect& aBack = theAspFill->BackMaterial();
614 ContextFillArea.Back.Shininess = float (aBack.Shininess());
615 ContextFillArea.Back.Ambient = float (aBack.Ambient());
616 ContextFillArea.Back.Diffuse = float (aBack.Diffuse());
617 ContextFillArea.Back.Specular = float (aBack.Specular());
618 ContextFillArea.Back.Transparency = float (aBack.Transparency());
619 ContextFillArea.Back.Emission = float (aBack.Emissive());
622 ContextFillArea.Back.IsAmbient = aBack.ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0;
623 ContextFillArea.Back.IsDiffuse = aBack.ReflectionMode (Graphic3d_TOR_DIFFUSE) ? 1 : 0;
624 ContextFillArea.Back.IsSpecular = aBack.ReflectionMode (Graphic3d_TOR_SPECULAR) ? 1 : 0;
625 ContextFillArea.Back.IsEmission = aBack.ReflectionMode (Graphic3d_TOR_EMISSION) ? 1 : 0;
628 ContextFillArea.Back.IsPhysic = aBack.MaterialType (Graphic3d_MATERIAL_PHYSIC) ? 1 : 0;
631 ContextFillArea.Back.ColorSpec.r = float (aBack.SpecularColor().Red());
632 ContextFillArea.Back.ColorSpec.g = float (aBack.SpecularColor().Green());
633 ContextFillArea.Back.ColorSpec.b = float (aBack.SpecularColor().Blue());
636 ContextFillArea.Back.ColorAmb.r = float (aBack.AmbientColor().Red());
637 ContextFillArea.Back.ColorAmb.g = float (aBack.AmbientColor().Green());
638 ContextFillArea.Back.ColorAmb.b = float (aBack.AmbientColor().Blue());
641 ContextFillArea.Back.ColorDif.r = float (aBack.DiffuseColor().Red());
642 ContextFillArea.Back.ColorDif.g = float (aBack.DiffuseColor().Green());
643 ContextFillArea.Back.ColorDif.b = float (aBack.DiffuseColor().Blue());
646 ContextFillArea.Back.ColorEms.r = float (aBack.EmissiveColor().Red());
647 ContextFillArea.Back.ColorEms.g = float (aBack.EmissiveColor().Green());
648 ContextFillArea.Back.ColorEms.b = float (aBack.EmissiveColor().Blue());
650 ContextFillArea.Back.EnvReflexion = float (aBack.EnvReflexion());
652 ContextFillArea.Back.RefractionIndex = float (aBack.RefractionIndex());
653 ContextFillArea.Back.BSDF = aBack.BSDF();
656 const Graphic3d_MaterialAspect& aFront = theAspFill->FrontMaterial();
658 ContextFillArea.Front.Shininess = float (aFront.Shininess());
659 ContextFillArea.Front.Ambient = float (aFront.Ambient());
660 ContextFillArea.Front.Diffuse = float (aFront.Diffuse());
661 ContextFillArea.Front.Specular = float (aFront.Specular());
662 ContextFillArea.Front.Transparency = float (aFront.Transparency());
663 ContextFillArea.Front.Emission = float (aFront.Emissive());
666 ContextFillArea.Front.IsAmbient = aFront.ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0;
667 ContextFillArea.Front.IsDiffuse = aFront.ReflectionMode (Graphic3d_TOR_DIFFUSE) ? 1 : 0;
668 ContextFillArea.Front.IsSpecular = aFront.ReflectionMode (Graphic3d_TOR_SPECULAR) ? 1 : 0;
669 ContextFillArea.Front.IsEmission = aFront.ReflectionMode (Graphic3d_TOR_EMISSION) ? 1 : 0;
672 ContextFillArea.Front.IsPhysic = aFront.MaterialType (Graphic3d_MATERIAL_PHYSIC) ? 1 : 0;
675 ContextFillArea.Front.ColorSpec.r = float (aFront.SpecularColor().Red());
676 ContextFillArea.Front.ColorSpec.g = float (aFront.SpecularColor().Green());
677 ContextFillArea.Front.ColorSpec.b = float (aFront.SpecularColor().Blue());
680 ContextFillArea.Front.ColorAmb.r = float (aFront.AmbientColor().Red());
681 ContextFillArea.Front.ColorAmb.g = float (aFront.AmbientColor().Green());
682 ContextFillArea.Front.ColorAmb.b = float (aFront.AmbientColor().Blue());
685 ContextFillArea.Front.ColorDif.r = float (aFront.DiffuseColor().Red());
686 ContextFillArea.Front.ColorDif.g = float (aFront.DiffuseColor().Green());
687 ContextFillArea.Front.ColorDif.b = float (aFront.DiffuseColor().Blue());
690 ContextFillArea.Front.ColorEms.r = float (aFront.EmissiveColor().Red());
691 ContextFillArea.Front.ColorEms.g = float (aFront.EmissiveColor().Green());
692 ContextFillArea.Front.ColorEms.b = float (aFront.EmissiveColor().Blue());
694 ContextFillArea.Front.EnvReflexion = float (aFront.EnvReflexion());
696 ContextFillArea.Front.RefractionIndex = float (aFront.RefractionIndex());
697 ContextFillArea.Front.BSDF = aFront.BSDF();
699 ContextFillArea.IsDef = 1; // Material definition ok
701 ContextFillArea.Texture.TextureMap = theAspFill->TextureMap();
702 ContextFillArea.Texture.doTextureMap = theAspFill->TextureMapState() ? 1 : 0;
704 Standard_Integer aPolyMode;
705 Standard_ShortReal aPolyFactor, aPolyUnits;
706 theAspFill->PolygonOffsets (aPolyMode, aPolyFactor, aPolyUnits);
707 ContextFillArea.PolygonOffsetMode = aPolyMode;
708 ContextFillArea.PolygonOffsetFactor = aPolyFactor;
709 ContextFillArea.PolygonOffsetUnits = aPolyUnits;
711 ContextFillArea.ShaderProgram = theAspFill->ShaderProgram();
713 UpdateAspectFace (Standard_False);
715 ContextFillArea.IsSet = 1;
720 // =======================================================================
721 // function : SetPrimitivesAspect
723 // =======================================================================
724 void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& theAspMarker)
731 Standard_Real aScale;
732 Quantity_Color aColor;
733 Aspect_TypeOfMarker aMarkerType;
734 theAspMarker->Values (aColor, aMarkerType, aScale);
736 ContextMarker.IsDef = 1;
737 ContextMarker.Color.r = Standard_ShortReal (aColor.Red());
738 ContextMarker.Color.g = Standard_ShortReal (aColor.Green());
739 ContextMarker.Color.b = Standard_ShortReal (aColor.Blue());
740 ContextMarker.MarkerType = aMarkerType;
741 ContextMarker.Scale = Standard_ShortReal (aScale);
742 ContextMarker.MarkerImage = theAspMarker->GetMarkerImage();
744 ContextMarker.ShaderProgram = theAspMarker->ShaderProgram();
746 UpdateAspectMarker (Standard_False);
748 ContextMarker.IsSet = 1;
753 // =======================================================================
754 // function : SetPrimitivesAspect
756 // =======================================================================
757 void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& theAspText)
764 Standard_CString aFont;
765 Standard_Real aSpace, anExpansion, aTextAngle;
766 Quantity_Color aColor, aColorSubTitle;
767 Aspect_TypeOfStyleText aStyle;
768 Aspect_TypeOfDisplayText aDisplayType;
769 Standard_Boolean aTextZoomable;
770 Font_FontAspect aTextFontAspect;
771 theAspText->Values (aColor, aFont, anExpansion, aSpace, aStyle, aDisplayType,
772 aColorSubTitle, aTextZoomable, aTextAngle, aTextFontAspect);
774 ContextText.IsDef = 1;
775 ContextText.Color.r = float (aColor.Red());
776 ContextText.Color.g = float (aColor.Green());
777 ContextText.Color.b = float (aColor.Blue());
778 ContextText.Font = (char* )aFont;
779 ContextText.Expan = float (anExpansion);
780 ContextText.Space = float (aSpace);
781 ContextText.Style = aStyle;
782 ContextText.DisplayType = aDisplayType;
783 ContextText.ColorSubTitle.r = float (aColorSubTitle.Red());
784 ContextText.ColorSubTitle.g = float (aColorSubTitle.Green());
785 ContextText.ColorSubTitle.b = float (aColorSubTitle.Blue());
786 ContextText.TextZoomable = aTextZoomable;
787 ContextText.TextAngle = float (aTextAngle);
788 ContextText.TextFontAspect = aTextFontAspect;
789 ContextText.ShaderProgram = theAspText->ShaderProgram();
791 UpdateAspectText (Standard_False);
793 ContextText.IsSet = 1;
798 // =======================================================================
799 // function : IsGroupPrimitivesAspectSet
801 // =======================================================================
802 Standard_Boolean Graphic3d_Group::IsGroupPrimitivesAspectSet (const Graphic3d_GroupAspect theAspect) const
806 case Graphic3d_ASPECT_LINE: return ContextLine.IsSet;
807 case Graphic3d_ASPECT_TEXT: return ContextText.IsSet;
808 case Graphic3d_ASPECT_MARKER: return ContextMarker.IsSet;
809 case Graphic3d_ASPECT_FILL_AREA: return ContextFillArea.IsSet;
810 default: return Standard_False;
814 // =======================================================================
815 // function : GroupPrimitivesAspect
817 // =======================================================================
818 void Graphic3d_Group::GroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& theAspLine,
819 const Handle(Graphic3d_AspectText3d)& theAspText,
820 const Handle(Graphic3d_AspectMarker3d)& theAspMarker,
821 const Handle(Graphic3d_AspectFillArea3d)& theAspFill) const
823 Quantity_Color aColor;
824 Graphic3d_MaterialAspect aFront, aBack;
826 const CALL_DEF_CONTEXTLINE& anAspLine = ContextLine.IsSet ? ContextLine : myStructure->CStructure()->ContextLine;
827 aColor.SetValues (Standard_Real (anAspLine.Color.r),
828 Standard_Real (anAspLine.Color.g),
829 Standard_Real (anAspLine.Color.b), Quantity_TOC_RGB);
830 theAspLine->SetColor (aColor);
831 theAspLine->SetType (Aspect_TypeOfLine (anAspLine.LineType));
832 theAspLine->SetWidth (Standard_Real (anAspLine.Width));
833 theAspLine->SetShaderProgram (anAspLine.ShaderProgram);
835 const CALL_DEF_CONTEXTTEXT& anAspText = ContextText.IsSet ? ContextText : myStructure->CStructure()->ContextText;
836 aColor.SetValues (Standard_Real (anAspText.Color.r),
837 Standard_Real (anAspText.Color.g),
838 Standard_Real (anAspText.Color.b), Quantity_TOC_RGB);
839 theAspText->SetColor (aColor);
840 aColor.SetValues (Standard_Real (anAspText.ColorSubTitle.r),
841 Standard_Real (anAspText.ColorSubTitle.g),
842 Standard_Real (anAspText.ColorSubTitle.b), Quantity_TOC_RGB);
843 theAspText->SetColorSubTitle (aColor);
844 theAspText->SetFont (anAspText.Font);
845 theAspText->SetSpace (Standard_Real (anAspText.Space));
846 theAspText->SetExpansionFactor (Standard_Real (anAspText.Expan));
847 theAspText->SetStyle (Aspect_TypeOfStyleText (anAspText.Style));
848 theAspText->SetDisplayType (Aspect_TypeOfDisplayText (anAspText.DisplayType));
849 theAspText->SetShaderProgram (anAspText.ShaderProgram);
851 const CALL_DEF_CONTEXTMARKER& anAspMarker = ContextMarker.IsSet ? ContextMarker : myStructure->CStructure()->ContextMarker;
852 aColor.SetValues (Standard_Real (anAspMarker.Color.r),
853 Standard_Real (anAspMarker.Color.g),
854 Standard_Real (anAspMarker.Color.b), Quantity_TOC_RGB);
855 theAspMarker->SetColor (aColor);
856 theAspMarker->SetType (anAspMarker.MarkerType);
857 theAspMarker->SetScale (Standard_Real (anAspMarker.Scale));
858 theAspMarker->SetShaderProgram (anAspMarker.ShaderProgram);
859 if (anAspMarker.MarkerType == Aspect_TOM_USERDEFINED)
861 theAspMarker->SetMarkerImage (ContextMarker.MarkerImage);
864 const CALL_DEF_CONTEXTFILLAREA& anAspFill = ContextFillArea.IsSet ? ContextFillArea : myStructure->CStructure()->ContextFillArea;
866 theAspFill->SetInteriorStyle (Aspect_InteriorStyle (anAspFill.Style));
867 aColor.SetValues (Standard_Real (anAspFill.IntColor.r),
868 Standard_Real (anAspFill.IntColor.g),
869 Standard_Real (anAspFill.IntColor.b), Quantity_TOC_RGB);
870 theAspFill->SetInteriorColor (aColor);
873 aColor.SetValues (Standard_Real (anAspFill.EdgeColor.r),
874 Standard_Real (anAspFill.EdgeColor.g),
875 Standard_Real (anAspFill.EdgeColor.b), Quantity_TOC_RGB);
876 theAspFill->SetEdgeColor (aColor);
877 theAspFill->SetEdgeLineType (Aspect_TypeOfLine (anAspFill.LineType));
878 theAspFill->SetEdgeWidth (Standard_Real (anAspFill.Width));
881 aBack.SetShininess (Standard_Real (anAspFill.Back.Shininess));
882 aBack.SetAmbient (Standard_Real (anAspFill.Back.Ambient));
883 aBack.SetDiffuse (Standard_Real (anAspFill.Back.Diffuse));
884 aBack.SetSpecular (Standard_Real (anAspFill.Back.Specular));
885 aBack.SetTransparency (Standard_Real (anAspFill.Back.Transparency));
886 aBack.SetEmissive (Standard_Real (anAspFill.Back.Emission));
887 anAspFill.Back.IsAmbient == 1 ? aBack.SetReflectionModeOn (Graphic3d_TOR_AMBIENT) : aBack.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
888 anAspFill.Back.IsDiffuse == 1 ? aBack.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE) : aBack.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
889 anAspFill.Back.IsSpecular == 1 ? aBack.SetReflectionModeOn (Graphic3d_TOR_SPECULAR) : aBack.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
890 anAspFill.Back.IsEmission == 1 ? aBack.SetReflectionModeOn (Graphic3d_TOR_EMISSION) : aBack.SetReflectionModeOff (Graphic3d_TOR_EMISSION);
892 aColor.SetValues (Standard_Real (anAspFill.Back.ColorSpec.r),
893 Standard_Real (anAspFill.Back.ColorSpec.g),
894 Standard_Real (anAspFill.Back.ColorSpec.b), Quantity_TOC_RGB);
895 aBack.SetSpecularColor (aColor);
897 aColor.SetValues (Standard_Real (anAspFill.Back.ColorAmb.r),
898 Standard_Real (anAspFill.Back.ColorAmb.g),
899 Standard_Real (anAspFill.Back.ColorAmb.b), Quantity_TOC_RGB);
900 aBack.SetAmbientColor (aColor);
902 aColor.SetValues (Standard_Real (anAspFill.Back.ColorDif.r),
903 Standard_Real (anAspFill.Back.ColorDif.g),
904 Standard_Real (anAspFill.Back.ColorDif.b), Quantity_TOC_RGB);
905 aBack.SetDiffuseColor (aColor);
907 aColor.SetValues (Standard_Real (anAspFill.Back.ColorEms.r),
908 Standard_Real (anAspFill.Back.ColorEms.g),
909 Standard_Real (anAspFill.Back.ColorEms.b), Quantity_TOC_RGB);
910 aBack.SetEmissiveColor (aColor);
912 aBack.SetEnvReflexion (anAspFill.Back.EnvReflexion);
914 aBack.SetRefractionIndex (Standard_Real (anAspFill.Back.RefractionIndex));
915 aBack.SetBSDF (anAspFill.Back.BSDF);
918 aFront.SetShininess (Standard_Real (anAspFill.Front.Shininess));
919 aFront.SetAmbient (Standard_Real (anAspFill.Front.Ambient));
920 aFront.SetDiffuse (Standard_Real (anAspFill.Front.Diffuse));
921 aFront.SetSpecular (Standard_Real (anAspFill.Front.Specular));
922 aFront.SetTransparency (Standard_Real (anAspFill.Front.Transparency));
923 aFront.SetEmissive (Standard_Real (anAspFill.Back.Emission));
924 anAspFill.Front.IsAmbient == 1 ? aFront.SetReflectionModeOn (Graphic3d_TOR_AMBIENT) : aFront.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
925 anAspFill.Front.IsDiffuse == 1 ? aFront.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE) : aFront.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
926 anAspFill.Front.IsSpecular == 1 ? aFront.SetReflectionModeOn (Graphic3d_TOR_SPECULAR) : aFront.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
927 anAspFill.Front.IsEmission == 1 ? aFront.SetReflectionModeOn (Graphic3d_TOR_EMISSION) : aFront.SetReflectionModeOff (Graphic3d_TOR_EMISSION);
929 aColor.SetValues (Standard_Real (anAspFill.Front.ColorSpec.r),
930 Standard_Real (anAspFill.Front.ColorSpec.g),
931 Standard_Real (anAspFill.Front.ColorSpec.b), Quantity_TOC_RGB);
932 aFront.SetSpecularColor (aColor);
934 aColor.SetValues (Standard_Real (anAspFill.Front.ColorAmb.r),
935 Standard_Real (anAspFill.Front.ColorAmb.g),
936 Standard_Real (anAspFill.Front.ColorAmb.b), Quantity_TOC_RGB);
937 aFront.SetAmbientColor (aColor);
939 aColor.SetValues (Standard_Real (anAspFill.Front.ColorDif.r),
940 Standard_Real (anAspFill.Front.ColorDif.g),
941 Standard_Real (anAspFill.Front.ColorDif.b), Quantity_TOC_RGB);
942 aFront.SetDiffuseColor (aColor);
944 aColor.SetValues (Standard_Real (anAspFill.Front.ColorEms.r),
945 Standard_Real (anAspFill.Front.ColorEms.g),
946 Standard_Real (anAspFill.Front.ColorEms.b), Quantity_TOC_RGB);
947 aFront.SetEmissiveColor (aColor);
949 aFront.SetEnvReflexion (anAspFill.Front.EnvReflexion);
951 aFront.SetRefractionIndex (Standard_Real (anAspFill.Front.RefractionIndex));
952 aFront.SetBSDF (anAspFill.Front.BSDF);
955 anAspFill.Edge == 1 ? theAspFill->SetEdgeOn() : theAspFill->SetEdgeOff();
957 theAspFill->SetHatchStyle (Aspect_HatchStyle (anAspFill.Hatch));
959 // Front and Back face
960 anAspFill.Distinguish == 1 ? theAspFill->SetDistinguishOn() : theAspFill->SetDistinguishOff();
961 anAspFill.BackFace == 1 ? theAspFill->SuppressBackFace() : theAspFill->AllowBackFace();
963 theAspFill->SetTextureMap (anAspFill.Texture.TextureMap);
964 anAspFill.Texture.doTextureMap == 1 ? theAspFill->SetTextureMapOn() : theAspFill->SetTextureMapOff();
965 theAspFill->SetShaderProgram (anAspFill.ShaderProgram);
966 theAspFill->SetPolygonOffsets (anAspFill.PolygonOffsetMode,
967 anAspFill.PolygonOffsetFactor,
968 anAspFill.PolygonOffsetUnits);
969 theAspFill->SetBackMaterial (aBack);
970 theAspFill->SetFrontMaterial (aFront);
973 // =======================================================================
974 // function : PrimitivesAspect
976 // =======================================================================
977 void Graphic3d_Group::PrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& theAspLine,
978 const Handle(Graphic3d_AspectText3d)& theAspText,
979 const Handle(Graphic3d_AspectMarker3d)& theAspMarker,
980 const Handle(Graphic3d_AspectFillArea3d)& theAspFill) const
982 GroupPrimitivesAspect (theAspLine, theAspText, theAspMarker, theAspFill);
985 // =======================================================================
986 // function : AddPrimitiveArray
988 // =======================================================================
989 void Graphic3d_Group::AddPrimitiveArray (const Handle(Graphic3d_ArrayOfPrimitives)& thePrim,
990 const Standard_Boolean theToEvalMinMax)
993 || !thePrim->IsValid())
998 AddPrimitiveArray (thePrim->Type(), thePrim->Indices(), thePrim->Attributes(), thePrim->Bounds(), theToEvalMinMax);
1001 // =======================================================================
1002 // function : AddPrimitiveArray
1004 // =======================================================================
1005 void Graphic3d_Group::AddPrimitiveArray (const Graphic3d_TypeOfPrimitiveArray theType,
1006 const Handle(Graphic3d_IndexBuffer)& ,
1007 const Handle(Graphic3d_Buffer)& theAttribs,
1008 const Handle(Graphic3d_BoundBuffer)& ,
1009 const Standard_Boolean theToEvalMinMax)
1012 || theAttribs.IsNull())
1017 if (!MyContainsFacet
1018 && theType != Graphic3d_TOPA_POLYLINES
1019 && theType != Graphic3d_TOPA_SEGMENTS
1020 && theType != Graphic3d_TOPA_POINTS)
1022 myStructure->GroupsWithFacet (1);
1023 MyContainsFacet = Standard_True;
1026 if (theToEvalMinMax)
1028 const Standard_Integer aNbVerts = theAttribs->NbElements;
1029 for (Standard_Integer anAttribIter = 0; anAttribIter < theAttribs->NbAttributes; ++anAttribIter)
1031 const Graphic3d_Attribute& anAttrib = theAttribs->Attribute (anAttribIter);
1032 if (anAttrib.Id != Graphic3d_TOA_POS)
1037 const size_t anOffset = theAttribs->AttributeOffset (anAttribIter);
1038 switch (anAttrib.DataType)
1040 case Graphic3d_TOD_VEC2:
1042 for (Standard_Integer aVertIter = 0; aVertIter < aNbVerts; ++aVertIter)
1044 const Graphic3d_Vec2& aVert = *reinterpret_cast<const Graphic3d_Vec2* >(theAttribs->value (aVertIter) + anOffset);
1045 myBounds.Add (Graphic3d_Vec4 (aVert.x(), aVert.y(), 0.0f, 1.0f));
1049 case Graphic3d_TOD_VEC3:
1050 case Graphic3d_TOD_VEC4:
1052 for (Standard_Integer aVertIter = 0; aVertIter < aNbVerts; ++aVertIter)
1054 const Graphic3d_Vec3& aVert = *reinterpret_cast<const Graphic3d_Vec3* >(theAttribs->value (aVertIter) + anOffset);
1055 myBounds.Add (Graphic3d_Vec4 (aVert.x(), aVert.y(), aVert.z(), 1.0f));
1068 // =======================================================================
1069 // function : Marker
1071 // =======================================================================
1072 void Graphic3d_Group::Marker (const Graphic3d_Vertex& thePoint,
1073 const Standard_Boolean theToEvalMinMax)
1075 Handle(Graphic3d_ArrayOfPoints) aPoints = new Graphic3d_ArrayOfPoints (1);
1076 aPoints->AddVertex (thePoint.X(), thePoint.Y(), thePoint.Z());
1077 AddPrimitiveArray (aPoints, theToEvalMinMax);
1080 // =======================================================================
1081 // function : UserDraw
1083 // =======================================================================
1084 void Graphic3d_Group::UserDraw (const Standard_Address /*theObject*/,
1085 const Standard_Boolean /*theToEvalMinMax*/,
1086 const Standard_Boolean theContainsFacet)
1093 // Without this modification, the group assumes the primitive contains
1094 // no polygons and does not require the Z-buffer for display.
1095 if (!MyContainsFacet && theContainsFacet)
1097 myStructure->GroupsWithFacet (1);
1098 MyContainsFacet = Standard_True;
1104 // =======================================================================
1107 // =======================================================================
1108 void Graphic3d_Group::Text (const Standard_CString /*theText*/,
1109 const Graphic3d_Vertex& thePoint,
1110 const Standard_Real /*theHeight*/,
1111 const Quantity_PlaneAngle /*theAngle*/,
1112 const Graphic3d_TextPath /*theTp*/,
1113 const Graphic3d_HorizontalTextAlignment /*theHta*/,
1114 const Graphic3d_VerticalTextAlignment /*theVta*/,
1115 const Standard_Boolean theToEvalMinMax)
1122 if (theToEvalMinMax)
1124 Standard_ShortReal x, y, z;
1125 thePoint.Coord (x, y, z);
1126 myStructure->CStructure()->Is2dText = Standard_True;
1127 myBounds.Add (Graphic3d_Vec4 (static_cast<Standard_ShortReal> (x),
1128 static_cast<Standard_ShortReal> (y),
1129 static_cast<Standard_ShortReal> (z),
1135 // =======================================================================
1138 // =======================================================================
1139 void Graphic3d_Group::Text (const Standard_CString theText,
1140 const Graphic3d_Vertex& thePoint,
1141 const Standard_Real theHeight,
1142 const Standard_Boolean theToEvalMinMax)
1144 Text (theText, thePoint, theHeight, 0.0,
1145 Graphic3d_TP_RIGHT, Graphic3d_HTA_LEFT, Graphic3d_VTA_BOTTOM, theToEvalMinMax);
1148 // =======================================================================
1151 // =======================================================================
1152 void Graphic3d_Group::Text (const TCollection_ExtendedString& theText,
1153 const Graphic3d_Vertex& thePoint,
1154 const Standard_Real theHeight,
1155 const Quantity_PlaneAngle theAngle,
1156 const Graphic3d_TextPath theTp,
1157 const Graphic3d_HorizontalTextAlignment theHta,
1158 const Graphic3d_VerticalTextAlignment theVta,
1159 const Standard_Boolean theToEvalMinMax)
1161 const NCollection_String aText ((Standard_Utf16Char* )theText.ToExtString());
1162 Text (aText.ToCString(), thePoint, theHeight, theAngle,
1163 theTp, theHta, theVta, theToEvalMinMax);
1166 // =======================================================================
1169 // =======================================================================
1170 void Graphic3d_Group::Text (const TCollection_ExtendedString& theText,
1171 const gp_Ax2& theOrientation,
1172 const Standard_Real theHeight,
1173 const Quantity_PlaneAngle theAngle,
1174 const Graphic3d_TextPath theTP,
1175 const Graphic3d_HorizontalTextAlignment theHTA,
1176 const Graphic3d_VerticalTextAlignment theVTA,
1177 const Standard_Boolean theToEvalMinMax)
1179 const NCollection_String aText ((Standard_Utf16Char*)(theText.ToExtString()));
1180 Text (aText.ToCString(),
1190 // =======================================================================
1193 // =======================================================================
1194 void Graphic3d_Group::Text (const Standard_CString /*theText*/,
1195 const gp_Ax2& theOrientation,
1196 const Standard_Real /*theHeight*/,
1197 const Quantity_PlaneAngle /*theAngle*/,
1198 const Graphic3d_TextPath /*theTp*/,
1199 const Graphic3d_HorizontalTextAlignment /*theHta*/,
1200 const Graphic3d_VerticalTextAlignment /*theVta*/,
1201 const Standard_Boolean theToEvalMinMax)
1208 if (theToEvalMinMax)
1210 myStructure->CStructure()->Is2dText = Standard_False;
1211 myBounds.Add (Graphic3d_Vec4 (static_cast<Standard_ShortReal> (theOrientation.Location().X()),
1212 static_cast<Standard_ShortReal> (theOrientation.Location().Y()),
1213 static_cast<Standard_ShortReal> (theOrientation.Location().Z()),
1219 // =======================================================================
1222 // =======================================================================
1223 void Graphic3d_Group::Text (const TCollection_ExtendedString& theText,
1224 const Graphic3d_Vertex& thePoint,
1225 const Standard_Real theHeight,
1226 const Standard_Boolean theToEvalMinMax)
1228 const NCollection_String aText ((Standard_Utf16Char* )theText.ToExtString());
1229 Text (aText.ToCString(), thePoint, theHeight, 0.0,
1230 Graphic3d_TP_RIGHT, Graphic3d_HTA_LEFT, Graphic3d_VTA_BOTTOM, theToEvalMinMax);
1233 // =======================================================================
1234 // function : SetClosed
1236 // =======================================================================
1237 void Graphic3d_Group::SetClosed (const Standard_Boolean theIsClosed)
1239 myIsClosed = theIsClosed;
1242 // =======================================================================
1243 // function : IsClosed
1245 // =======================================================================
1246 Standard_Boolean Graphic3d_Group::IsClosed() const
1251 //=======================================================================
1252 //function : BoundingBox
1254 //=======================================================================
1255 const Graphic3d_BndBox4f& Graphic3d_Group::BoundingBox() const
1260 //=======================================================================
1261 //function : ChangeBoundingBox
1263 //=======================================================================
1264 Graphic3d_BndBox4f& Graphic3d_Group::ChangeBoundingBox()