// Pack input data to ulong public static ulong GenerateBits(FSLayer layer, Viewport vp, VPLayer vpLayer, Translucency trans, ushort Material, ushort depth, ushort ibID, ushort vbID) { ulong result = (ulong)layer << 62; result += (ulong)vp << 59; result += (ulong)vpLayer << 56; result += (ulong)trans << 54; int maxvb = 1 << 10; if (vbID > maxvb || ibID > maxvb) { // Overflow Common.Instance.WriteLine("VB/IB OVERFLOW!!!"); } result += (ulong)vbID << 43; result += (ulong)ibID << 32; if (trans == Translucency.OPAQUE) { // Material first result += (ulong)Material << 16; result += (ulong)depth; } else { // Depth first result += (ulong)depth << 16; result += (ulong)Material; } if (vpLayer != GetVPLayer(result)) { int test = 2; } return result; }
public override int GetHashCode() { unchecked { var hashCode = ScatteringWidth.GetHashCode(); hashCode = (hashCode * 397) ^ Translucency.GetHashCode(); hashCode = (hashCode * 397) ^ TranslucencyMap.GetHashCode(); hashCode = (hashCode * 397) ^ ProfileFunction.GetHashCode(); hashCode = (hashCode * 397) ^ KernelFunction.GetHashCode(); return(hashCode); } }
protected bool Equals(MaterialSubsurfaceScatteringFeature other) { return(ScatteringWidth.Equals(other.ScatteringWidth) && Translucency.Equals(other.Translucency) && TranslucencyMap.Equals(other.TranslucencyMap) && ProfileFunction.Equals(other.ProfileFunction) && KernelFunction.Equals(other.KernelFunction)); }