threejs-worldgen
    Preparing search index...

    Class Fish

    One procedural fish (a hero asset or a gallery item): any FishSpecies, live-editable, swimming in place. Move it by moving Fish.object; it faces +z and is species.length metres long.

    const fish = await Fish.create({ scene, renderer, preset: 'clownfish', seed: 3 })
    fish.set({ species: { pattern: { stripes: { count: 4 } } }, speed: 2 })
    Index
    object: Group<Object3DEventMap> = ...

    Root object; position and rotate it.

    settings: FishSettings

    Resolved settings.

    time: number = 0

    Seconds of animation.

    uniforms: {
        back: UniformNode<"color", Color>;
        belly: UniformNode<"color", Color>;
        eye: UniformNode<"vec3", Vector3>;
        eyeColor: UniformNode<"color", Color>;
        fin: UniformNode<"color", Color>;
        mouth: UniformNode<"vec3", Vector3>;
        shade: UniformNode<"vec2", Vector2>;
        spotColor: UniformNode<"color", Color>;
        spots: UniformNode<"vec4", Vector4>;
        states: UniformNode<"vec4", Vector4>;
        stripeColor: UniformNode<"color", Color>;
        stripeRegion: UniformNode<"vec3", Vector3>;
        stripes: UniformNode<"vec4", Vector4>;
        surface: UniformNode<"vec3", Vector3>;
        swim: UniformNode<"vec3", Vector3>;
    } = ...

    Shader uniforms.

    Type Declaration

    • back: UniformNode<"color", Color>

      Back colour.

    • belly: UniformNode<"color", Color>

      Belly colour.

    • eye: UniformNode<"vec3", Vector3>

      x = eye z, y = eye y, z = radius (mesh units).

    • eyeColor: UniformNode<"color", Color>

      Iris colour.

    • fin: UniformNode<"color", Color>

      Fin colour.

    • mouth: UniformNode<"vec3", Vector3>

      x = mouth line y, y = mouth length (in s), z = body depth.

    • shade: UniformNode<"vec2", Vector2>

      x = countershade, y = shade line.

    • spotColor: UniformNode<"color", Color>

      Spot colour.

    • spots: UniformNode<"vec4", Vector4>

      x = density, y = size, z = region min, w = region max.

    • states: UniformNode<"vec4", Vector4>

      x = wetness, y = snow, z = burn, w = damage.

    • stripeColor: UniformNode<"color", Color>

      Stripe colour.

    • stripeRegion: UniformNode<"vec3", Vector3>

      x = region min, y = region max, z = edge darkness.

    • stripes: UniformNode<"vec4", Vector4>

      x = count, y = width, z = direction, w = wobble.

    • surface: UniformNode<"vec3", Vector3>

      x = iridescence, y = metalness, z = roughness.

    • swim: UniformNode<"vec3", Vector3>

      x = amplitude, y = wave number (rad per body length), z = fin flutter.

    • Removes the fish and frees its GPU resources.

      Returns void

    • Changes settings, merging into earlier ones. Shape changes rebuild the mesh; everything else is instant.

      Parameters

      Returns this

    • Advances the swimming. Called automatically when a scene was given (and by <Fish>).

      Parameters

      • delta: number = ...

      Returns void