Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
VertexAttrib.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 #if SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGL
4 using System;
5 #if SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGLES
6 using OpenTK.Graphics.ES30;
7 #else
8 using OpenTK.Graphics.OpenGL;
9 #endif
10 
11 namespace SiliconStudio.Paradox.Graphics
12 {
13  internal struct VertexAttrib : IEquatable<VertexAttrib>
14  {
15  public int VertexBufferId;
16  public int Index;
17  public int Size;
18  public bool IsInteger;
19  public VertexAttribPointerType Type;
20  public bool Normalized;
21  public int Stride;
22  public IntPtr Offset;
23  public string AttributeName;
24 
25  public bool Equals(VertexAttrib other)
26  {
27  return VertexBufferId == other.VertexBufferId && Index == other.Index && Size == other.Size && IsInteger.Equals(other.IsInteger) && Type == other.Type && Normalized.Equals(other.Normalized) && Stride == other.Stride && Offset.Equals(other.Offset) && string.Equals(AttributeName, other.AttributeName);
28  }
29 
30  public override bool Equals(object obj)
31  {
32  if (ReferenceEquals(null, obj)) return false;
33  return obj is VertexAttrib && Equals((VertexAttrib) obj);
34  }
35 
36  public override int GetHashCode()
37  {
38  unchecked
39  {
40  int hashCode = VertexBufferId;
41  hashCode = (hashCode*397) ^ Index;
42  hashCode = (hashCode*397) ^ Size;
43  hashCode = (hashCode*397) ^ IsInteger.GetHashCode();
44  hashCode = (hashCode*397) ^ (int) Type;
45  hashCode = (hashCode*397) ^ Normalized.GetHashCode();
46  hashCode = (hashCode*397) ^ Stride;
47  hashCode = (hashCode*397) ^ Offset.GetHashCode();
48  hashCode = (hashCode*397) ^ AttributeName.GetHashCode();
49  return hashCode;
50  }
51  }
52 
53  public static bool operator ==(VertexAttrib left, VertexAttrib right)
54  {
55  return left.Equals(right);
56  }
57 
58  public static bool operator !=(VertexAttrib left, VertexAttrib right)
59  {
60  return !left.Equals(right);
61  }
62  }
63 }
64 
65 #endif
The type of the serialized type will be passed as a generic arguments of the serializer. Example: serializer of A becomes instantiated as Serializer{A}.