Class LightmappedTriangle

All Implemented Interfaces:
LightmappedShape

public class LightmappedTriangle extends TexturedTriangle implements LightmappedShape
A textured triangle whose texture is a GI-generated lightmap composite (baseColor x lighting). UVs are fixed at (0,0), (width,0), (0,height) (engine UVs are in texture pixel units): the whole triangle is covered by its own lightmap, valid region u+v <= 1 in normalized coordinates.

Shading via LightingManager does not apply — all light (ambient, direct with shadows, indirect) lives in the composite texture, which the GI system regenerates and swaps in every few sweeps.

  • Constructor Details

    • LightmappedTriangle

      public LightmappedTriangle(Point3D a, Point3D b, Point3D c, Color baseColor, double unitsPerTexel, double normalX, double normalY, double normalZ)
      Creates a lightmapped triangle.
      Parameters:
      a - first vertex (shared coordinate reference is fine)
      b - second vertex
      c - third vertex
      baseColor - unlit surface color
      unitsPerTexel - world units per lightmap texel
      normalX - unit normal x
      normalY - unit normal y
      normalZ - unit normal z
  • Method Details

    • repinUvToLightmap

      public void repinUvToLightmap()
      Pins the corner UVs to the lightmap's CURRENT dimensions and refreshes the texture-distance estimate. Called at construction and by Lightmap.refine() (stage 4 changes the texture size — without re-pinning, the painter would sample only the coarse-sized corner of the fine texture). Each vertex gets its own frame-space corner (Lightmap.cornerU/cornerV) — the bounding-rect frame may assign any corner to any vertex.
    • getLightmap

      public Lightmap getLightmap()
      Description copied from interface: LightmappedShape
      Returns the lightmap for this shape.
      Specified by:
      getLightmap in interface LightmappedShape
      Returns:
      the lightmap