GlobalVertex.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using Autodesk.Max;
  2. namespace Max2Babylon
  3. {
  4. public struct GlobalVertex
  5. {
  6. const float epsilon = 0.001f;
  7. public IPoint3 Position { get; set; }
  8. public IPoint3 Normal { get; set; }
  9. public IPoint2 UV { get; set; }
  10. public IPoint2 UV2 { get; set; }
  11. public override int GetHashCode()
  12. {
  13. return base.GetHashCode();
  14. }
  15. public override bool Equals(object obj)
  16. {
  17. if (!(obj is GlobalVertex))
  18. {
  19. return false;
  20. }
  21. var other = (GlobalVertex)obj;
  22. if (!other.Position.IsAlmostEqualTo(Position, epsilon))
  23. {
  24. return false;
  25. }
  26. if (!other.Normal.IsAlmostEqualTo(Normal, epsilon))
  27. {
  28. return false;
  29. }
  30. if (UV != null && !other.UV.IsAlmostEqualTo(UV, epsilon))
  31. {
  32. return false;
  33. }
  34. if (UV2 != null && !other.UV2.IsAlmostEqualTo(UV2, epsilon))
  35. {
  36. return false;
  37. }
  38. return true;
  39. }
  40. }
  41. }