public float[] GetSmoothBorders() { if (smoothBorderTess == null) { return(smoothBorderTess = SmoothBorderBuilder.BuildSmoothBorders(coordXYs, out borderTriangleStripCount)); } return(smoothBorderTess); }
internal void CreateSmoothBorderTessSegment(VBOStream ownerVBOStream, SmoothBorderBuilder smoothBorderBuilder) { // float[] smoothBorderTess = GetSmoothBorders(smoothBorderBuilder); _smoothBorderVboSeg = ownerVBOStream.CreateSegment(smoothBorderTess, BorderTriangleStripCount, 4); // }
int _borderTriangleStripCount; //for smoothborder public float[] GetSmoothBorders(SmoothBorderBuilder smoothBorderBuilder) { //return existing result if not null //or create a newone if the old result is not exist return(_smoothBorderTess ?? (_smoothBorderTess = smoothBorderBuilder.BuildSmoothBorders(_figures, IsClosedFigure, out _borderTriangleStripCount))); }
internal void CreateGraphicsPathForMultiPartRenderVx( MultiPartPolygon multipartPolygon, MultiPartTessResult multipartTessResult, TessTool tessTool, SmoothBorderBuilder borderBuilder) { //a multipart polygon contains a list of expand coord (x,y) set. List <float[]> expandCoordsList = multipartPolygon.expandCoordsList; List <int[]> endPointList = multipartPolygon.contourEndPoints; int listCount = expandCoordsList.Count; for (int i = 0; i < listCount; ++i) { //expand x,y float[] expandCoords = expandCoordsList[i]; int[] endPoints = endPointList[i]; //area int localVertexCount; tessTool.TessAndAddToMultiPartResult(expandCoords, endPoints, multipartTessResult, out localVertexCount); //borders //build smooth border int m = endPoints.Length; int latest_endPoint = 0; multipartTessResult.BeginBorderPart(); for (int n = 0; n < m; ++n) { int endPoint = endPoints[n]; //'x' , not include 'y' int len = (endPoint - latest_endPoint) + 1; //so len we add +1 for 'y' int borderTriangleStripCount; //expand coords for draw array float[] smoothBorderXYs = borderBuilder.BuildSmoothBorders(expandCoords, latest_endPoint, len, out borderTriangleStripCount); latest_endPoint += len + 2; multipartTessResult.AddSmoothBorders(smoothBorderXYs, borderTriangleStripCount); } multipartTessResult.EndBorderPart(); } }
//------------------------------------------------------------------------------- public void DrawRect(float x, float y, float w, float h) { switch (this.SmoothMode) { case CanvasSmoothMode.Smooth: { int borderTriAngleCount; float[] triangles = SmoothBorderBuilder.BuildSmoothBorders( CreatePolyLineRectCoords(x, y, w, h), out borderTriAngleCount); smoothLineShader.DrawTriangleStrips(triangles, borderTriAngleCount); } break; default: { } break; } }
// //---------------------------------------------------- // internal float[] GetSmoothBorders(SmoothBorderBuilder smoothBorderBuilder) { return((_figure != null) ? _figure.GetSmoothBorders(smoothBorderBuilder) : _figures.GetSmoothBorders(smoothBorderBuilder)); }