threejs-grass
    Preparing search index...

    Class TerrainPainter

    Paint a Grass's grassMap directly on the terrain: left-drag to apply the brush; a ring follows the pointer. Works with mesh and height-function terrain alike. Disable your camera controls while painting — they listen to the same pointer events.

    const painter = new TerrainPainter(grass, renderer.domElement, { mode: 'add', radius: 3 })
    painter.brush.mode = 'erase' // change the brush at any time
    painter.enabled = false // pause painting
    Index
    • Parameters

      • grass: Grass

        Field whose grassMap is painted. Must have a grass map.

      • domElement: HTMLElement

        Element receiving pointer events, usually renderer.domElement.

      • brush: Partial<Brush> = {}

        Initial brush settings.

      Returns TerrainPainter

      If the grass has no grassMap.

    brush: Brush

    Current brush. Mutate freely. Defaults: erase, 3 m radius, 0.25 strength.

    cursor: Mesh

    Brush outline that follows the terrain under the pointer.

    domElement: HTMLElement

    Element receiving pointer events, usually renderer.domElement.

    enabled: boolean = true

    When false, pointer events are ignored and the cursor is hidden.

    grass: Grass

    Field whose grassMap is painted. Must have a grass map.

    • Removes listeners and the cursor.

      Returns void