1 // Created by: NW,JPB,CAL
2 // Copyright (c) 1991-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #include <Graphic3d_AspectMarker3d.ixx>
17 #include <TColStd_Array1OfByte.hxx>
18 #include <Image_PixMap.hxx>
19 #include <Graphic3d_MarkerImage.hxx>
21 // =======================================================================
22 // function : Graphic3d_AspectMarker3d
24 // =======================================================================
25 Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d()
26 : Aspect_AspectMarker()
29 // =======================================================================
30 // function : Graphic3d_AspectMarker3d
32 // =======================================================================
33 Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Aspect_TypeOfMarker theType,
34 const Quantity_Color& theColor,
35 const Standard_Real theScale)
36 : Aspect_AspectMarker (theColor, theType, theScale)
39 // =======================================================================
40 // function : Graphic3d_AspectMarker3d
42 // =======================================================================
43 Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Quantity_Color& theColor,
44 const Standard_Integer theWidth,
45 const Standard_Integer theHeight,
46 const Handle(TColStd_HArray1OfByte)& theTextureBitMap)
47 : Aspect_AspectMarker (theColor, Aspect_TOM_USERDEFINED, 1.0),
48 myMarkerImage (new Graphic3d_MarkerImage (theTextureBitMap, theWidth, theHeight))
51 // =======================================================================
52 // function : Graphic3d_AspectMarker3d
54 // =======================================================================
55 Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Handle(Image_PixMap)& theTextureImage)
56 : Aspect_AspectMarker (Quantity_NOC_YELLOW, Aspect_TOM_USERDEFINED, 1.0),
57 myMarkerImage (new Graphic3d_MarkerImage (theTextureImage))
60 // =======================================================================
61 // function : GetTextureSize
63 // =======================================================================
64 void Graphic3d_AspectMarker3d::GetTextureSize (Standard_Integer& theWidth,
65 Standard_Integer& theHeight) const
67 if (!myMarkerImage.IsNull())
69 myMarkerImage->GetTextureSize (theWidth, theHeight);
78 // =======================================================================
79 // function : GetMarkerImage
81 // =======================================================================
82 const Handle(Graphic3d_MarkerImage)& Graphic3d_AspectMarker3d::GetMarkerImage() const
87 // =======================================================================
88 // function : SetMarkerImage
90 // =======================================================================
91 void Graphic3d_AspectMarker3d::SetMarkerImage (const Handle(Graphic3d_MarkerImage)& theImage)
93 myMarkerImage = theImage;
96 // =======================================================================
97 // function : SetBitMap
99 // =======================================================================
100 void Graphic3d_AspectMarker3d::SetBitMap (const Standard_Integer theWidth,
101 const Standard_Integer theHeight,
102 const Handle(TColStd_HArray1OfByte)& theTextureBitMap)
104 myMarkerImage.Nullify();
105 myMarkerImage = new Graphic3d_MarkerImage (theTextureBitMap, theWidth, theHeight);
108 // =======================================================================
109 // function : SetShaderProgram
111 // =======================================================================
112 void Graphic3d_AspectMarker3d::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram)
114 MyShaderProgram = theProgram;
117 // =======================================================================
118 // function : ShaderProgram
120 // =======================================================================
121 const Handle(Graphic3d_ShaderProgram)& Graphic3d_AspectMarker3d::ShaderProgram() const
123 return MyShaderProgram;