MyGUI 3.5.3
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"
13#include "MyGUI_RenderFormat.h"
14#include "MyGUI_VertexData.h"
15
16namespace MyGUI
17{
18
19 class MYGUI_EXPORT PolygonalSkin : public ISubWidgetRect
20 {
21 MYGUI_RTTI_DERIVED(PolygonalSkin)
22
23 public:
24 PolygonalSkin();
25
27 void setPoints(const std::vector<FloatPoint>& _points);
28
30 void setWidth(float _width);
31
33 void setStroke(size_t _value);
34
35 void setAlpha(float _alpha) override;
36
37 void setVisible(bool _visible) override;
38
39 void setStateData(IStateInfo* _data) override;
40
41 void createDrawItem(ITexture* _texture, ILayerNode* _node) override;
42 void destroyDrawItem() override;
43
44 void doRender() override;
45
46 /*internal:*/
47 void _updateView() override;
48 void _correctView() override;
49
50 void _setAlign(const IntSize& _oldsize) override;
51
52 void _setUVSet(const FloatRect& _rect) override;
53 void _setColour(const Colour& _value) override;
54
55 protected:
56 void _rebuildGeometry();
57 FloatPoint _getPerpendicular(const FloatPoint& _point1, const FloatPoint& _point2) const;
58 // line from center of p1-p2 line to p3
59 FloatPoint _getMiddleLine(const FloatPoint& _point1, const FloatPoint& _point2, const FloatPoint& _point3)
60 const;
61
62 private:
63 bool mGeometryOutdated{false};
64
65 float mLineWidth{1.0f};
66 size_t mLineStroke{0};
67 std::vector<FloatPoint> mLinePoints;
68 float mLineLength{0.0f};
69
70 std::vector<FloatPoint> mResultVerticiesPos;
71 std::vector<FloatPoint> mResultVerticiesUV;
72
73 size_t mVertexCount{VertexQuad::VertexCount};
74
75 bool mEmptyView{false};
76
77 VertexColourType mVertexFormat;
78 uint32 mCurrentColour{0xFFFFFFFF};
79
80 FloatRect mCurrentTexture;
81 IntCoord mCurrentCoord;
82
83 ILayerNode* mNode{nullptr};
84 RenderItem* mRenderItem{nullptr};
85 };
86
87} // namespace MyGUI
88
89#endif // MYGUI_POLYGONAL_SKIN_H_
#define MYGUI_EXPORT
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition MyGUI_RTTI.h:67
uint32_t uint32
Definition MyGUI_Types.h:47
types::TRect< float > FloatRect
Definition MyGUI_Types.h:33
types::TPoint< float > FloatPoint
Definition MyGUI_Types.h:27
types::TCoord< int > IntCoord
Definition MyGUI_Types.h:35