GlobalVertex.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 int BonesIndicesExtra { get; set; }
  15. public IPoint4 WeightsExtra { get; set; }
  16. public float[] Color { get; set; }
  17. public override int GetHashCode()
  18. {
  19. return base.GetHashCode();
  20. }
  21. public override bool Equals(object obj)
  22. {
  23. if (!(obj is GlobalVertex))
  24. {
  25. return false;
  26. }
  27. var other = (GlobalVertex)obj;
  28. if (other.BaseIndex != BaseIndex)
  29. {
  30. return false;
  31. }
  32. if (!other.Position.IsAlmostEqualTo(Position, Tools.Epsilon))
  33. {
  34. return false;
  35. }
  36. if (!other.Normal.IsAlmostEqualTo(Normal, Tools.Epsilon))
  37. {
  38. return false;
  39. }
  40. if (UV != null && !other.UV.IsAlmostEqualTo(UV, Tools.Epsilon))
  41. {
  42. return false;
  43. }
  44. if (UV2 != null && !other.UV2.IsAlmostEqualTo(UV2, Tools.Epsilon))
  45. {
  46. return false;
  47. }
  48. if (Weights != null && !other.Weights.IsAlmostEqualTo(Weights, Tools.Epsilon))
  49. {
  50. return false;
  51. }
  52. if (WeightsExtra != null && !other.WeightsExtra.IsAlmostEqualTo(WeightsExtra, Tools.Epsilon))
  53. {
  54. return false;
  55. }
  56. if (Color != null && !other.Color.IsAlmostEqualTo(Color, Tools.Epsilon))
  57. {
  58. return false;
  59. }
  60. return other.BonesIndices == BonesIndices;
  61. }
  62. }
  63. }