Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.BinPacking/PackingPlanVisualizations/3D/VertexPositionColorNormal.cs @ 13465

Last change on this file since 13465 was 13465, checked in by gkronber, 8 years ago

#1966: general code cleanup ...

File size: 2.4 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2015 Joseph Helm and Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using SharpDX;
24using SharpDX.Toolkit.Graphics;
25
26namespace PackingPlanVisualizations {
27
28  [Serializable]
29  public struct VertexPositionColorNormal : IEquatable<VertexPositionColorNormal> {
30    [VertexElement("COLOR")]
31    public Color Color;
32    [VertexElement("SV_Position")]
33    public Vector3 Position;
34    [VertexElement("NORMAL")]
35    public Vector3 Normal;
36
37
38    public VertexPositionColorNormal(Color color, Vector3 position, Vector3 normal) {
39      Position = position;
40      Color = color;
41      Normal = normal;
42    }
43
44    public static bool operator !=(VertexPositionColorNormal left, VertexPositionColorNormal right) {
45      return !left.Equals(right);
46    }
47    public static bool operator ==(VertexPositionColorNormal left, VertexPositionColorNormal right) {
48      return left.Equals(right);
49    }
50
51    public override bool Equals(object obj) {
52      if (obj is VertexPositionColorNormal)
53        return this.Equals((VertexPositionColorNormal)obj);
54      else
55        return false;
56    }
57
58    public bool Equals(VertexPositionColorNormal other) {
59      return this.Normal == other.Normal && this.Position == other.Position && this.Color == other.Color;
60    }
61
62    public override int GetHashCode() {
63      return this.Color.GetHashCode() * 3 + this.Normal.GetHashCode() * 7 + this.Position.GetHashCode() * 11;
64    }
65
66    public override string ToString() {
67      return String.Format("VertexPositionColorNormal (Position: {0}; Color: {1}; Normal: {2})", this.Position, this.Color, this.Normal);
68    }
69
70  }
71}
Note: See TracBrowser for help on using the repository browser.