Exemplo n.º 1
0
        public float[] GetAreaTess(TessTool tess,
                                   Tesselate.Tesselator.WindingRuleType windingRuleType,
                                   TessTriangleTechnique tech)
        {
#if DEBUG
            if (this.TessTriangleTech == 0)
            {
            }
#endif

            if (TessTriangleTech != tech)
            {
                //re tess again
                this.TessTriangleTech = tech;
                //***
                if (this.TessTriangleTech == TessTriangleTechnique.DrawArray)
                {
                    tess.WindingRuleType = windingRuleType;
                    return(_areaTess ??
                           (_areaTess = tess.TessAsTriVertexArray(coordXYs, null, out _tessAreaVertexCount)));
                }
                else
                {
                    tess.WindingRuleType = windingRuleType;
                    _indexListArray      = tess.TessAsTriIndexArray(coordXYs,
                                                                    null,
                                                                    out _areaTess,
                                                                    out _tessAreaVertexCount);
                    return(_areaTess);
                }
            }
            else
            {
                //if equal
                return(_areaTess);
            }
        }
Exemplo n.º 2
0
        public float[] GetAreaTess(TessTool tess, Tesselate.Tesselator.WindingRuleType windingRuleType, TessTriangleTechnique tessTechnique)
        {
#if DEBUG
            if (this.TessTriangleTech == 0)
            {
            }
#endif

            if (TessTriangleTech != tessTechnique)
            {
                //re tess again
                this.TessTriangleTech = tessTechnique;
                //***
                using (ReusableCoordList.Borrow(out ReusableCoordList resuableCoordList))
                {
                    ArrayList <float> coordXYs         = resuableCoordList._coordXYs;
                    ArrayList <int>   contourEndPoints = resuableCoordList._contourEndPoints;

                    Figure fig = null;
                    for (int i = 0; i < _figures.Length; ++i)
                    {
                        fig = _figures[i];
                        coordXYs.Append(fig.coordXYs);

                        if (fig.IsClosedFigure)
                        {
                            //for tess,if close figure
                            coordXYs.Append(fig.coordXYs[0]);
                            coordXYs.Append(fig.coordXYs[1]);
                        }

                        contourEndPoints.Append(coordXYs.Count - 1);
                    }


                    if (this.TessTriangleTech == TessTriangleTechnique.DrawArray)
                    {
                        tess.WindingRuleType = windingRuleType;
                        return(_areaTess = tess.TessAsTriVertexArray(
                                   coordXYs.ToArray(),
                                   contourEndPoints.ToArray(),
                                   out _tessAreaVertexCount));
                    }
                    else
                    {
                        tess.WindingRuleType = windingRuleType;
                        _areaTessIndexList   = tess.TessAsTriIndexArray(
                            coordXYs.ToArray(),
                            contourEndPoints.ToArray(),
                            out _areaTess,
                            out _tessAreaVertexCount);
                        return(_areaTess);
                    }
                }
            }
            else
            {
                //if equal
                return(_areaTess);
            }
        }