Esempio n. 1
0
        protected override void UpdateDrawable()
        {
            base.UpdateDrawable();

            SFMLVertices = new VertexArray((PrimitiveType)PrimitiveType);


            foreach (var v in Verts)
            {
                // Adjust texture for potential atlas offset.
                v.U += TextureLeft;
                v.V += TextureTop;
                v.U  = Util.Clamp(v.U, TextureLeft, TextureRight);
                v.V  = Util.Clamp(v.V, TextureTop, TextureBottom);

                //copy to new vert and apply color and alpha
                var vCopy = new Vert(v);
                vCopy.Color   *= Color;
                vCopy.Color.A *= Alpha;

                SFMLVertices.Append(vCopy);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Create a new Vert.
 /// </summary>
 /// <param name="copy">A source Vert to copy.</param>
 public Vert(Vert copy) : this(copy.X, copy.Y, copy.Color, copy.U, copy.V) { }
Esempio n. 3
0
 /// <summary>
 /// Create a new Vert.
 /// </summary>
 /// <param name="copy">A source Vert to copy.</param>
 public Vert(Vert copy) : this(copy.X, copy.Y, copy.Color, copy.U, copy.V)
 {
 }
Esempio n. 4
0
 public static void Append(this VertexArray vertices, Vert vert)
 {
     vertices.Append(vert.X, vert.Y, vert.Color, vert.U, vert.V);
 }
Esempio n. 5
0
        /// <summary>
        /// Add a Vert.
        /// </summary>
        /// <param name="x">The X position.</param>
        /// <param name="y">The Y position.</param>
        public void Add(float x, float y)
        {
            var vert = new Vert(x, y);

            Add(vert);
        }
Esempio n. 6
0
        /// <summary>
        /// Add a Vert.
        /// </summary>
        /// <param name="x">The X position.</param>
        /// <param name="y">The Y position.</param>
        /// <param name="color">The Color.</param>
        public void Add(float x, float y, Color color)
        {
            var vert = new Vert(x, y, color);

            Add(vert);
        }
Esempio n. 7
0
        /// <summary>
        /// Add a Vert.
        /// </summary>
        /// <param name="x">The X position.</param>
        /// <param name="y">The Y position.</param>
        /// <param name="u">The X position on the Texture.</param>
        /// <param name="v">The Y position on the Texture.</param>
        public void Add(float x, float y, float u, float v)
        {
            var vert = new Vert(x, y, u, v);

            Add(vert);
        }
Esempio n. 8
0
        /// <summary>
        /// Add a Vert.
        /// </summary>
        /// <param name="x">The X position.</param>
        /// <param name="y">The Y position.</param>
        /// <param name="color">The Color.</param>
        /// <param name="u">The X position on the Texture.</param>
        /// <param name="v">The Y position on the Texture.</param>
        public void Add(float x, float y, Color color, float u, float v)
        {
            var vert = new Vert(x, y, color, u, v);

            Add(vert);
        }
Esempio n. 9
0
 /// <summary>
 /// Add a Vert.
 /// </summary>
 /// <param name="x">The X position.</param>
 /// <param name="y">The Y position.</param>
 public void Add(float x, float y)
 {
     var vert = new Vert(x, y);
     Add(vert);
 }
Esempio n. 10
0
 /// <summary>
 /// Add a Vert.
 /// </summary>
 /// <param name="x">The X position.</param>
 /// <param name="y">The Y position.</param>
 /// <param name="color">The Color.</param>
 public void Add(float x, float y, Color color)
 {
     var vert = new Vert(x, y, color);
     Add(vert);
 }
Esempio n. 11
0
 /// <summary>
 /// Add a Vert.
 /// </summary>
 /// <param name="x">The X position.</param>
 /// <param name="y">The Y position.</param>
 /// <param name="u">The X position on the Texture.</param>
 /// <param name="v">The Y position on the Texture.</param>
 public void Add(float x, float y, float u, float v)
 {
     var vert = new Vert(x, y, u, v);
     Add(vert);
 }
Esempio n. 12
0
 /// <summary>
 /// Add a Vert.
 /// </summary>
 /// <param name="x">The X position.</param>
 /// <param name="y">The Y position.</param>
 /// <param name="color">The Color.</param>
 /// <param name="u">The X position on the Texture.</param>
 /// <param name="v">The Y position on the Texture.</param>
 public void Add(float x, float y, Color color, float u, float v)
 {
     var vert = new Vert(x, y, color, u, v);
     Add(vert);
 }
Esempio n. 13
0
        protected override void UpdateDrawable() {
            base.UpdateDrawable();

            SFMLVertices = new VertexArray((SFML.Graphics.PrimitiveType)PrimitiveType);

            
            foreach (var v in Verts) {
                // Adjust texture for potential atlas offset.
                v.U += TextureLeft;
                v.V += TextureTop;
                v.U = Util.Clamp(v.U, TextureLeft, TextureRight);
                v.V = Util.Clamp(v.V, TextureTop, TextureBottom);

                //copy to new vert and apply color and alpha
                var vCopy = new Vert(v);
                vCopy.Color *= Color;
                vCopy.Color.A *= Alpha;

                SFMLVertices.Append(vCopy);
            }

            
        }