reworked mesh decimation yes
This commit is contained in:
48
LightlessSync/ThirdParty/Nanomesh/Base/VertexData.cs
vendored
Normal file
48
LightlessSync/ThirdParty/Nanomesh/Base/VertexData.cs
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Nanomesh
|
||||
{
|
||||
public struct VertexData : IEquatable<VertexData>
|
||||
{
|
||||
public int position;
|
||||
public List<object> attributes; // TODO : This is not optimal regarding memory
|
||||
|
||||
public VertexData(int pos)
|
||||
{
|
||||
position = pos;
|
||||
attributes = new List<object>();
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
int hash = 17;
|
||||
hash = hash * 31 + position;
|
||||
foreach (object attr in attributes)
|
||||
{
|
||||
hash = hash * 31 + attr.GetHashCode();
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Equals(VertexData other)
|
||||
{
|
||||
if (!position.Equals(other.position))
|
||||
return false;
|
||||
|
||||
if (attributes.Count != other.attributes.Count)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < attributes.Count; i++)
|
||||
{
|
||||
if (!attributes[i].Equals(other.attributes[i]))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user