2 * Copyright (c) 2007-2010 SlimDX Group
\r
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
\r
5 * of this software and associated documentation files (the "Software"), to deal
\r
6 * in the Software without restriction, including without limitation the rights
\r
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
\r
8 * copies of the Software, and to permit persons to whom the Software is
\r
9 * furnished to do so, subject to the following conditions:
\r
11 * The above copyright notice and this permission notice shall be included in
\r
12 * all copies or substantial portions of the Software.
\r
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
\r
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
\r
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
\r
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
\r
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
\r
24 using System.Globalization;
\r
25 using System.Runtime.InteropServices;
\r
31 /// Represents a vertex with a pre-transformed position and a color.
\r
33 [StructLayout(LayoutKind.Sequential)]
\r
34 public struct TransformedColoredVertex : IEquatable<TransformedColoredVertex> {
\r
36 /// Gets or sets the pre-transformed position of the vertex.
\r
38 public Vector4 Position {
\r
44 /// Gets or sets the color of the vertex.
\r
52 /// Initializes a new instance of the <see cref="TransformedColoredVertex"/> struct.
\r
54 /// <param name="position">The position.</param>
\r
55 /// <param name="color">The color.</param>
\r
56 public TransformedColoredVertex(Vector4 position, int color)
\r
58 Position = position;
\r
63 /// Implements operator ==.
\r
65 /// <param name="left">The left.</param>
\r
66 /// <param name="right">The right.</param>
\r
67 /// <returns>The result of the operator.</returns>
\r
68 public static bool operator ==(TransformedColoredVertex left, TransformedColoredVertex right) {
\r
69 return left.Equals(right);
\r
73 /// Implements operator !=.
\r
75 /// <param name="left">The left side of the operator.</param>
\r
76 /// <param name="right">The right side of the operator.</param>
\r
77 /// <returns>The result of the operator.</returns>
\r
78 public static bool operator !=(TransformedColoredVertex left, TransformedColoredVertex right) {
\r
79 return !(left == right);
\r
83 /// Returns the hash code for this instance.
\r
86 /// A 32-bit signed integer that is the hash code for this instance.
\r
88 public override int GetHashCode() {
\r
89 return Position.GetHashCode() + Color.GetHashCode();
\r
93 /// Indicates whether this instance and a specified object are equal.
\r
95 /// <param name="obj">Another object to compare to.</param>
\r
97 /// true if <paramref name="obj"/> and this instance are the same type and represent the same value; otherwise, false.
\r
99 public override bool Equals(object obj) {
\r
103 if (GetType() != obj.GetType())
\r
106 return Equals((TransformedColoredVertex)obj);
\r
110 /// Indicates whether the current object is equal to another object of the same type.
\r
112 /// <param name="other">An object to compare with this object.</param>
\r
114 /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
\r
116 public bool Equals(TransformedColoredVertex other) {
\r
117 return (Position == other.Position && Color == other.Color);
\r