public LiteFloatCrusher(LiteFloatCompressType compressType, Normalization normalization = Normalization.None, LiteOutOfBoundsHandling outOfBoundsHandling = LiteOutOfBoundsHandling.Clamp) { this.compressType = compressType; this.normalization = normalization; switch (normalization) { case Normalization.None: this.min = 0; this.max = 1; accurateCenter = false; break; case Normalization.Positive: this.min = 0; this.max = 1; accurateCenter = false; break; case Normalization.Negative: this.min = -1; this.max = 1; accurateCenter = true; break; } this.outOfBoundsHandling = outOfBoundsHandling; Recalculate(compressType, min, max, accurateCenter, this); }
public LiteFloatCrusher(LiteFloatCompressType compressType, float min, float max, bool accurateCenter, LiteOutOfBoundsHandling outOfBoundsHandling = LiteOutOfBoundsHandling.Clamp) { this.compressType = compressType; this.normalization = Normalization.None; /// Don't allow min and max to equal. if (min == max) { max++; Debug.LogWarning("Float crusher is being given min and max values that are the same. This likely is not intentional. Check your range values. Value is <i>" + min + "</i>, changing the max to " + max + " to avoid division by zero errors."); } if (min < max) { this.min = min; this.max = max; } else { this.min = max; this.max = min; } this.accurateCenter = accurateCenter; this.outOfBoundsHandling = outOfBoundsHandling; Recalculate(compressType, min, max, accurateCenter, this); }