b311480e |
1 | // Created by: NW,JPB,CAL |
2 | // Copyright (c) 1991-1999 Matra Datavision |
3 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
4 | // |
5 | // The content of this file is subject to the Open CASCADE Technology Public |
6 | // License Version 6.5 (the "License"). You may not use the content of this file |
7 | // except in compliance with the License. Please obtain a copy of the License |
8 | // at http://www.opencascade.org and read it completely before using this file. |
9 | // |
10 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
11 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
12 | // |
13 | // The Original Code and all software distributed under the License is |
14 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
15 | // Initial Developer hereby disclaims all such warranties, including without |
16 | // limitation, any warranties of merchantability, fitness for a particular |
17 | // purpose or non-infringement. Please see the License for the specific terms |
18 | // and conditions governing the rights and limitations under the License. |
19 | |
7fd59977 |
20 | #include <Graphic3d_AspectMarker3d.ixx> |
21 | #include <TColStd_Array1OfByte.hxx> |
a577aaab |
22 | #include <Image_PixMap.hxx> |
23 | #include <Graphic3d_MarkerImage.hxx> |
24 | |
25 | // ======================================================================= |
26 | // function : Graphic3d_AspectMarker3d |
27 | // purpose : |
28 | // ======================================================================= |
29 | Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d() |
30 | : Aspect_AspectMarker() |
31 | {} |
32 | |
33 | // ======================================================================= |
34 | // function : Graphic3d_AspectMarker3d |
35 | // purpose : |
36 | // ======================================================================= |
37 | Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Aspect_TypeOfMarker theType, |
38 | const Quantity_Color& theColor, |
39 | const Standard_Real theScale) |
40 | : Aspect_AspectMarker (theColor, theType, theScale) |
41 | {} |
42 | |
43 | // ======================================================================= |
44 | // function : Graphic3d_AspectMarker3d |
45 | // purpose : |
46 | // ======================================================================= |
47 | Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Quantity_Color& theColor, |
48 | const Standard_Integer theWidth, |
49 | const Standard_Integer theHeight, |
50 | const Handle(TColStd_HArray1OfByte)& theTextureBitMap) |
51 | : Aspect_AspectMarker (theColor, Aspect_TOM_USERDEFINED, 1.0), |
52 | myMarkerImage (new Graphic3d_MarkerImage (theTextureBitMap, theWidth, theHeight)) |
53 | {} |
54 | |
55 | // ======================================================================= |
56 | // function : Graphic3d_AspectMarker3d |
57 | // purpose : |
58 | // ======================================================================= |
59 | Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Handle(Image_PixMap)& theTextureImage) |
60 | : Aspect_AspectMarker (Quantity_NOC_YELLOW, Aspect_TOM_USERDEFINED, 1.0), |
61 | myMarkerImage (new Graphic3d_MarkerImage (theTextureImage)) |
62 | {} |
63 | |
64 | // ======================================================================= |
65 | // function : GetTextureSize |
66 | // purpose : |
67 | // ======================================================================= |
68 | void Graphic3d_AspectMarker3d::GetTextureSize (Standard_Integer& theWidth, |
69 | Standard_Integer& theHeight) const |
7fd59977 |
70 | { |
a577aaab |
71 | if (!myMarkerImage.IsNull()) |
72 | { |
73 | myMarkerImage->GetTextureSize (theWidth, theHeight); |
74 | } |
75 | else |
76 | { |
77 | theWidth = 0; |
78 | theHeight = 0; |
79 | } |
7fd59977 |
80 | } |
81 | |
a577aaab |
82 | // ======================================================================= |
83 | // function : GetMarkerImage |
84 | // purpose : |
85 | // ======================================================================= |
86 | const Handle(Graphic3d_MarkerImage)& Graphic3d_AspectMarker3d::GetMarkerImage() const |
7fd59977 |
87 | { |
a577aaab |
88 | return myMarkerImage; |
7fd59977 |
89 | } |
90 | |
a577aaab |
91 | // ======================================================================= |
92 | // function : SetBitMap |
93 | // purpose : |
94 | // ======================================================================= |
95 | void Graphic3d_AspectMarker3d::SetBitMap (const Standard_Integer theWidth, |
96 | const Standard_Integer theHeight, |
97 | const Handle(TColStd_HArray1OfByte)& theTextureBitMap) |
7fd59977 |
98 | { |
a577aaab |
99 | myMarkerImage.Nullify(); |
100 | myMarkerImage = new Graphic3d_MarkerImage (theTextureBitMap, theWidth, theHeight); |
7fd59977 |
101 | } |
30f0ad28 |
102 | |
103 | // ======================================================================= |
104 | // function : SetShaderProgram |
105 | // purpose : |
106 | // ======================================================================= |
107 | void Graphic3d_AspectMarker3d::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram) |
108 | { |
109 | MyShaderProgram = theProgram; |
110 | } |
111 | |
112 | // ======================================================================= |
113 | // function : ShaderProgram |
114 | // purpose : |
115 | // ======================================================================= |
116 | const Handle(Graphic3d_ShaderProgram)& Graphic3d_AspectMarker3d::ShaderProgram() const |
117 | { |
118 | return MyShaderProgram; |
119 | } |