Record Class InstancerProviderImpl
- All Implemented Interfaces:
InstancerProvider
-
Constructor Summary
ConstructorsConstructorDescriptionInstancerProviderImpl(EngineImpl engine) Creates an instance of aInstancerProviderImplrecord class. -
Method Summary
Modifier and TypeMethodDescriptionengine()Returns the value of theenginerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.instancer(InstanceType<I> type, Model model, int bias) Get an instancer for the given instance type rendering the given model.final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface dev.engine_room.flywheel.api.instance.InstancerProvider
instancer
-
Constructor Details
-
InstancerProviderImpl
Creates an instance of aInstancerProviderImplrecord class.- Parameters:
engine- the value for theenginerecord component
-
-
Method Details
-
instancer
Description copied from interface:InstancerProviderGet an instancer for the given instance type rendering the given model.Calling this method twice with the same arguments in the same frame will return the same instancer.
It is NOT safe to store instancers between frames. Each time you need an instancer, you should call this method.
Render Order
In general, you can assume all instances in the same instancer will be rendered in a single draw call. Backends are free to optimize the ordering of draw calls to a certain extent, but utilities are provided to let you exert control over the ordering.
Mesh Order
For one, Meshes within a Model are guaranteed to render in the order they appear in their containing list. This lets you e.g. preserve (or break!) vanilla's chunk RenderType order guarantees or control which Meshes of your Model render over others.
Bias Order
The other method is via the
biasparameter to this method. An instancer with a lower bias will have its instances draw BEFORE an instancer with a higher bias. This allows you to control the render order between your instances to e.g. create an "overlay" instance to selectively color or apply decals to another instance.- Specified by:
instancerin interfaceInstancerProvider- Parameters:
type- The instance type to parameterize your instances by.model- The Model to instance.bias- A weight to control render order between instancers. Instancers are rendered in ascending order by bias.- Returns:
- An instancer.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
engine
Returns the value of theenginerecord component.- Returns:
- the value of the
enginerecord component
-