0024752: Visualization - inherit OpenGl_Group from Graphic3d_Group
[occt.git] / src / Graphic3d / Graphic3d_AspectMarker3d.cxx
CommitLineData
b311480e 1// Created by: NW,JPB,CAL
2// Copyright (c) 1991-1999 Matra Datavision
973c2be1 3// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 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
973c2be1 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
7fd59977 16#include <Graphic3d_AspectMarker3d.ixx>
17#include <TColStd_Array1OfByte.hxx>
a577aaab 18#include <Image_PixMap.hxx>
19#include <Graphic3d_MarkerImage.hxx>
20
21// =======================================================================
22// function : Graphic3d_AspectMarker3d
23// purpose :
24// =======================================================================
25Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d()
26: Aspect_AspectMarker()
27{}
28
29// =======================================================================
30// function : Graphic3d_AspectMarker3d
31// purpose :
32// =======================================================================
33Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Aspect_TypeOfMarker theType,
34 const Quantity_Color& theColor,
35 const Standard_Real theScale)
36: Aspect_AspectMarker (theColor, theType, theScale)
37{}
38
39// =======================================================================
40// function : Graphic3d_AspectMarker3d
41// purpose :
42// =======================================================================
43Graphic3d_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))
49{}
50
51// =======================================================================
52// function : Graphic3d_AspectMarker3d
53// purpose :
54// =======================================================================
55Graphic3d_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))
58{}
59
60// =======================================================================
61// function : GetTextureSize
62// purpose :
63// =======================================================================
64void Graphic3d_AspectMarker3d::GetTextureSize (Standard_Integer& theWidth,
65 Standard_Integer& theHeight) const
7fd59977 66{
a577aaab 67 if (!myMarkerImage.IsNull())
68 {
69 myMarkerImage->GetTextureSize (theWidth, theHeight);
70 }
71 else
72 {
73 theWidth = 0;
74 theHeight = 0;
75 }
7fd59977 76}
77
a577aaab 78// =======================================================================
79// function : GetMarkerImage
80// purpose :
81// =======================================================================
82const Handle(Graphic3d_MarkerImage)& Graphic3d_AspectMarker3d::GetMarkerImage() const
7fd59977 83{
a577aaab 84 return myMarkerImage;
7fd59977 85}
86
a577aaab 87// =======================================================================
b64d84be 88// function : SetMarkerImage
89// purpose :
90// =======================================================================
91void Graphic3d_AspectMarker3d::SetMarkerImage (const Handle(Graphic3d_MarkerImage)& theImage)
92{
93 myMarkerImage = theImage;
94}
95
96// =======================================================================
a577aaab 97// function : SetBitMap
98// purpose :
99// =======================================================================
100void Graphic3d_AspectMarker3d::SetBitMap (const Standard_Integer theWidth,
101 const Standard_Integer theHeight,
102 const Handle(TColStd_HArray1OfByte)& theTextureBitMap)
7fd59977 103{
a577aaab 104 myMarkerImage.Nullify();
105 myMarkerImage = new Graphic3d_MarkerImage (theTextureBitMap, theWidth, theHeight);
7fd59977 106}
30f0ad28 107
108// =======================================================================
109// function : SetShaderProgram
110// purpose :
111// =======================================================================
112void Graphic3d_AspectMarker3d::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram)
113{
114 MyShaderProgram = theProgram;
115}
116
117// =======================================================================
118// function : ShaderProgram
119// purpose :
120// =======================================================================
121const Handle(Graphic3d_ShaderProgram)& Graphic3d_AspectMarker3d::ShaderProgram() const
122{
123 return MyShaderProgram;
124}