PolyhedralDev / Terra

Voxel world generation modding platform
MIT License
666 stars 87 forks source link

New generation config #126

Open dfsek opened 3 years ago

dfsek commented 3 years ago

Redo noise-equation to support:

Example config:

generation:
  combine: "base-eq+elevation-eq"
  carving: "something here"
  equations:
    elevation-eq: 
      equation: "simplex(x, z)"
      sampler: elevation
    base-eq:
      equation: "-y+base"
      sampler: generation
  samplers:
    elevation:
      style: XZ # maybe call this 2D
      sample:
        x: [0, 15]
        z: [0, 15]
      interpolation: # (optional, defaults to 4x4 bilerp/trilerp)
        type: FULL # Full resolution (no interpolation)
    generation:
      style: XYZ # maybe call this 3D
      sample:
        x: [0, 15]
        y: [0, 255]
        z: [0, 15]
      interpolation:
        type: LERP
        step:
          x: 4
          y: 4
          z: 4

This will require completely redoing how biome noise is fetched, to allow custom samplers to be queried efficiently on a per-biome basis. This would be a good time to switch to a 1D array for storing chunk noise values.

Noise values would be kept in a raw double array within the ChunkInterpolator (probably rename that).

Each biome would get an array to cache interpolators in, if applicable. When noise is requested from a specific coordinate, the interpolator array is queried, then if the interpolator is present it is accessed, if it is missing it is created. This allows for quick access to arbitrarily sized interpolators without needing to calculate an entire chunk of noise for every biome present in the generating chunk.

This supersedes #117 and #124

MaxBr5 commented 2 years ago

Don't fix it