Exemplo n.º 1
0
        private void applyPolygonData()
        {
            if (this.currentPolygonType == PolygonType.None)
            {
                return;
            }

            IShaderData shaderData = null;

            switch (this.currentPolygonType)
            {
            case PolygonType.Sprite:
                shaderData = new SpriteData(this.localTransform, this.textureId, this.color, this.clipArea, this.linearFiltering);
                break;

            case PolygonType.Orbit:
                shaderData = new OrbitData(this.minRadius, this.maxRadius, this.color, this.localTransform, this.sprite);
                break;

            case PolygonType.Sdf:
                shaderData = new SdfData(this.localTransform, this.textureId, this.color, this.clipArea);
                break;

            default:
                throw new NotImplementedException(this.currentPolygonType.ToString());
            }

            this.polygons.Add(new PolygonData(this.z, shaderData, this.vertexData));

            //clean up
            this.vertexData     = new List <float>();
            this.localTransform = Matrix4.Identity;
        }
Exemplo n.º 2
0
        private void applyPolygonData()
        {
            if (this.currentPolygonType == PolygonType.None)
            {
                return;
            }

            IShaderData shaderData;

            switch (this.currentPolygonType)
            {
            case PolygonType.Sprite:
                shaderData = new SpriteData(this.localTransform, this.textureId, this.color, this.clipArea);
                break;

            case PolygonType.Orbit:
                shaderData = new OrbitData(this.minRadius, this.maxRadius, this.color, this.localTransform, this.sprite);
                break;

            case PolygonType.Sdf:
                if (!this.smoothDist.HasValue)
                {
                    throw new InvalidOperationException("Pixel size not defined");
                }
                shaderData = new SdfData(this.localTransform, this.textureId, this.color, this.smoothDist.Value, this.clipArea);
                break;

            default:
                throw new NotImplementedException(this.currentPolygonType.ToString());
            }

            foreach (var layer in this.vertexData)
            {
                this.polygons.Add(new PolygonData(layer.Key, shaderData, layer.Value));
            }

            //clean up
            this.vertexData     = new Dictionary <float, List <float> >();
            this.localTransform = Matrix4.Identity;
            this.smoothDist     = null;
        }