Class TessellatedTexturedTriangle


public class TessellatedTexturedTriangle extends TexturedTriangle
A textured triangle with pre-computed screen-space coordinates.

This class is created by the ScreenSpaceTessellator during tessellation. Unlike regular TexturedTriangle, it skips the vertex transformation step during rendering because its screen coordinates and Z-depth are already computed.

This optimization avoids redundant coordinate transformation for tessellated sub-triangles, improving performance when large polygons are split into many smaller pieces.

See Also:
  • Constructor Details

  • Method Details

    • transform

      public void transform(TransformStack transforms, RenderAggregator aggregator, RenderingContext renderingContext)
      Transforms this triangle for rendering by transforming vertices normally.

      Unlike the original design that skipped transformation, this method now transforms vertices normally using their world coordinates. The world coordinates were correctly interpolated during tessellation, so the resulting screen coordinates will be fresh for each frame.

      Overrides:
      transform in class AbstractCoordinateShape
      Parameters:
      transforms - the transform stack to apply
      aggregator - the aggregator to queue this shape for rendering
      renderingContext - the rendering context
    • interpolateMidpoint

      public static Vertex interpolateMidpoint(Vertex v1, Vertex v2, Point2D screen1, Point2D screen2)
      Creates a tessellated triangle by interpolating between two vertices.

      This factory method creates a new vertex at the midpoint of two vertices, interpolating world coordinates, texture coordinates, screen coordinates, and Z-depth. Used during tessellation to split edges.

      Parameters:
      v1 - the first vertex endpoint
      v2 - the second vertex endpoint
      screen1 - the screen coordinate of the first vertex
      screen2 - the screen coordinate of the second vertex
      Returns:
      a new vertex at the midpoint with interpolated properties