1 // Copyright (c) 2019 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #include <Graphic3d_Aspects.hxx>
15 #include <Standard_Dump.hxx>
17 IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Aspects, Standard_Transient)
19 // =======================================================================
20 // function : Graphic3d_Aspects
22 // =======================================================================
23 Graphic3d_Aspects::Graphic3d_Aspects()
24 : myInteriorColor (Quantity_NOC_CYAN1),
25 myBackInteriorColor (Quantity_NOC_CYAN1),
26 myEdgeColor (Quantity_NOC_WHITE),
27 myInteriorStyle (Aspect_IS_SOLID),
28 myShadingModel (Graphic3d_TOSM_DEFAULT),
29 myAlphaMode (Graphic3d_AlphaMode_BlendAuto),
31 myLineType (Aspect_TOL_SOLID),
33 myLinePattern (0xFFFF),
34 myMarkerType (Aspect_TOM_POINT),
36 myTextStyle (Aspect_TOST_NORMAL),
37 myTextDisplayType (Aspect_TODT_NORMAL),
38 myTextFontAspect (Font_FontAspect_Regular),
40 myToSkipFirstEdge (false),
41 myToDistinguishMaterials (false),
42 myToDrawEdges (false),
43 myToDrawSilhouette (false),
44 myToSuppressBackFaces (true),
45 myToMapTexture (false),
46 myIsTextZoomable (false)
51 // =======================================================================
52 // function : SetTextureMap
54 // =======================================================================
55 void Graphic3d_Aspects::SetTextureMap (const Handle(Graphic3d_TextureMap)& theTexture)
57 if (theTexture.IsNull())
59 myTextureSet.Nullify();
63 myTextureSet = new Graphic3d_TextureSet (theTexture);
66 //=======================================================================
69 //=======================================================================
70 void Graphic3d_Aspects::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
72 OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
74 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myInteriorColor)
75 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBackInteriorColor)
76 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myEdgeColor)
77 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPolygonOffset)
79 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToSkipFirstEdge)
80 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToDistinguishMaterials)
81 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToDrawEdges)
82 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToDrawSilhouette)
83 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToSuppressBackFaces)
84 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToMapTexture)
85 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsTextZoomable)
87 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAlphaMode)
88 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAlphaCutoff)
90 if (!myTextFont.IsNull())
92 OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myTextFont->String())
95 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTextStyle)
96 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTextDisplayType)
97 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTextFontAspect)
98 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTextAngle)