GeometryHelper

public abstract class GeometryHelper

Static routines of general utility for renderer implementations. Renderers are not required to use these helpers, but they were designed to be usable without the default renderer.

Functions

computeShapeFlags
Link copied to clipboard
static int computeShapeFlags(QuadView quad)
Analyzes the quad and returns a value with some combinationof AXIS_ALIGNED_FLAG, LIGHT_FACE_FLAG and CUBIC_FLAG.Intended use is to optimize lighting when the geometry is regular.Expects convex quads with all points co-planar.
isParallelQuadOnFace
Link copied to clipboard
static boolean isParallelQuadOnFace(Direction lightFace, QuadView quad)
True if quad - already known to be parallel to a face - is actually coplanar with it.For compatibility with vanilla resource packs, also true if quad is outside the face.
isQuadCubic
Link copied to clipboard
static boolean isQuadCubic(@NotNull() Direction lightFace, QuadView quad)
Returns true if quad is truly a quad (not a triangle) and fills a full block cross-section.If known to be true, allows use of a simpler/faster AO lighting algorithm.
isQuadParallelToFace
Link copied to clipboard
static boolean isQuadParallelToFace(Direction face, QuadView quad)
Returns true if quad is parallel to the given face.Does not validate quad winding order.Expects convex quads with all points co-planar.
lightFace
Link copied to clipboard
static Direction lightFace(QuadView quad)
Identifies the face to which the quad is most closely aligned.
longestAxis
Link copied to clipboard
static Direction.Axis longestAxis(Vec3f vec)
#longestAxis(float, float, float)
static Direction.Axis longestAxis(float normalX, float normalY, float normalZ)
Identifies the largest (max absolute magnitude) component (X, Y, Z) in the given vector.
max
Link copied to clipboard
static float max(float a, float b, float c, float d)
Simple 4-way compare, doesn't handle NaN values.
min
Link copied to clipboard
static float min(float a, float b, float c, float d)
Simple 4-way compare, doesn't handle NaN values.

Properties

AXIS_ALIGNED_FLAG
Link copied to clipboard
public final static int AXIS_ALIGNED_FLAG
set when a quad is parallel to (but not necessarily on) a its light face.
CUBIC_FLAG
Link copied to clipboard
public final static int CUBIC_FLAG
set when a quad touches all four corners of a unit cube.
FLAG_BIT_COUNT
Link copied to clipboard
public final static int FLAG_BIT_COUNT
how many bits quad header encoding should reserve for encoding geometry flags.
LIGHT_FACE_FLAG
Link copied to clipboard
public final static int LIGHT_FACE_FLAG
set when a quad is coplanar with its light face.

Sources

jvm source
Link copied to clipboard