コード例 #1
0
        public void Test2xUnclosedPolyFrameMesh()
        {
            var shapeMesh = new PolyFrameMesh(new Polygon2X(), false, 2.0f);
            var mesh      = shapeMesh.Build();

            var vertices = mesh.vertices;

            Assert.AreEqual(8, vertices.Length);

            var triangles = mesh.triangles;

            Assert.AreEqual(12, triangles.Length);

            var uv = mesh.uv;

            Assert.AreEqual(vertices.Length, uv.Length);

            Assert.AreEqual(0, triangles[0]);
            Assert.AreEqual(2, triangles[1]);
            Assert.AreEqual(1, triangles[2]);
            Assert.AreEqual(2, triangles[3]);
            Assert.AreEqual(3, triangles[4]);
            Assert.AreEqual(1, triangles[5]);

            Assert.AreEqual(4, triangles[6]);
            Assert.AreEqual(6, triangles[7]);
            Assert.AreEqual(5, triangles[8]);
            Assert.AreEqual(6, triangles[9]);
            Assert.AreEqual(7, triangles[10]);
            Assert.AreEqual(5, triangles[11]);
        }
コード例 #2
0
        public EllipseFrameMesh(float angleStep, Vector2 size, float strokeWidth)
        {
            this.angleStep   = angleStep;
            this.worldSize   = size;
            this.strokeWidth = strokeWidth;

            var polygon = new Polygon();

            for (int i = 0; i < SliceCount; i++)
            {
                polygon.vertices.Add(MeshVertexFor(angleStep * i));
            }
            polyFrameMesh = new PolyFrameMesh(polygon, true, strokeWidth);
        }