public float Calculate(IHeightfieldHeightDescription heightDescription) { var heightRange = heightDescription.HeightRange; switch (heightDescription.HeightType) { case HeightfieldTypes.Float: return(1f); case HeightfieldTypes.Short: return(Math.Max(Math.Abs(heightRange.X), Math.Abs(heightRange.Y)) / short.MaxValue); case HeightfieldTypes.Byte: if (Math.Abs(heightRange.X) <= Math.Abs(heightRange.Y)) { return(heightRange.Y / byte.MaxValue); } else { return(heightRange.X / byte.MaxValue); } default: return(1f); } }
public float Calculate(IHeightfieldHeightDescription heightDescription) => Value;