コード例 #1
0
ファイル: TextLiteral.cs プロジェクト: yong-ja/starodyssey
        public void Create2(Vector3 topLeftVertex, int width, int height, DataStream stream)
        {
            TexturedVertex[] vertices = new TexturedVertex[]
                                            {
                                                new TexturedVertex(
                                                    new Vector4(topLeftVertex.X, topLeftVertex.Y-height, topLeftVertex.Z, 1.0f),
                                                    new Vector2(0.0f, 1.0f)),
                                                new TexturedVertex(
                                                    new Vector4(topLeftVertex.X, topLeftVertex.Y,
                                                                topLeftVertex.Z, 1.0f), new Vector2(0.0f, 0.0f)),
                                                new TexturedVertex(
                                                    new Vector4(topLeftVertex.X + width, topLeftVertex.Y,
                                                                topLeftVertex.Z, 1.0f), new Vector2(1.0f, 0.0f)),
                                                new TexturedVertex(
                                                    new Vector4(topLeftVertex.X + width, topLeftVertex.Y - height,
                                                                topLeftVertex.Z, 1.0f), new Vector2(1.0f, 1.0f))
                                            };

            //stream = new DataStream(4 * TexturedVertex.Stride, true, true);
            foreach (TexturedVertex vertex in vertices)
            {
                stream.Write(vertex.Position);
                stream.Write(vertex.TextureCoordinate);
            }

            stream.Position = 0;
        }
コード例 #2
0
ファイル: TexturedVertex.cs プロジェクト: yong-ja/starodyssey
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <param name="other">An object to compare with this object.</param>
 /// <returns>
 /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
 /// </returns>
 public bool Equals(TexturedVertex other)
 {
     return (Position == other.Position && TextureCoordinate == other.TextureCoordinate);
 }