Overview
TheModelScaler interface defines how a model’s scale is calculated. Scalers can be constant values, derived from entity attributes, or composites of multiple scalers. They are serializable to JSON for configuration purposes.
Interface Definition
Core Methods
name()
Returns the name of this scaler type.scale()
Calculates the scale for a given tracker.tracker- The tracker instance to calculate scale for
data()
Returns the configuration data for this scaler as a JSON element.Static Factory Methods
defaultScaler()
Returns the default scaler (constant 1.0).entity()
Returns a scaler that uses the entity’s scale attribute.value()
Returns a constant value scaler.value- The constant scale value
composite()
Creates a composite scaler that multiplies the results of multiple scalers.scalers- The scalers to combine
deserialize()
Deserializes a scaler from a JSON object.element- The JSON object containing scaler configuration
Instance Methods
multiply()
Multiplies this scaler by a constant value.value- The multiplier
composite()
Multiplies this scaler by another scaler.scaler- The other scaler to multiply with
serialize()
Serializes this scaler to a JSON object.Nested Interfaces
Getter
Functional interface for calculating scale values.DEFAULT- Returns 1.0ENTITY- Returns entity scale attribute
Builder
Builder interface for creating Getters from JSON.Usage Example
JSON Format
Scalers are serialized using the following JSON format:Extending ModelScaler
You can register custom scaler types using theDeserializer:
See Also
- ModelRotation - For rotating models
- Tracker - For tracking model state
