X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=FDK%2F%E3%82%B3%E3%83%BC%E3%83%89%2F04.%E3%82%B0%E3%83%A9%E3%83%95%E3%82%A3%E3%83%83%E3%82%AF%2F%E9%A0%82%E7%82%B9%E3%83%95%E3%82%A9%E3%83%BC%E3%83%9E%E3%83%83%E3%83%88%28Vertex%29%2FPositionColoredTexturedVertex.cs;fp=FDK%2F%E3%82%B3%E3%83%BC%E3%83%89%2F04.%E3%82%B0%E3%83%A9%E3%83%95%E3%82%A3%E3%83%83%E3%82%AF%2F%E9%A0%82%E7%82%B9%E3%83%95%E3%82%A9%E3%83%BC%E3%83%9E%E3%83%83%E3%83%88%28Vertex%29%2FPositionColoredTexturedVertex.cs;h=a2cc7d598c81b7cad45412a0749da52e7b814a0b;hb=7bf3e650c7c6f5afac463ea6e288fcd3fad4387b;hp=0000000000000000000000000000000000000000;hpb=296446998eeba408353da55a275458b590e4ebf5;p=dtxmania%2Fdtxmania.git diff --git a/FDK/コード/04.グラフィック/頂点フォーマット(Vertex)/PositionColoredTexturedVertex.cs b/FDK/コード/04.グラフィック/頂点フォーマット(Vertex)/PositionColoredTexturedVertex.cs new file mode 100644 index 00000000..a2cc7d59 --- /dev/null +++ b/FDK/コード/04.グラフィック/頂点フォーマット(Vertex)/PositionColoredTexturedVertex.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Runtime.InteropServices; +using System.Globalization; +using SharpDX; +using SharpDX.Direct3D9; + +namespace FDK +{ + [StructLayout( LayoutKind.Sequential )] + public struct PositionColoredTexturedVertex : IEquatable + { + public Vector3 Position; + public int Color; + public Vector2 TextureCoordinates; + + public static int SizeInBytes + { + get + { + return Marshal.SizeOf( typeof( PositionColoredTexturedVertex ) ); + } + } + public static VertexFormat Format + { + get + { + return ( VertexFormat.Texture1 | VertexFormat.Diffuse | VertexFormat.Position ); + } + } + public PositionColoredTexturedVertex( Vector3 position, int color, Vector2 textureCoordinates ) + { + this = new PositionColoredTexturedVertex(); + this.Position = position; + this.Color = color; + this.TextureCoordinates = textureCoordinates; + } + + public static bool operator ==( PositionColoredTexturedVertex left, PositionColoredTexturedVertex right ) + { + return left.Equals( right ); + } + public static bool operator !=( PositionColoredTexturedVertex left, PositionColoredTexturedVertex right ) + { + return !( left == right ); + } + public override int GetHashCode() + { + return ( ( this.Position.GetHashCode() + this.Color.GetHashCode() ) + this.TextureCoordinates.GetHashCode() ); + } + public override bool Equals( object obj ) + { + if( obj == null ) + { + return false; + } + if( base.GetType() != obj.GetType() ) + { + return false; + } + return this.Equals( (PositionColoredTexturedVertex) obj ); + } + public bool Equals( PositionColoredTexturedVertex other ) + { + return ( ( ( this.Position == other.Position ) && ( this.Color == other.Color ) ) && ( this.TextureCoordinates == other.TextureCoordinates ) ); + } + public override string ToString() + { + return string.Format( CultureInfo.CurrentCulture, "{0} ({1}, {2})", new object[] { this.Position.ToString(), System.Drawing.Color.FromArgb( this.Color ).ToString(), this.TextureCoordinates.ToString() } ); + } + } +}