Interface InstancerProvider
-
Method Summary
Modifier and TypeMethodDescriptioninstancer(InstanceType<I> type, Model model) Get an instancer with no bias for the given instance type rendering the given model with.instancer(InstanceType<I> type, Model model, int bias) Get an instancer for the given instance type rendering the given model.
-
Method Details
-
instancer
Get 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.- 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.
-
instancer
Get an instancer with no bias for the given instance type rendering the given model with.- Parameters:
type- The instance type to parameterize your instances by.model- The model to instance.- Returns:
- An instancer with
bias == 0.
-