2 #ifndef _YI_NPATCH_SCENE_NODE_H_ 3 #define _YI_NPATCH_SCENE_NODE_H_ 34 virtual bool Init()
override;
39 bool SetNPatch(
const std::shared_ptr<CYIBitmap> &pNPatch);
68 virtual void SetSize(
const glm::vec3 &vSize,
bool bDirtyLayout =
true)
override;
87 static const uint32_t CONTENT_PATCH_PIXEL_MARKER = 0xFF000000;
88 static const uint32_t SCALE_PATCH_PIXEL_MARKER = 0xFF000000;
89 static const uint32_t FIXED_PATCH_PIXEL_MARKER = 0x00000000;
90 static const uint32_t EMPTY_PIXEL_MARKER = 0x00000000;
92 void RebuildMesh(
const glm::vec3 &vwsScale);
95 bool IsValidNPatch(
const std::shared_ptr<CYIBitmap> &pNPatch);
97 void InitColumnInfo(int32_t col, uint32_t nHorizontalPatchType, int32_t nLeftMark, int32_t nRightMark);
98 void InitRowInfo(int32_t row, uint32_t nVerticalPatchType, int32_t nTopMark, int32_t nBottomMark);
99 void PreProcessWidthSectionMarkers();
100 void PreProcessHeightSectionMarkers();
101 bool HasValidTopMarkers(
const std::shared_ptr<CYIBitmap> &pNPatch);
102 bool HasValidLeftMarkers(
const std::shared_ptr<CYIBitmap> &pNPatch);
103 bool HasValidBottomMarkers(
const std::shared_ptr<CYIBitmap> &pNPatch);
104 bool HasValidRightMarkers(
const std::shared_ptr<CYIBitmap> &pNPatch);
105 static std::shared_ptr<CYIAssetBufferObjectData> BuildNPatchVertices(
const std::vector<CYINPatchSceneNode::PATCH_INFO> &rColumnInfo, std::vector<CYINPatchSceneNode::PATCH_INFO> &rRowInfo,
float fTotalImageWidth,
float fTotalImageHeight,
float fHorizontalRemainder,
float fVerticalRemainder,
float &rWidthSum,
float &rHeightSum);
106 static std::shared_ptr<CYIAssetBufferObjectData> BuildNPatchTriangles(uint16_t uNumHorizontalPatches, uint16_t uNumVerticalPatches, int32_t &rIndicesCount);
107 static std::shared_ptr<CYIMesh> CreateNPatchMesh(
const std::vector<CYINPatchSceneNode::PATCH_INFO> &rColumnInfo, std::vector<CYINPatchSceneNode::PATCH_INFO> &rRowInfo,
float fTotalImageWidth,
float fTotalImageHeight,
float fScaleX = 1.0f,
float fScaleY = 1.0f);
109 int32_t m_nHorizontalPatches;
110 int32_t m_nVerticalPatches;
112 std::vector<PATCH_INFO> m_columnsInfo;
113 std::vector<PATCH_INFO> m_rowsInfo;
115 uint32_t m_nTotalScalableWidth;
116 uint32_t m_nTotalScalableHeight;
124 std::shared_ptr<CYIBitmap> m_pNPatch;
132 #ifdef YI_FUNCTION_SPECIALIZATION_FULLY_SUPPORTED 136 return pObject ? (pObject->CanCastTo<
CYINPatchSceneNode>() ? static_cast<const CYINPatchSceneNode *>(pObject) :
nullptr) :
nullptr;
140 #endif // _YI_NPATCH_SCENE_NODE_H_ glm::vec3 GetSizeScaleAdjustment() const
bool SetNPatch(const std::shared_ptr< CYIBitmap > &pNPatch)
virtual bool Init() override
Scene trees composed of CYISceneNode objects are registered with the scene manager in order for them ...
Definition: YiSceneManager.h:73
virtual void WorldSurfaceScaleUpdated() override
void ScaleToHeight(float nHeight)
Definition: YiPredef.h:183
The core bitmap container class used by You.i Engine.
Definition: YiBitmap.h:20
Specialized CYISceneNode holding a scalable N-Patch object.
Definition: YiNPatchSceneNode.h:28
#define YI_TYPE_BASES(...)
Definition: YiRtti.h:350
virtual ~CYINPatchSceneNode()
void ScaleToWidth(float nWidth)
A scene node is the base type for all nodes which are used by the scene manager; it is an integral pa...
Definition: YiSceneNode.h:114
virtual void SetSize(const glm::vec3 &vSize, bool bDirtyLayout=true) override
As asset container which wraps shared index or vertex buffer object data.
Definition: YiAssetBufferObjectData.h:17
void ScaleToSize(const glm::vec2 &vlsSize)