Record Class VfxLayer
java.lang.Object
java.lang.Record
net.ixdarklord.coolcatcanvas.api.client.vfx.VfxLayer
- Record Components:
order- where the layer is drawn: lower firstsorted- whether its painted-over shapes are drawn back to front across materials
Where in a frame's world effects a shape is drawn, given to
VfxFrame.draw(VfxMaterial, VfxLayer). World effects
write no depth of their own, so what's drawn later covers what's drawn earlier wherever they overlap, nearer or not.
Layers say what that order is:
- Layers are drawn from the lowest
order()to the highest, so a higher layer always covers a lower one. - Within a layer, everything painted over the scene (
VfxBlend.ALPHA,VfxBlend.LUMINOUS) is drawn first and everything added to it (VfxBlend.ADDITIVE) last; additive shapes look the same in any order. - In a plain layer, the painted-over shapes are drawn material by material, each material where it was first drawn in the frame and its shapes in the order they were drawn. That's cheap, and right when one material's shapes never need to cover another's.
- In a
sortedlayer, the painted-over shapes of every material are drawn back to front, the farthest from the camera first: shapes of different textures cover each other as their distance says. It costs a sort of the layer's shapes each frame (by each one's middle), and a draw call wherever the material changes along the way.
WorldVfx are drawn in DEFAULT.
VfxLayer HANDS = VfxLayer.sorted(10); // the hands and arms of a creature, which reach in front of each other
frame.draw(HAND, HANDS).quad(...);
frame.draw(ARM, HANDS).quad(...);
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionVfxLayer(int order, boolean sorted) Creates an instance of aVfxLayerrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static VfxLayerof(int order) A plain layer: drawn material by material in first-use order.intorder()Returns the value of theorderrecord component.booleansorted()Returns the value of thesortedrecord component.static VfxLayersorted(int order) A sorted layer: its painted-over shapes, of every material, drawn from the farthest to the nearest.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
DEFAULT
Layer 0, not sorted: where shapes go without a layer.
-
-
Constructor Details
-
Method Details
-
of
A plain layer: drawn material by material in first-use order. -
sorted
A sorted layer: its painted-over shapes, of every material, drawn from the farthest to the nearest. -
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 with '=='. -
order
public int order()Returns the value of theorderrecord component.- Returns:
- the value of the
orderrecord component
-
sorted
public boolean sorted()Returns the value of thesortedrecord component.- Returns:
- the value of the
sortedrecord component
-