GlobalVertex.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using Autodesk.Max;
  2. namespace Max2Babylon
  3. {
  4. public struct GlobalVertex
  5. {
  6. public int BaseIndex { get; set; }
  7. public int CurrentIndex { get; set; }
  8. public IPoint3 Position { get; set; }
  9. public IPoint3 Normal { get; set; }
  10. public IPoint2 UV { get; set; }
  11. public IPoint2 UV2 { get; set; }
  12. public int BonesIndices { get; set; }
  13. public IPoint4 Weights { get; set; }
  14. public float[] Color { get; set; }
  15. public override int GetHashCode()
  16. {
  17. return base.GetHashCode();
  18. }
  19. public override bool Equals(object obj)
  20. {
  21. if (!(obj is GlobalVertex))
  22. {
  23. return false;
  24. }
  25. var other = (GlobalVertex)obj;
  26. if (other.BaseIndex != BaseIndex)
  27. {
  28. return false;
  29. }
  30. if (!other.Position.IsAlmostEqualTo(Position, Tools.Epsilon))
  31. {
  32. return false;
  33. }
  34. if (!other.Normal.IsAlmostEqualTo(Normal, Tools.Epsilon))
  35. {
  36. return false;
  37. }
  38. if (UV != null && !other.UV.IsAlmostEqualTo(UV, Tools.Epsilon))
  39. {
  40. return false;
  41. }
  42. if (UV2 != null && !other.UV2.IsAlmostEqualTo(UV2, Tools.Epsilon))
  43. {
  44. return false;
  45. }
  46. if (Weights != null && !other.Weights.IsAlmostEqualTo(Weights, Tools.Epsilon))
  47. {
  48. return false;
  49. }
  50. if (Color != null && !other.Color.IsAlmostEqualTo(Color, Tools.Epsilon))
  51. {
  52. return false;
  53. }
  54. return other.BonesIndices == BonesIndices;
  55. }
  56. }
  57. }