Record Class PatternSettings.PositionSettings
java.lang.Object
java.lang.Record
at.petrak.hexcasting.client.render.PatternSettings.PositionSettings
- Enclosing class:
- PatternSettings
public static record PatternSettings.PositionSettings(double spaceWidth, double spaceHeight, double hPadding, double vPadding, PatternSettings.AxisAlignment hAxis, PatternSettings.AxisAlignment vAxis, double baseScale, double minWidth, double minHeight)
extends Record
Settings for positioning the pattern and defining its general size/render area. All values are in 'pose units',
meaning we use them directly with the pose/matrix stack given to the renderer.
We do a first pass at the pattern scale using baseScale. We then make sure it's larger than minWidth and minHeight. Then on each axis, if that axis is has a FIT alignment then we may scale down the pattern to make sure it fits. Note that the padding is not scaled and is always respected.
-
Constructor Summary
ConstructorsConstructorDescriptionPositionSettings(double spaceWidth, double spaceHeight, double hPadding, double vPadding, PatternSettings.AxisAlignment hAxis, PatternSettings.AxisAlignment vAxis, double baseScale, double minWidth, double minHeight) Creates an instance of aPositionSettingsrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the value of thebaseScalerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.hAxis()Returns the value of thehAxisrecord component.doublehPadding()Returns the value of thehPaddingrecord component.doubleReturns the value of theminHeightrecord component.doubleminWidth()Returns the value of theminWidthrecord component.paddedSquare(double padding) Makes settings ideal for rendering in a square.paddedSquare(double padding, double baseScale, double minSize) doubleReturns the value of thespaceHeightrecord component.doubleReturns the value of thespaceWidthrecord component.final StringtoString()Returns a string representation of this record class.vAxis()Returns the value of thevAxisrecord component.doublevPadding()Returns the value of thevPaddingrecord component.
-
Constructor Details
-
PositionSettings
public PositionSettings(double spaceWidth, double spaceHeight, double hPadding, double vPadding, PatternSettings.AxisAlignment hAxis, PatternSettings.AxisAlignment vAxis, double baseScale, double minWidth, double minHeight) Creates an instance of aPositionSettingsrecord class.- Parameters:
spaceWidth- the value for thespaceWidthrecord componentspaceHeight- the value for thespaceHeightrecord componenthPadding- the value for thehPaddingrecord componentvPadding- the value for thevPaddingrecord componenthAxis- the value for thehAxisrecord componentvAxis- the value for thevAxisrecord componentbaseScale- the value for thebaseScalerecord componentminWidth- the value for theminWidthrecord componentminHeight- the value for theminHeightrecord component
-
-
Method Details
-
paddedSquare
Makes settings ideal for rendering in a square. This helper exists because this is the most common positioning pattern.- Parameters:
padding- a value 0-0.5 for how much padding should go on each side.- Returns:
- a PositionSettings object in a 1x1 space with the given padding value such that the pattern is centered
-
paddedSquare
public static PatternSettings.PositionSettings paddedSquare(double padding, double baseScale, double minSize) -
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
spaceWidth
public double spaceWidth()Returns the value of thespaceWidthrecord component.- Returns:
- the value of the
spaceWidthrecord component
-
spaceHeight
public double spaceHeight()Returns the value of thespaceHeightrecord component.- Returns:
- the value of the
spaceHeightrecord component
-
hPadding
public double hPadding()Returns the value of thehPaddingrecord component.- Returns:
- the value of the
hPaddingrecord component
-
vPadding
public double vPadding()Returns the value of thevPaddingrecord component.- Returns:
- the value of the
vPaddingrecord component
-
hAxis
Returns the value of thehAxisrecord component.- Returns:
- the value of the
hAxisrecord component
-
vAxis
Returns the value of thevAxisrecord component.- Returns:
- the value of the
vAxisrecord component
-
baseScale
public double baseScale()Returns the value of thebaseScalerecord component.- Returns:
- the value of the
baseScalerecord component
-
minWidth
public double minWidth()Returns the value of theminWidthrecord component.- Returns:
- the value of the
minWidthrecord component
-
minHeight
public double minHeight()Returns the value of theminHeightrecord component.- Returns:
- the value of the
minHeightrecord component
-