threejs-worldgen
    Preparing search index...

    Class FlattenMap

    Where corn has been flattened, and which way it fell: a world-space grid over the fields, RGBA bytes per texel (R = amount 0..255, G/B = fall direction x/z mapped from [-1, 1], A = 255). It only ever grows: corn that was driven over stays down. Row 0 is at minZ; texel (i, j) is centred on minX + (i + 0.5) * texel.

    Index
    • Covers [minX, maxX] × [minZ, maxZ] with square texels of texel metres (at most maxTexels per side).

      Parameters

      • minX: number
      • minZ: number
      • maxX: number
      • maxZ: number
      • texel: number
      • maxTexels: number = 2048

      Returns FlattenMap

    data: Uint8Array

    Raw RGBA bytes, width × height texels.

    height: number

    Texels along Z.

    minX: number

    World X of the west edge.

    minZ: number

    World Z of the north (−Z) edge.

    texel: number

    Texel size in metres.

    version: number = 0

    Increases on every change, so renderers know when to upload.

    width: number

    Texels along X.

    • Flattened amount (0 standing … 1 flat) of the texel containing (x, z); 0 outside the map.

      Parameters

      • x: number
      • z: number

      Returns number

    • Flattens a disk of radius metres around (x, z), with an antialiased one-texel rim. Corn falls along (dirX, dirZ) (the direction of travel), splayed outwards towards the rim; with no direction it falls straight outwards. Returns whether anything changed.

      Parameters

      • x: number
      • z: number
      • radius: number
      • dirX: number = 0
      • dirZ: number = 0

      Returns boolean