MCPcopy Create free account
hub / github.com/MyGUI/mygui / _rebuildGeometry

Method _rebuildGeometry

MyGUIEngine/src/MyGUI_PolygonalSkin.cpp:274–502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272 }
273
274 void PolygonalSkin::_rebuildGeometry()
275 {
276 if (mLinePoints.size() < 2)
277 return;
278 if (!mRenderItem || !mRenderItem->getRenderTarget())
279 return;
280
281 mGeometryOutdated = false;
282
283 // using mCurrentCoord as rectangle where we draw polygons
284
285 // base texture coordinates
286 FloatPoint baseVerticiesUV[4] = {
287 FloatPoint(mCurrentTexture.left, mCurrentTexture.top),
288 FloatPoint(mCurrentTexture.right, mCurrentTexture.top),
289 FloatPoint(mCurrentTexture.right, mCurrentTexture.bottom),
290 FloatPoint(mCurrentTexture.left, mCurrentTexture.bottom)};
291
292 // UV vectors
293 FloatPoint vectorU = baseVerticiesUV[1] - baseVerticiesUV[0];
294 //FloatPoint vectorV = baseVerticiesUV[3] - baseVerticiesUV[0];
295
296 mResultVerticiesPos.clear();
297 mResultVerticiesUV.clear();
298 // add first two verticies
299 FloatPoint normal = _getPerpendicular(mLinePoints[0], mLinePoints[1]);
300
301 FloatPoint points[2] = {mLinePoints[0] + normal, mLinePoints[0] - normal};
302 FloatPoint pointsUV[2] = {baseVerticiesUV[0], baseVerticiesUV[3]};
303
304 bool draw = true;
305 size_t stroke = 0;
306
307 // add other verticies
308 float currentLength = 0.0f;
309 for (size_t i = 1; i < mLinePoints.size(); ++i)
310 {
311 if (mLineStroke != 0)
312 {
313 stroke++;
314 if (stroke == mLineStroke)
315 {
316 stroke = 0;
317 draw = !draw;
318 }
319 }
320
321 currentLength +=
322 len(mLinePoints[i - 1].left - mLinePoints[i].left, mLinePoints[i - 1].top - mLinePoints[i].top);
323
324 // getting normal between previous and next point
325 if (i != mLinePoints.size() - 1)
326 normal = _getMiddleLine(mLinePoints[i - 1], mLinePoints[i + 1], mLinePoints[i]);
327 else
328 normal = _getPerpendicular(mLinePoints[i - 1], mLinePoints[i]);
329
330 bool edge = false;
331 bool sharp = false;

Callers

nothing calls this directly

Calls 13

cropPolygonFunction · 0.85
getPositionInsideRectFunction · 0.85
getInfoMethod · 0.80
lenFunction · 0.70
FloatPointFunction · 0.50
swapFunction · 0.50
sizeMethod · 0.45
getRenderTargetMethod · 0.45
clearMethod · 0.45
push_backMethod · 0.45
reserveMethod · 0.45

Tested by

no test coverage detected