コード例 #1
0
ファイル: CCDrawNode.cs プロジェクト: zhuruvl/CocosSharp
        public void DrawPolygon(CCPoint[] verts, int count, CCColor4F fillColor, float borderWidth,
                                CCColor4F borderColor)
        {
            var extrude = new ExtrudeVerts[count];

            for (int i = 0; i < count; i++)
            {
                var v0 = verts[(i - 1 + count) % count];
                var v1 = verts[i];
                var v2 = verts[(i + 1) % count];

                var n1 = CCPoint.Normalize(CCPoint.PerpendicularCCW(v1 - v0));
                var n2 = CCPoint.Normalize(CCPoint.PerpendicularCCW(v2 - v1));

                var offset = (n1 + n2) * (1.0f / (CCPoint.Dot(n1, n2) + 1.0f));
                extrude[i] = new ExtrudeVerts()
                {
                    offset = offset, n = n2
                };
            }

            bool outline = (borderColor.A > 0.0f && borderWidth > 0.0f);

            var colorFill  = new CCColor4B(fillColor);
            var borderFill = new CCColor4B(borderColor);

            float inset = (!outline ? 0.5f : 0.0f);

            for (int i = 0; i < count - 2; i++)
            {
                var v0 = verts[0] - (extrude[0].offset * inset);
                var v1 = verts[i + 1] - (extrude[i + 1].offset * inset);
                var v2 = verts[i + 2] - (extrude[i + 2].offset * inset);

                AddTriangleVertex(new CCV3F_C4B(v0, colorFill)); //__t(v2fzero)
                AddTriangleVertex(new CCV3F_C4B(v1, colorFill)); //__t(v2fzero)
                AddTriangleVertex(new CCV3F_C4B(v2, colorFill)); //__t(v2fzero)
            }

            for (int i = 0; i < count; i++)
            {
                int j  = (i + 1) % count;
                var v0 = verts[i];
                var v1 = verts[j];

                var n0 = extrude[i].n;

                var offset0 = extrude[i].offset;
                var offset1 = extrude[j].offset;

                if (outline)
                {
                    var inner0 = (v0 - (offset0 * borderWidth));
                    var inner1 = (v1 - (offset1 * borderWidth));
                    var outer0 = (v0 + (offset0 * borderWidth));
                    var outer1 = (v1 + (offset1 * borderWidth));

                    AddTriangleVertex(new CCV3F_C4B(inner0, borderFill)); //__t(v2fneg(n0))
                    AddTriangleVertex(new CCV3F_C4B(inner1, borderFill)); //__t(v2fneg(n0))
                    AddTriangleVertex(new CCV3F_C4B(outer1, borderFill)); //__t(n0)

                    AddTriangleVertex(new CCV3F_C4B(inner0, borderFill)); //__t(v2fneg(n0))
                    AddTriangleVertex(new CCV3F_C4B(outer0, borderFill)); //__t(n0)
                    AddTriangleVertex(new CCV3F_C4B(outer1, borderFill)); //__t(n0)
                }
                else
                {
                    var inner0 = (v0 - (offset0 * 0.5f));
                    var inner1 = (v1 - (offset1 * 0.5f));
                    var outer0 = (v0 + (offset0 * 0.5f));
                    var outer1 = (v1 + (offset1 * 0.5f));

                    AddTriangleVertex(new CCV3F_C4B(inner0, colorFill)); //__t(v2fzero)
                    AddTriangleVertex(new CCV3F_C4B(inner1, colorFill)); //__t(v2fzero)
                    AddTriangleVertex(new CCV3F_C4B(outer1, colorFill)); //__t(n0)

                    AddTriangleVertex(new CCV3F_C4B(inner0, colorFill)); //__t(v2fzero)
                    AddTriangleVertex(new CCV3F_C4B(outer0, colorFill)); //__t(n0)
                    AddTriangleVertex(new CCV3F_C4B(outer1, colorFill)); //__t(n0)
                }
            }

            dirty = true;
        }
コード例 #2
0
        public void DrawPolygon(CCPoint[] verts, int count, CCColor4F fillColor, float borderWidth,
                                CCColor4F borderColor)
        {
            var extrude = new ExtrudeVerts[count];

            for (int i = 0; i < count; i++)
            {
                var v0 = verts[(i - 1 + count) % count];
                var v1 = verts[i];
                var v2 = verts[(i + 1) % count];

                var n1 = CCPoint.Normalize(CCPoint.Perp(v1 - v0));
                var n2 = CCPoint.Normalize(CCPoint.Perp(v2 - v1));

                var offset = (n1 + n2) * (1.0f / (CCPoint.Dot(n1, n2) + 1.0f));
                extrude[i] = new ExtrudeVerts()
                {
                    offset = offset, n = n2
                };
            }

            bool outline = (fillColor.A > 0.0f && borderWidth > 0.0f);

            float inset = (!outline ? 0.5f : 0.0f);

            for (int i = 0; i < count - 2; i++)
            {
                var v0 = verts[0] - (extrude[0].offset * inset);
                var v1 = verts[i + 1] - (extrude[i + 1].offset * inset);
                var v2 = verts[i + 2] - (extrude[i + 2].offset * inset);

                m_pVertices.Add(new VertexPositionColor(v0, fillColor)); //__t(v2fzero)
                m_pVertices.Add(new VertexPositionColor(v1, fillColor)); //__t(v2fzero)
                m_pVertices.Add(new VertexPositionColor(v2, fillColor)); //__t(v2fzero)
            }

            for (int i = 0; i < count; i++)
            {
                int j  = (i + 1) % count;
                var v0 = verts[i];
                var v1 = verts[j];

                var n0 = extrude[i].n;

                var offset0 = extrude[i].offset;
                var offset1 = extrude[j].offset;

                if (outline)
                {
                    var inner0 = (v0 - (offset0 * borderWidth));
                    var inner1 = (v1 - (offset1 * borderWidth));
                    var outer0 = (v0 + (offset0 * borderWidth));
                    var outer1 = (v1 + (offset1 * borderWidth));

                    m_pVertices.Add(new VertexPositionColor(inner0, borderColor)); //__t(v2fneg(n0))
                    m_pVertices.Add(new VertexPositionColor(inner1, borderColor)); //__t(v2fneg(n0))
                    m_pVertices.Add(new VertexPositionColor(outer1, borderColor)); //__t(n0)

                    m_pVertices.Add(new VertexPositionColor(inner0, borderColor)); //__t(v2fneg(n0))
                    m_pVertices.Add(new VertexPositionColor(outer0, borderColor)); //__t(n0)
                    m_pVertices.Add(new VertexPositionColor(outer1, borderColor)); //__t(n0)
                }
                else
                {
                    var inner0 = (v0 - (offset0 * 0.5f));
                    var inner1 = (v1 - (offset1 * 0.5f));
                    var outer0 = (v0 + (offset0 * 0.5f));
                    var outer1 = (v1 + (offset1 * 0.5f));

                    m_pVertices.Add(new VertexPositionColor(inner0, fillColor)); //__t(v2fzero)
                    m_pVertices.Add(new VertexPositionColor(inner1, fillColor)); //__t(v2fzero)
                    m_pVertices.Add(new VertexPositionColor(outer1, fillColor)); //__t(n0)

                    m_pVertices.Add(new VertexPositionColor(inner0, fillColor)); //__t(v2fzero)
                    m_pVertices.Add(new VertexPositionColor(outer0, fillColor)); //__t(n0)
                    m_pVertices.Add(new VertexPositionColor(outer1, fillColor)); //__t(n0)
                }
            }

            m_bDirty = true;
        }
コード例 #3
0
ファイル: CCDrawNode.cs プロジェクト: netonjm/CocosSharp
        public void DrawPolygon(CCPoint[] verts, int count, CCColor4F fillColor, float borderWidth,
                                CCColor4F borderColor)
        {
            var extrude = new ExtrudeVerts[count];

            for (int i = 0; i < count; i++)
            {
                var v0 = verts[(i - 1 + count) % count];
                var v1 = verts[i];
                var v2 = verts[(i + 1) % count];

                var n1 = CCPoint.Normalize(CCPoint.PerpendicularCCW(v1 - v0));
                var n2 = CCPoint.Normalize(CCPoint.PerpendicularCCW(v2 - v1));

                var offset = (n1 + n2) * (1.0f / (CCPoint.Dot(n1, n2) + 1.0f));
                extrude[i] = new ExtrudeVerts() {offset = offset, n = n2};
            }

            bool outline = (borderColor.A > 0.0f && borderWidth > 0.0f);

            var colorFill = fillColor.ToColor();
            var borderFill = borderColor.ToColor();
            
            float inset = (!outline ? 0.5f : 0.0f);
            
            for (int i = 0; i < count - 2; i++)
            {
                var v0 = verts[0] - (extrude[0].offset * inset);
                var v1 = verts[i + 1] - (extrude[i + 1].offset * inset);
                var v2 = verts[i + 2] - (extrude[i + 2].offset * inset);

                triangleVertices.Add(new VertexPositionColor(v0.ToVector3(), colorFill)); //__t(v2fzero)
                triangleVertices.Add(new VertexPositionColor(v1.ToVector3(), colorFill)); //__t(v2fzero)
                triangleVertices.Add(new VertexPositionColor(v2.ToVector3(), colorFill)); //__t(v2fzero)
            }

            for (int i = 0; i < count; i++)
            {
                int j = (i + 1) % count;
                var v0 = verts[i];
                var v1 = verts[j];

                var n0 = extrude[i].n;

                var offset0 = extrude[i].offset;
                var offset1 = extrude[j].offset;

                if (outline)
                {
                    var inner0 = (v0 - (offset0 * borderWidth));
                    var inner1 = (v1 - (offset1 * borderWidth));
                    var outer0 = (v0 + (offset0 * borderWidth));
                    var outer1 = (v1 + (offset1 * borderWidth));

                    triangleVertices.Add(new VertexPositionColor(inner0.ToVector3(), borderFill)); //__t(v2fneg(n0))
                    triangleVertices.Add(new VertexPositionColor(inner1.ToVector3(), borderFill)); //__t(v2fneg(n0))
                    triangleVertices.Add(new VertexPositionColor(outer1.ToVector3(), borderFill)); //__t(n0)

                    triangleVertices.Add(new VertexPositionColor(inner0.ToVector3(), borderFill)); //__t(v2fneg(n0))
                    triangleVertices.Add(new VertexPositionColor(outer0.ToVector3(), borderFill)); //__t(n0)
                    triangleVertices.Add(new VertexPositionColor(outer1.ToVector3(), borderFill)); //__t(n0)
                }
                else
                {
                    var inner0 = (v0 - (offset0 * 0.5f));
                    var inner1 = (v1 - (offset1 * 0.5f));
                    var outer0 = (v0 + (offset0 * 0.5f));
                    var outer1 = (v1 + (offset1 * 0.5f));

                    triangleVertices.Add(new VertexPositionColor(inner0.ToVector3(), colorFill)); //__t(v2fzero)
                    triangleVertices.Add(new VertexPositionColor(inner1.ToVector3(), colorFill)); //__t(v2fzero)
                    triangleVertices.Add(new VertexPositionColor(outer1.ToVector3(), colorFill)); //__t(n0)

                    triangleVertices.Add(new VertexPositionColor(inner0.ToVector3(), colorFill)); //__t(v2fzero)
                    triangleVertices.Add(new VertexPositionColor(outer0.ToVector3(), colorFill)); //__t(n0)
                    triangleVertices.Add(new VertexPositionColor(outer1.ToVector3(), colorFill)); //__t(n0)
                }
            }

            dirty = true;
        }
コード例 #4
0
        public void DrawPolygon(CCPoint[] verts, int count, CCColor4F fillColor, float borderWidth,
                                CCColor4F borderColor, bool closePolygon = true)
        {
            var polycount = count;

            var extrude = new ExtrudeVerts[polycount];

            for (int i = 0; i < polycount; i++)
            {
                var v0 = verts[(i - 1 + polycount) % polycount];
                var v1 = verts[i];
                var v2 = verts[(i + 1) % polycount];

                var n1 = CCPoint.Normalize(CCPoint.PerpendicularCCW(v1 - v0));
                var n2 = CCPoint.Normalize(CCPoint.PerpendicularCCW(v2 - v1));

                var offset = (n1 + n2) * (1.0f / (CCPoint.Dot(n1, n2) + 1.0f));
                extrude[i] = new ExtrudeVerts() {offset = offset, n = n2};
            }

            bool outline = (borderColor.A > 0.0f && borderWidth > 0.0f);

            var colorFill = new CCColor4B(fillColor);
            var borderFill = new CCColor4B(borderColor);
            
            float inset = (!outline ? 0.5f : 0.0f);
            
            for (int i = 0; i < polycount - 2; i++)
            {
                var v0 = verts[0] - (extrude[0].offset * inset);
                var v1 = verts[i + 1] - (extrude[i + 1].offset * inset);
                var v2 = verts[i + 2] - (extrude[i + 2].offset * inset);

                AddTriangleVertex(new CCV3F_C4B(v0, colorFill)); //__t(v2fzero)
                AddTriangleVertex(new CCV3F_C4B(v1, colorFill)); //__t(v2fzero)
                AddTriangleVertex(new CCV3F_C4B(v2, colorFill)); //__t(v2fzero)
            }

            //if (closePolygon)
            //{
            //    var i = polycount - 3;
            //    var v0 = verts[0] - (extrude[0].offset * inset);
            //    var v1 = verts[i + 1] - (extrude[i + 1].offset * inset);
            //    var v2 = verts[i + 2] - (extrude[i + 2].offset * inset);

            //    AddTriangleVertex(new CCV3F_C4B(v0, colorFill)); //__t(v2fzero)
            //    AddTriangleVertex(new CCV3F_C4B(v1, colorFill)); //__t(v2fzero)
            //    AddTriangleVertex(new CCV3F_C4B(v2, colorFill)); //__t(v2fzero)
            //}

            for (int i = 0; i < polycount - 1; i++)
            {
                int j = (i + 1) % polycount;
                var v0 = verts[i];
                var v1 = verts[j];

                var n0 = extrude[i].n;

                var offset0 = extrude[i].offset;
                var offset1 = extrude[j].offset;

                if (outline)
                {
                    var inner0 = (v0 - (offset0 * borderWidth));
                    var inner1 = (v1 - (offset1 * borderWidth));
                    var outer0 = (v0 + (offset0 * borderWidth));
                    var outer1 = (v1 + (offset1 * borderWidth));

                    AddTriangleVertex(new CCV3F_C4B(inner0, borderFill)); //__t(v2fneg(n0))
                    AddTriangleVertex(new CCV3F_C4B(inner1, borderFill)); //__t(v2fneg(n0))
                    AddTriangleVertex(new CCV3F_C4B(outer1, borderFill)); //__t(n0)

                    AddTriangleVertex(new CCV3F_C4B(inner0, borderFill)); //__t(v2fneg(n0))
                    AddTriangleVertex(new CCV3F_C4B(outer0, borderFill)); //__t(n0)
                    AddTriangleVertex(new CCV3F_C4B(outer1, borderFill)); //__t(n0)
                }
                else
                {
                    var inner0 = (v0 - (offset0 * 0.5f));
                    var inner1 = (v1 - (offset1 * 0.5f));
                    var outer0 = (v0 + (offset0 * 0.5f));
                    var outer1 = (v1 + (offset1 * 0.5f));

                    AddTriangleVertex(new CCV3F_C4B(inner0, colorFill)); //__t(v2fzero)
                    AddTriangleVertex(new CCV3F_C4B(inner1, colorFill)); //__t(v2fzero)
                    AddTriangleVertex(new CCV3F_C4B(outer1, colorFill)); //__t(n0)

                    AddTriangleVertex(new CCV3F_C4B(inner0, colorFill)); //__t(v2fzero)
                    AddTriangleVertex(new CCV3F_C4B(outer0, colorFill)); //__t(n0)
                    AddTriangleVertex(new CCV3F_C4B(outer1, colorFill)); //__t(n0)
                }
            }

            if (closePolygon)
            {
                for (int i = polycount - 1; i < polycount; i++)
                {
                    int j = (i + 1) % polycount;
                    var v0 = verts[i];
                    var v1 = verts[j];

                    var n0 = extrude[i].n;

                    var offset0 = extrude[i].offset;
                    var offset1 = extrude[j].offset;

                    if (outline)
                    {
                        var inner0 = (v0 - (offset0 * borderWidth));
                        var inner1 = (v1 - (offset1 * borderWidth));
                        var outer0 = (v0 + (offset0 * borderWidth));
                        var outer1 = (v1 + (offset1 * borderWidth));

                        AddTriangleVertex(new CCV3F_C4B(inner0, borderFill)); //__t(v2fneg(n0))
                        AddTriangleVertex(new CCV3F_C4B(inner1, borderFill)); //__t(v2fneg(n0))
                        AddTriangleVertex(new CCV3F_C4B(outer1, borderFill)); //__t(n0)

                        AddTriangleVertex(new CCV3F_C4B(inner0, borderFill)); //__t(v2fneg(n0))
                        AddTriangleVertex(new CCV3F_C4B(outer0, borderFill)); //__t(n0)
                        AddTriangleVertex(new CCV3F_C4B(outer1, borderFill)); //__t(n0)
                    }
                    else
                    {
                        var inner0 = (v0 - (offset0 * 0.5f));
                        var inner1 = (v1 - (offset1 * 0.5f));
                        var outer0 = (v0 + (offset0 * 0.5f));
                        var outer1 = (v1 + (offset1 * 0.5f));

                        AddTriangleVertex(new CCV3F_C4B(inner0, colorFill)); //__t(v2fzero)
                        AddTriangleVertex(new CCV3F_C4B(inner1, colorFill)); //__t(v2fzero)
                        AddTriangleVertex(new CCV3F_C4B(outer1, colorFill)); //__t(n0)

                        AddTriangleVertex(new CCV3F_C4B(inner0, colorFill)); //__t(v2fzero)
                        AddTriangleVertex(new CCV3F_C4B(outer0, colorFill)); //__t(n0)
                        AddTriangleVertex(new CCV3F_C4B(outer1, colorFill)); //__t(n0)
                    }
                }
            }
            dirty = true;
        }
コード例 #5
0
        public void DrawPolygon(CCPoint[] verts, int count, CCColor4B fillColor, float borderWidth,
                                CCColor4B borderColor, bool closePolygon = true)
        {
            var polycount = count;

            var colorFill  = fillColor;
            var borderFill = borderColor;

            bool outline = (borderColor.A > 0.0f && borderWidth > 0.0f);
            bool fill    = fillColor.A > 0.0f;

            var numberOfTriangles = outline ? (3 * polycount - 2) : (polycount - 2);

            if (numberOfTriangles > 0 && fill && closePolygon)
            {
                for (int i = 1; i < polycount - 1; i++)
                {
                    AddTriangleVertex(new CCV3F_C4B(verts[0], colorFill));
                    AddTriangleVertex(new CCV3F_C4B(verts[i], colorFill));
                    AddTriangleVertex(new CCV3F_C4B(verts[i + 1], colorFill));
                }
            }
            else
            {
                for (int i = 0; i < polycount - 1; i++)
                {
                    DrawLine(verts[i], verts[i + 1], borderWidth, colorFill);
                }
            }

            if (outline)
            {
                var extrude = new ExtrudeVerts[polycount];

                for (int i = 0; i < polycount; i++)
                {
                    var v0 = verts[(i - 1 + polycount) % polycount];
                    var v1 = verts[i];
                    var v2 = verts[(i + 1) % polycount];

                    var n1 = CCPoint.Normalize(CCPoint.PerpendicularCCW(v1 - v0));
                    var n2 = CCPoint.Normalize(CCPoint.PerpendicularCCW(v2 - v1));

                    var offset = (n1 + n2) * (1.0f / (CCPoint.Dot(n1, n2) + 1.0f));
                    extrude[i] = new ExtrudeVerts()
                    {
                        offset = offset, n = n2
                    };
                }

                float inset = (!outline ? 0.5f : 0.0f);

                for (int i = 0; i < polycount - 2; i++)
                {
                    var v0 = verts[0] - (extrude[0].offset * inset);
                    var v1 = verts[i + 1] - (extrude[i + 1].offset * inset);
                    var v2 = verts[i + 2] - (extrude[i + 2].offset * inset);

                    AddTriangleVertex(new CCV3F_C4B(v0, colorFill)); //__t(v2fzero)
                    AddTriangleVertex(new CCV3F_C4B(v1, colorFill)); //__t(v2fzero)
                    AddTriangleVertex(new CCV3F_C4B(v2, colorFill)); //__t(v2fzero)
                }

                for (int i = 0; i < polycount - 1; i++)
                {
                    int j  = (i + 1) % polycount;
                    var v0 = verts[i];
                    var v1 = verts[j];

                    var offset0 = extrude[i].offset;
                    var offset1 = extrude[j].offset;

                    var inner0 = (v0 - (offset0 * borderWidth));
                    var inner1 = (v1 - (offset1 * borderWidth));
                    var outer0 = (v0 + (offset0 * borderWidth));
                    var outer1 = (v1 + (offset1 * borderWidth));

                    AddTriangleVertex(new CCV3F_C4B(inner0, borderFill));
                    AddTriangleVertex(new CCV3F_C4B(inner1, borderFill));
                    AddTriangleVertex(new CCV3F_C4B(outer1, borderFill));

                    AddTriangleVertex(new CCV3F_C4B(inner0, borderFill));
                    AddTriangleVertex(new CCV3F_C4B(outer0, borderFill));
                    AddTriangleVertex(new CCV3F_C4B(outer1, borderFill));
                }

                if (closePolygon)
                {
                    for (int i = polycount - 1; i < polycount; i++)
                    {
                        int j  = (i + 1) % polycount;
                        var v0 = verts[i];
                        var v1 = verts[j];

                        var offset0 = extrude[i].offset;
                        var offset1 = extrude[j].offset;

                        var inner0 = (v0 - (offset0 * borderWidth));
                        var inner1 = (v1 - (offset1 * borderWidth));
                        var outer0 = (v0 + (offset0 * borderWidth));
                        var outer1 = (v1 + (offset1 * borderWidth));

                        AddTriangleVertex(new CCV3F_C4B(inner0, borderFill));
                        AddTriangleVertex(new CCV3F_C4B(inner1, borderFill));
                        AddTriangleVertex(new CCV3F_C4B(outer1, borderFill));

                        AddTriangleVertex(new CCV3F_C4B(inner0, borderFill));
                        AddTriangleVertex(new CCV3F_C4B(outer0, borderFill));
                        AddTriangleVertex(new CCV3F_C4B(outer1, borderFill));
                    }
                }
            }

            dirty = true;
        }
コード例 #6
0
ファイル: CCDrawNode.cs プロジェクト: Kingwl/CocosSharp
        public void DrawPolygon(CCPoint[] verts, int count, CCColor4F fillColor, float borderWidth,
                                CCColor4F borderColor, bool closePolygon = true)
        {

            var polycount = count;

            var colorFill = new CCColor4B(fillColor);
            var borderFill = new CCColor4B(borderColor);

            bool outline = (borderColor.A > 0.0f && borderWidth > 0.0f);
            bool fill = fillColor.A > 0.0f;

            var numberOfTriangles = outline ? (3 * polycount - 2) : (polycount - 2);

            if (numberOfTriangles > 0 && fill && closePolygon)
            {
                for (int i = 1; i < polycount - 1; i++)
                {
                    AddTriangleVertex(new CCV3F_C4B(verts[0], colorFill));
                    AddTriangleVertex(new CCV3F_C4B(verts[i], colorFill));
                    AddTriangleVertex(new CCV3F_C4B(verts[i + 1], colorFill));
                }
            }
            else
            {
                for (int i = 0; i < polycount - 1; i++)
                {
                    DrawLine(verts[i], verts[i + 1], borderWidth, colorFill);
                }

            }

            if (outline)
            {
                var extrude = new ExtrudeVerts[polycount];

                for (int i = 0; i < polycount; i++)
                {
                    var v0 = verts[(i - 1 + polycount) % polycount];
                    var v1 = verts[i];
                    var v2 = verts[(i + 1) % polycount];

                    var n1 = CCPoint.Normalize(CCPoint.PerpendicularCCW(v1 - v0));
                    var n2 = CCPoint.Normalize(CCPoint.PerpendicularCCW(v2 - v1));

                    var offset = (n1 + n2) * (1.0f / (CCPoint.Dot(n1, n2) + 1.0f));
                    extrude[i] = new ExtrudeVerts() { offset = offset, n = n2 };
                }

                for (int i = 0; i < polycount - 2; i++)
                {
                    var v0 = verts[0];
                    var v1 = verts[i + 1];
                    var v2 = verts[i + 2];

                    AddTriangleVertex(new CCV3F_C4B(v0, colorFill)); //__t(v2fzero)
                    AddTriangleVertex(new CCV3F_C4B(v1, colorFill)); //__t(v2fzero)
                    AddTriangleVertex(new CCV3F_C4B(v2, colorFill)); //__t(v2fzero)
                }

                for (int i = 0; i < polycount - 1; i++)
                {
                    int j = (i + 1) % polycount;
                    var v0 = verts[i];
                    var v1 = verts[j];

                    var offset0 = extrude[i].offset;
                    var offset1 = extrude[j].offset;

                    var inner0 = (v0 - (offset0 * borderWidth));
                    var inner1 = (v1 - (offset1 * borderWidth));
                    var outer0 = (v0 + (offset0 * borderWidth));
                    var outer1 = (v1 + (offset1 * borderWidth));

                    AddTriangleVertex(new CCV3F_C4B(inner0, borderFill)); 
                    AddTriangleVertex(new CCV3F_C4B(inner1, borderFill)); 
                    AddTriangleVertex(new CCV3F_C4B(outer1, borderFill)); 

                    AddTriangleVertex(new CCV3F_C4B(inner0, borderFill)); 
                    AddTriangleVertex(new CCV3F_C4B(outer0, borderFill)); 
                    AddTriangleVertex(new CCV3F_C4B(outer1, borderFill)); 
                }

                if (closePolygon)
                {
                    for (int i = polycount - 1; i < polycount; i++)
                    {
                        int j = (i + 1) % polycount;
                        var v0 = verts[i];
                        var v1 = verts[j];

                        var offset0 = extrude[i].offset;
                        var offset1 = extrude[j].offset;

                        var inner0 = (v0 - (offset0 * borderWidth));
                        var inner1 = (v1 - (offset1 * borderWidth));
                        var outer0 = (v0 + (offset0 * borderWidth));
                        var outer1 = (v1 + (offset1 * borderWidth));

                        AddTriangleVertex(new CCV3F_C4B(inner0, borderFill)); 
                        AddTriangleVertex(new CCV3F_C4B(inner1, borderFill)); 
                        AddTriangleVertex(new CCV3F_C4B(outer1, borderFill)); 

                        AddTriangleVertex(new CCV3F_C4B(inner0, borderFill)); 
                        AddTriangleVertex(new CCV3F_C4B(outer0, borderFill)); 
                        AddTriangleVertex(new CCV3F_C4B(outer1, borderFill)); 
                    }
                }
            }
        
            dirty = true;
        }