Exemple #1
0
        /// <summary>
        /// Gives an element with a mapped texture.
        /// </summary>
        public override void Tessellate(ref Mesh mesh, Transform transform = null, Elements.Geometry.Color color = default(Elements.Geometry.Color))
        {
            var meshVertices = new List <Vertex>();

            var i = 0;

            while (i < this.Perimeter.Vertices.Count)
            {
                var v  = this.Perimeter.Vertices[i];
                var uv = new UV((v.X - _perimBounds.Min.X) / _perimW * (_numPixelsX / _imgPixels), (v.Y - _perimBounds.Min.Y) / _perimH * (_numPixelsX / _imgPixels));
                meshVertices.Add(mesh.AddVertex(v, uv));

                if (i >= 2)
                {
                    mesh.AddTriangle(new Triangle(meshVertices[0], meshVertices[i - 1], meshVertices[i]));
                }
                i++;
            }
        }
Exemple #2
0
 public static ColorWithTransparency ToColorWithTransparency(this Elements.Geometry.Color color)
 {
     // TODO: Fix this when we reverse alpha values.
     return(new ColorWithTransparency((uint)(color.Red * 255), (uint)(color.Green * 255), (uint)(color.Blue * 255), (uint)((1.0 - color.Alpha) * 255)));
 }
 public static UnityEngine.Color ToUnityColor(this Elements.Geometry.Color color)
 {
     return(new UnityEngine.Color(color.Red, color.Green, color.Blue, color.Alpha));
 }