MyGUI
3.2.1
|
00001 /* 00002 * This source file is part of MyGUI. For the latest info, see http://mygui.info/ 00003 * Distributed under the MIT License 00004 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT) 00005 */ 00006 00007 #ifndef __MYGUI_POLYGONAL_SKIN_H__ 00008 #define __MYGUI_POLYGONAL_SKIN_H__ 00009 00010 #include "MyGUI_Prerequest.h" 00011 #include "MyGUI_Types.h" 00012 #include "MyGUI_ISubWidgetRect.h" 00013 #include "MyGUI_RenderFormat.h" 00014 00015 namespace MyGUI 00016 { 00017 00018 class MYGUI_EXPORT PolygonalSkin : 00019 public ISubWidgetRect 00020 { 00021 MYGUI_RTTI_DERIVED( PolygonalSkin ) 00022 00023 public: 00024 PolygonalSkin(); 00025 virtual ~PolygonalSkin(); 00026 00028 void setPoints(const std::vector<FloatPoint>& _points); 00029 00031 void setWidth(float _width); 00032 00034 void setStroke(size_t _value); 00035 00036 virtual void setAlpha(float _alpha); 00037 00038 virtual void setVisible(bool _visible); 00039 00040 virtual void setStateData(IStateInfo* _data); 00041 00042 virtual void createDrawItem(ITexture* _texture, ILayerNode* _node); 00043 virtual void destroyDrawItem(); 00044 00045 // метод для отрисовки себя 00046 virtual void doRender(); 00047 00048 /*internal:*/ 00049 virtual void _updateView(); 00050 virtual void _correctView(); 00051 00052 virtual void _setAlign(const IntSize& _oldsize); 00053 00054 virtual void _setUVSet(const FloatRect& _rect); 00055 virtual void _setColour(const Colour& _value); 00056 00057 protected: 00058 void _rebuildGeometry(); 00059 FloatPoint _getPerpendicular(const FloatPoint& _point1, const FloatPoint& _point2); 00060 // line from center of p1-p2 line to p3 00061 FloatPoint _getMiddleLine(const FloatPoint& _point1, const FloatPoint& _point2, const FloatPoint& _point3); 00062 00063 private: 00064 bool mGeometryOutdated; 00065 00066 float mLineWidth; 00067 size_t mLineStroke; 00068 std::vector<FloatPoint> mLinePoints; 00069 float mLineLength; 00070 00071 std::vector<FloatPoint> mResultVerticiesPos; 00072 std::vector<FloatPoint> mResultVerticiesUV; 00073 00074 size_t mVertexCount; 00075 00076 bool mEmptyView; 00077 00078 VertexColourType mVertexFormat; 00079 uint32 mCurrentColour; 00080 00081 FloatRect mCurrentTexture; 00082 IntCoord mCurrentCoord; 00083 00084 ILayerNode* mNode; 00085 RenderItem* mRenderItem; 00086 }; 00087 00088 } // namespace MyGUI 00089 00090 #endif // __MYGUI_POLYGONAL_SKIN_H__