/// <summary> /// Creates a appearance hash /// </summary> /// <param name="Seed"></param> /// <returns></returns> protected virtual uint GetAppearanceHash(uint Seed) { // calculate hash hash.Reset(Seed); hash.Step((uint)(RenderInfo.Dimension.X)); hash.Step((uint)(RenderInfo.Dimension.Y)); hash.Step((uint)(HotspotIndex)); return(hash.Finish()); }
protected override uint GetAppearanceHash(uint Seed) { // calculate hash Murmur3 hash = new Murmur3(Seed); hash.Step((uint)(RenderInfo.Dimension.X)); hash.Step((uint)(RenderInfo.Dimension.Y)); hash.Step((uint)(HotspotIndex)); // additional to generic values: add flags hash.Step(dataSource.Flags.Value); return(hash.Finish()); }
/// <summary> /// Creates a 32bit hash for the appearance of the projectile. /// </summary> /// <returns></returns> protected virtual uint GetAppearanceHash() { hash.Reset(); hash.Step((uint)overlayFileRID); hash.Step((uint)flags); hash.Step((uint)colorTranslation); if (resource != null) { hash.Step((uint)ViewerFrameIndex); } return(hash.Finish()); }
public ulong CalculateHash() { const float position_granularity = 0.001f; // millimeter const float normal_granularity = 0.00001f; const float color_granularity = 0.001f; const float uv_granularity = 0.0001f; var hasher = new Murmur3(); hasher.AddHash(m_posSet); hasher.AddHash(m_normalSet); hasher.AddHash(m_uv1Set); hasher.AddHash(m_uv2Set); hasher.AddHash(m_uv3Set); if (m_posSet) { hasher.AddHash(m_pos, position_granularity); } if (m_normalSet) { hasher.AddHash(m_normal, normal_granularity); } hasher.AddHash(m_color, color_granularity); if (m_uv1Set) { hasher.AddHash(m_uv1, uv_granularity); } if (m_uv2Set) { hasher.AddHash(m_uv2, uv_granularity); } if (m_uv3Set) { hasher.AddHash(m_uv3, uv_granularity); } hasher.Finish(); return(hasher.Hash64Bit); }
/// <summary> /// Creates a 32bit hash for the appearance of the object. /// </summary> /// <returns></returns> protected virtual uint GetAppearanceHash() { hash.Reset(); hash.Step((uint)overlayFileRID); //hash.Step((uint)flags.Flags); hash.Step((uint)colorTranslation); if (resource != null) { hash.Step((uint)ViewerFrameIndex); } foreach (SubOverlay obj in subOverlays) { hash.Step((uint)obj.GetAppearanceHash(false)); } return(hash.Finish()); }