Class ProgramContext

java.lang.Object
com.jozufozu.flywheel.core.compile.ProgramContext

public final class ProgramContext extends Object
Represents the entire context of a program's usage.
  • Field Details

    • spec

      public final ProgramSpec spec
    • alphaDiscard

      public final float alphaDiscard
    • vertexType

      public final VertexType vertexType
    • ctx

      public final StateSnapshot ctx
  • Constructor Details

    • ProgramContext

      public ProgramContext(ProgramSpec spec, float alphaDiscard, VertexType vertexType, StateSnapshot ctx)
      Parameters:
      spec - The program to use.
      alphaDiscard - Alpha threshold below which pixels are discarded.
      vertexType - The vertexType the program should be adapted for.
      ctx - A snapshot of the game state.
  • Method Details

    • create

      public static ProgramContext create(net.minecraft.resources.ResourceLocation programName, VertexType vertexType, @Nullable RenderLayer layer)
      Creates a compilation context for the given program, vertex type and render layer.
      Parameters:
      programName - The name of the program to use.
      vertexType - The vertex type to use.
      layer - If cutout, the alpha discard threshold is 0.1, otherwise 0.
      Returns:
      A compilation context.
    • getAlphaDiscard

      public static float getAlphaDiscard(@Nullable RenderLayer layer)
      Gets the alpha discard threshold for the given render layer.
      Parameters:
      layer - The render layer to get the alpha discard threshold for.
      Returns:
      The alpha discard threshold.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object