Skip to main content
Version: 1.0.0

Class QuantizeAttribute

Namespace: ReadyM.Api.Multiplayer.Generators
Assembly: ReadyM.Api.Multiplayer.dll

The float or vector field is sent over the wire as a fixed-point number in bits bits (8, 16 or 24) between min and max, instead of a 4-byte float per number.

[AttributeUsage(AttributeTargets.Property|AttributeTargets.Field)]
public sealed class QuantizeAttribute : Attribute

Inheritance​

object ← Attribute ← QuantizeAttribute

Inherited Members​

Attribute.GetCustomAttributes(MemberInfo, Type), Attribute.GetCustomAttributes(MemberInfo, Type, bool), Attribute.GetCustomAttributes(MemberInfo), Attribute.GetCustomAttributes(MemberInfo, bool), Attribute.IsDefined(MemberInfo, Type), Attribute.IsDefined(MemberInfo, Type, bool), Attribute.GetCustomAttribute(MemberInfo, Type), Attribute.GetCustomAttribute(MemberInfo, Type, bool), Attribute.GetCustomAttributes(ParameterInfo), Attribute.GetCustomAttributes(ParameterInfo, Type), Attribute.GetCustomAttributes(ParameterInfo, Type, bool), Attribute.GetCustomAttributes(ParameterInfo, bool), Attribute.IsDefined(ParameterInfo, Type), Attribute.IsDefined(ParameterInfo, Type, bool), Attribute.GetCustomAttribute(ParameterInfo, Type), Attribute.GetCustomAttribute(ParameterInfo, Type, bool), Attribute.GetCustomAttributes(Module, Type), Attribute.GetCustomAttributes(Module), Attribute.GetCustomAttributes(Module, bool), Attribute.GetCustomAttributes(Module, Type, bool), Attribute.IsDefined(Module, Type), Attribute.IsDefined(Module, Type, bool), Attribute.GetCustomAttribute(Module, Type), Attribute.GetCustomAttribute(Module, Type, bool), Attribute.GetCustomAttributes(Assembly, Type), Attribute.GetCustomAttributes(Assembly, Type, bool), Attribute.GetCustomAttributes(Assembly), Attribute.GetCustomAttributes(Assembly, bool), Attribute.IsDefined(Assembly, Type), Attribute.IsDefined(Assembly, Type, bool), Attribute.GetCustomAttribute(Assembly, Type), Attribute.GetCustomAttribute(Assembly, Type, bool), Attribute.Equals(object?), Attribute.GetHashCode(), Attribute.Match(object?), Attribute.IsDefaultAttribute(), Attribute.TypeId, object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Remarks​

Values outside the range are clamped, so pick a range the value can never leave. The step between two values the network can tell apart is (max - min) / (2^bits - 2), which keeps both ends and the middle of the range exact. A change is sent only when it crosses into another step and is over 0.1, the cutoff plain fields use.

Constructors​

QuantizeAttribute(float, float, int)​

The float or vector field is sent over the wire as a fixed-point number in bits bits (8, 16 or 24) between min and max, instead of a 4-byte float per number.

public QuantizeAttribute(float min, float max, int bits)

Parameters​

min float

max float

bits int

Remarks​

Values outside the range are clamped, so pick a range the value can never leave. The step between two values the network can tell apart is (max - min) / (2^bits - 2), which keeps both ends and the middle of the range exact. A change is sent only when it crosses into another step and is over 0.1, the cutoff plain fields use.

Properties​

Bits​

public int Bits { get; }

Property Value​

int

Max​

public float Max { get; }

Property Value​

float

Min​

public float Min { get; }

Property Value​

float