GlobalVertex.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 override int GetHashCode()
  15. {
  16. return base.GetHashCode();
  17. }
  18. public override bool Equals(object obj)
  19. {
  20. if (!(obj is GlobalVertex))
  21. {
  22. return false;
  23. }
  24. var other = (GlobalVertex)obj;
  25. if (other.BaseIndex != BaseIndex)
  26. {
  27. return false;
  28. }
  29. if (!other.Position.IsAlmostEqualTo(Position, Tools.Epsilon))
  30. {
  31. return false;
  32. }
  33. if (!other.Normal.IsAlmostEqualTo(Normal, Tools.Epsilon))
  34. {
  35. return false;
  36. }
  37. if (UV != null && !other.UV.IsAlmostEqualTo(UV, Tools.Epsilon))
  38. {
  39. return false;
  40. }
  41. if (UV2 != null && !other.UV2.IsAlmostEqualTo(UV2, Tools.Epsilon))
  42. {
  43. return false;
  44. }
  45. if (Weights != null && !other.Weights.IsAlmostEqualTo(Weights, Tools.Epsilon))
  46. {
  47. return false;
  48. }
  49. return other.BonesIndices == BonesIndices;
  50. }
  51. }
  52. }