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 | |
42cf5bc1 |
16 | |
17 | #include <Graphic3d_AspectMarker3d.hxx> |
a577aaab |
18 | #include <Graphic3d_MarkerImage.hxx> |
42cf5bc1 |
19 | #include <Image_PixMap.hxx> |
20 | #include <Quantity_Color.hxx> |
21 | #include <Standard_Type.hxx> |
22 | #include <TColStd_Array1OfByte.hxx> |
a577aaab |
23 | |
92efcf78 |
24 | IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_AspectMarker3d,Aspect_AspectMarker) |
25 | |
a577aaab |
26 | // ======================================================================= |
27 | // function : Graphic3d_AspectMarker3d |
28 | // purpose : |
29 | // ======================================================================= |
30 | Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d() |
31 | : Aspect_AspectMarker() |
32 | {} |
33 | |
34 | // ======================================================================= |
35 | // function : Graphic3d_AspectMarker3d |
36 | // purpose : |
37 | // ======================================================================= |
38 | Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Aspect_TypeOfMarker theType, |
39 | const Quantity_Color& theColor, |
40 | const Standard_Real theScale) |
41 | : Aspect_AspectMarker (theColor, theType, theScale) |
42 | {} |
43 | |
44 | // ======================================================================= |
45 | // function : Graphic3d_AspectMarker3d |
46 | // purpose : |
47 | // ======================================================================= |
48 | Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Quantity_Color& theColor, |
49 | const Standard_Integer theWidth, |
50 | const Standard_Integer theHeight, |
51 | const Handle(TColStd_HArray1OfByte)& theTextureBitMap) |
52 | : Aspect_AspectMarker (theColor, Aspect_TOM_USERDEFINED, 1.0), |
53 | myMarkerImage (new Graphic3d_MarkerImage (theTextureBitMap, theWidth, theHeight)) |
54 | {} |
55 | |
56 | // ======================================================================= |
57 | // function : Graphic3d_AspectMarker3d |
58 | // purpose : |
59 | // ======================================================================= |
60 | Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Handle(Image_PixMap)& theTextureImage) |
61 | : Aspect_AspectMarker (Quantity_NOC_YELLOW, Aspect_TOM_USERDEFINED, 1.0), |
62 | myMarkerImage (new Graphic3d_MarkerImage (theTextureImage)) |
63 | {} |
64 | |
65 | // ======================================================================= |
66 | // function : GetTextureSize |
67 | // purpose : |
68 | // ======================================================================= |
69 | void Graphic3d_AspectMarker3d::GetTextureSize (Standard_Integer& theWidth, |
70 | Standard_Integer& theHeight) const |
7fd59977 |
71 | { |
a577aaab |
72 | if (!myMarkerImage.IsNull()) |
73 | { |
74 | myMarkerImage->GetTextureSize (theWidth, theHeight); |
75 | } |
76 | else |
77 | { |
78 | theWidth = 0; |
79 | theHeight = 0; |
80 | } |
7fd59977 |
81 | } |
82 | |
a577aaab |
83 | // ======================================================================= |
84 | // function : GetMarkerImage |
85 | // purpose : |
86 | // ======================================================================= |
87 | const Handle(Graphic3d_MarkerImage)& Graphic3d_AspectMarker3d::GetMarkerImage() const |
7fd59977 |
88 | { |
a577aaab |
89 | return myMarkerImage; |
7fd59977 |
90 | } |
91 | |
b64d84be |
92 | // ======================================================================= |
93 | // function : SetMarkerImage |
94 | // purpose : |
95 | // ======================================================================= |
96 | void Graphic3d_AspectMarker3d::SetMarkerImage (const Handle(Graphic3d_MarkerImage)& theImage) |
97 | { |
98 | myMarkerImage = theImage; |
99 | } |
100 | |
a577aaab |
101 | // ======================================================================= |
102 | // function : SetBitMap |
103 | // purpose : |
104 | // ======================================================================= |
105 | void Graphic3d_AspectMarker3d::SetBitMap (const Standard_Integer theWidth, |
106 | const Standard_Integer theHeight, |
107 | const Handle(TColStd_HArray1OfByte)& theTextureBitMap) |
7fd59977 |
108 | { |
a577aaab |
109 | myMarkerImage.Nullify(); |
110 | myMarkerImage = new Graphic3d_MarkerImage (theTextureBitMap, theWidth, theHeight); |
7fd59977 |
111 | } |
30f0ad28 |
112 | |
113 | // ======================================================================= |
114 | // function : SetShaderProgram |
115 | // purpose : |
116 | // ======================================================================= |
117 | void Graphic3d_AspectMarker3d::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram) |
118 | { |
119 | MyShaderProgram = theProgram; |
120 | } |
121 | |
122 | // ======================================================================= |
123 | // function : ShaderProgram |
124 | // purpose : |
125 | // ======================================================================= |
126 | const Handle(Graphic3d_ShaderProgram)& Graphic3d_AspectMarker3d::ShaderProgram() const |
127 | { |
128 | return MyShaderProgram; |
129 | } |