MyGUI  3.2.0
MyGUI_PolygonalSkin.h
Go to the documentation of this file.
1 
6 /*
7  This file is part of MyGUI.
8 
9  MyGUI is free software: you can redistribute it and/or modify
10  it under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  MyGUI is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
21 */
22 #ifndef __MYGUI_POLYGONAL_SKIN_H__
23 #define __MYGUI_POLYGONAL_SKIN_H__
24 
25 #include "MyGUI_Prerequest.h"
26 #include "MyGUI_Types.h"
27 #include "MyGUI_ISubWidgetRect.h"
28 #include "MyGUI_RenderFormat.h"
29 
30 namespace MyGUI
31 {
32 
34  public ISubWidgetRect
35  {
37 
38  public:
39  PolygonalSkin();
40  virtual ~PolygonalSkin();
41 
43  void setPoints(const std::vector<FloatPoint>& _points);
44 
46  void setWidth(float _width);
47 
48  virtual void setAlpha(float _alpha);
49 
50  virtual void setVisible(bool _visible);
51 
52  virtual void setStateData(IStateInfo* _data);
53 
54  virtual void createDrawItem(ITexture* _texture, ILayerNode* _node);
55  virtual void destroyDrawItem();
56 
57  // метод для отрисовки себя
58  virtual void doRender();
59 
60  /*internal:*/
61  virtual void _updateView();
62  virtual void _correctView();
63 
64  virtual void _setAlign(const IntSize& _oldsize);
65 
66  virtual void _setUVSet(const FloatRect& _rect);
67  virtual void _setColour(const Colour& _value);
68 
69  protected:
70  void _rebuildGeometry();
71  FloatPoint _getPerpendicular(const FloatPoint& _point1, const FloatPoint& _point2);
72  // line from center of p1-p2 line to p3
73  FloatPoint _getMiddleLine(const FloatPoint& _point1, const FloatPoint& _point2, const FloatPoint& _point3);
74 
75  private:
76  bool mGeometryOutdated;
77 
78  float mLineWidth;
79  std::vector<FloatPoint> mLinePoints;
80  float mLineLength;
81 
82  std::vector<FloatPoint> mResultVerticiesPos;
83  std::vector<FloatPoint> mResultVerticiesUV;
84 
85  size_t mVertexCount;
86 
87  bool mEmptyView;
88 
89  VertexColourType mVertexFormat;
90  uint32 mCurrentColour;
91 
92  FloatRect mCurrentTexture;
93  IntCoord mCurrentCoord;
94 
95  ILayerNode* mNode;
96  RenderItem* mRenderItem;
97  };
98 
99 } // namespace MyGUI
100 
101 #endif // __MYGUI_POLYGONAL_SKIN_H__