0030640: Visualization, Graphic3d_Camera - add option creating Projection matrix...
[occt.git] / src / Graphic3d / Graphic3d_Aspects.cxx
CommitLineData
bf5f0ca2 1// Copyright (c) 2019 OPEN CASCADE SAS
2//
3// This file is part of Open CASCADE Technology software library.
4//
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.
10//
11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
13
14#include <Graphic3d_Aspects.hxx>
0904aa63 15#include <Standard_Dump.hxx>
bf5f0ca2 16
17IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Aspects, Standard_Transient)
18
19// =======================================================================
20// function : Graphic3d_Aspects
21// purpose :
22// =======================================================================
23Graphic3d_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),
7fd4958d 29 myFaceCulling (Graphic3d_TypeOfBackfacingModel_Auto),
bf5f0ca2 30 myAlphaMode (Graphic3d_AlphaMode_BlendAuto),
31 myAlphaCutoff (0.5f),
32 myLineType (Aspect_TOL_SOLID),
33 myLineWidth (1.0f),
e0b24437 34 myLineFactor (1),
3f1675c9 35 myLinePattern (0xFFFF),
bf5f0ca2 36 myMarkerType (Aspect_TOM_POINT),
37 myMarkerScale (1.0f),
38 myTextStyle (Aspect_TOST_NORMAL),
39 myTextDisplayType (Aspect_TODT_NORMAL),
40 myTextFontAspect (Font_FontAspect_Regular),
41 myTextAngle (0.0f),
42 myToSkipFirstEdge (false),
43 myToDistinguishMaterials (false),
44 myToDrawEdges (false),
45 myToDrawSilhouette (false),
bf5f0ca2 46 myToMapTexture (false),
47 myIsTextZoomable (false)
48{
49 //
50}
51
52// =======================================================================
53// function : SetTextureMap
54// purpose :
55// =======================================================================
56void Graphic3d_Aspects::SetTextureMap (const Handle(Graphic3d_TextureMap)& theTexture)
57{
58 if (theTexture.IsNull())
59 {
60 myTextureSet.Nullify();
61 return;
62 }
63
64 myTextureSet = new Graphic3d_TextureSet (theTexture);
65}
0904aa63 66
67//=======================================================================
68//function : DumpJson
69//purpose :
70//=======================================================================
bc73b006 71void Graphic3d_Aspects::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
0904aa63 72{
bc73b006 73 OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
0904aa63 74
bc73b006 75 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myInteriorColor)
76 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBackInteriorColor)
77 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myEdgeColor)
78 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPolygonOffset)
0904aa63 79
bc73b006 80 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToSkipFirstEdge)
81 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToDistinguishMaterials)
82 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToDrawEdges)
83 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToDrawSilhouette)
7fd4958d 84 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFaceCulling)
bc73b006 85 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToMapTexture)
86 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsTextZoomable)
87
88 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAlphaMode)
89 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAlphaCutoff)
90
91 if (!myTextFont.IsNull())
92 {
93 OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myTextFont->String())
94 }
95
96 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTextStyle)
97 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTextDisplayType)
98 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTextFontAspect)
99 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTextAngle)
0904aa63 100}