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 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 a PositionSettings record class.
      Parameters:
      spaceWidth - the value for the spaceWidth record component
      spaceHeight - the value for the spaceHeight record component
      hPadding - the value for the hPadding record component
      vPadding - the value for the vPadding record component
      hAxis - the value for the hAxis record component
      vAxis - the value for the vAxis record component
      baseScale - the value for the baseScale record component
      minWidth - the value for the minWidth record component
      minHeight - the value for the minHeight record component
  • Method Details

    • paddedSquare

      public static PatternSettings.PositionSettings paddedSquare(double padding)
      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

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • spaceWidth

      public double spaceWidth()
      Returns the value of the spaceWidth record component.
      Returns:
      the value of the spaceWidth record component
    • spaceHeight

      public double spaceHeight()
      Returns the value of the spaceHeight record component.
      Returns:
      the value of the spaceHeight record component
    • hPadding

      public double hPadding()
      Returns the value of the hPadding record component.
      Returns:
      the value of the hPadding record component
    • vPadding

      public double vPadding()
      Returns the value of the vPadding record component.
      Returns:
      the value of the vPadding record component
    • hAxis

      Returns the value of the hAxis record component.
      Returns:
      the value of the hAxis record component
    • vAxis

      Returns the value of the vAxis record component.
      Returns:
      the value of the vAxis record component
    • baseScale

      public double baseScale()
      Returns the value of the baseScale record component.
      Returns:
      the value of the baseScale record component
    • minWidth

      public double minWidth()
      Returns the value of the minWidth record component.
      Returns:
      the value of the minWidth record component
    • minHeight

      public double minHeight()
      Returns the value of the minHeight record component.
      Returns:
      the value of the minHeight record component