MyGUI  3.2.1
MyGUI_PolygonalSkin.h
Go to the documentation of this file.
1 /*
2  * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3  * Distributed under the MIT License
4  * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5  */
6 
7 #ifndef __MYGUI_POLYGONAL_SKIN_H__
8 #define __MYGUI_POLYGONAL_SKIN_H__
9 
10 #include "MyGUI_Prerequest.h"
11 #include "MyGUI_Types.h"
12 #include "MyGUI_ISubWidgetRect.h"
13 #include "MyGUI_RenderFormat.h"
14 
15 namespace MyGUI
16 {
17 
19  public ISubWidgetRect
20  {
22 
23  public:
24  PolygonalSkin();
25  virtual ~PolygonalSkin();
26 
28  void setPoints(const std::vector<FloatPoint>& _points);
29 
31  void setWidth(float _width);
32 
34  void setStroke(size_t _value);
35 
36  virtual void setAlpha(float _alpha);
37 
38  virtual void setVisible(bool _visible);
39 
40  virtual void setStateData(IStateInfo* _data);
41 
42  virtual void createDrawItem(ITexture* _texture, ILayerNode* _node);
43  virtual void destroyDrawItem();
44 
45  // метод для отрисовки себя
46  virtual void doRender();
47 
48  /*internal:*/
49  virtual void _updateView();
50  virtual void _correctView();
51 
52  virtual void _setAlign(const IntSize& _oldsize);
53 
54  virtual void _setUVSet(const FloatRect& _rect);
55  virtual void _setColour(const Colour& _value);
56 
57  protected:
58  void _rebuildGeometry();
59  FloatPoint _getPerpendicular(const FloatPoint& _point1, const FloatPoint& _point2);
60  // line from center of p1-p2 line to p3
61  FloatPoint _getMiddleLine(const FloatPoint& _point1, const FloatPoint& _point2, const FloatPoint& _point3);
62 
63  private:
64  bool mGeometryOutdated;
65 
66  float mLineWidth;
67  size_t mLineStroke;
68  std::vector<FloatPoint> mLinePoints;
69  float mLineLength;
70 
71  std::vector<FloatPoint> mResultVerticiesPos;
72  std::vector<FloatPoint> mResultVerticiesUV;
73 
74  size_t mVertexCount;
75 
76  bool mEmptyView;
77 
78  VertexColourType mVertexFormat;
79  uint32 mCurrentColour;
80 
81  FloatRect mCurrentTexture;
82  IntCoord mCurrentCoord;
83 
84  ILayerNode* mNode;
85  RenderItem* mRenderItem;
86  };
87 
88 } // namespace MyGUI
89 
90 #endif // __MYGUI_POLYGONAL_SKIN_H__