threejs-worldgen
    Preparing search index...

    Function updateSun

    • Reads the sun into uniforms. Without an explicit light, the first DirectionalLight in the scene that object belongs to is used (searched once, once object is in a scene). Returns the light used.

      Parameters

      • u: {
            crest: UniformNode<"float", number>;
            deepColor: UniformNode<"color", Color>;
            detail: UniformNode<"float", number>;
            detailDirection: UniformNode<"vec2", Vector2>;
            detailScale: UniformNode<"float", number>;
            detailSpeed: UniformNode<"float", number>;
            environmentIntensity: UniformNode<"float", number>;
            flowPeriod: UniformNode<"float", number>;
            foam: UniformNode<"float", number>;
            foamColor: UniformNode<"color", Color>;
            foamWidth: UniformNode<"float", number>;
            gridAngle: UniformNode<"float", number>;
            gridMinSpacing: UniformNode<"float", number>;
            gridScale: UniformNode<"float", number>;
            horizonColor: UniformNode<"color", Color>;
            maxArc: UniformNode<"float", number>;
            radius: UniformNode<"float", number>;
            rapids: UniformNode<"float", number>;
            reflectivity: UniformNode<"float", number>;
            refraction: UniformNode<"float", number>;
            roughness: UniformNode<"float", number>;
            shallowColor: UniformNode<"color", Color>;
            skyColor: UniformNode<"color", Color>;
            specular: UniformNode<"float", number>;
            sunColor: UniformNode<"color", Color>;
            sunDirection: UniformNode<"vec3", Vector3>;
            tanHalfFov: UniformNode<"float", number>;
            time: UniformNode<"float", number>;
            visibility: UniformNode<"float", number>;
            waveA: UniformArrayNode<string>;
            waveB: UniformArrayNode<string>;
            waveCount: UniformNode<"int", number>;
            whitecaps: UniformNode<"float", number>;
        }
        • crest: UniformNode<"float", number>

          Σ k·chop of the waves (normalises whitecaps).

        • deepColor: UniformNode<"color", Color>

          deepColor.

        • detail: UniformNode<"float", number>

          detail.

        • detailDirection: UniformNode<"vec2", Vector2>

          Unit drift direction of the ripples (x, z).

        • detailScale: UniformNode<"float", number>

          detailScale, metres.

        • detailSpeed: UniformNode<"float", number>

          detailSpeed, m/s.

        • environmentIntensity: UniformNode<"float", number>

          environmentIntensity.

        • flowPeriod: UniformNode<"float", number>

          Seconds per flow-map cycle (rivers).

        • foam: UniformNode<"float", number>

          foam, 0 … 1.

        • foamColor: UniformNode<"color", Color>

          foamColor.

        • foamWidth: UniformNode<"float", number>

          foamWidth, metres.

        • gridAngle: UniformNode<"float", number>

          Vertex spacing per metre of distance (2π / segments for the ocean rings; 0 = uniform grid).

        • gridMinSpacing: UniformNode<"float", number>

          Smallest vertex spacing, metres. Waves shorter than ~3 spacings fade out in the vertex stage.

        • gridScale: UniformNode<"float", number>

          Multiplier from geometry x/z to tangent-plane metres (the ocean's ring scale).

        • horizonColor: UniformNode<"color", Color>

          horizonColor.

        • maxArc: UniformNode<"float", number>

          Surface distance beyond which vertices are clamped (the horizon on planets).

        • radius: UniformNode<"float", number>

          Sphere radius the surface bends to (sea radius on planets; huge = flat).

        • rapids: UniformNode<"float", number>

          Flow speed (m/s) where river rapids start foaming.

        • reflectivity: UniformNode<"float", number>

          reflectivity (F0).

        • refraction: UniformNode<"float", number>

          refraction.

        • roughness: UniformNode<"float", number>

          roughness.

        • shallowColor: UniformNode<"color", Color>

          shallowColor.

        • skyColor: UniformNode<"color", Color>

          skyColor.

        • specular: UniformNode<"float", number>

          specular.

        • sunColor: UniformNode<"color", Color>

          Sun colour × intensity.

        • sunDirection: UniformNode<"vec3", Vector3>

          Direction towards the sun, world space.

        • tanHalfFov: UniformNode<"float", number>

          tan(fov / 2) of the camera, for the per-pixel detail fade.

        • time: UniformNode<"float", number>

          Seconds, advanced by the owner's update().

        • visibility: UniformNode<"float", number>

          visibility, metres.

        • waveA: UniformArrayNode<string>

          Per wave: direction x, direction z, wavenumber k, amplitude.

        • waveB: UniformArrayNode<string>

          Per wave: horizontal amplitude (chop), phase (radians, includes −ωt), unused, unused.

        • waveCount: UniformNode<"int", number>

          Active entries in waveA/waveB.

        • whitecaps: UniformNode<"float", number>

          Whitecap amount 0 … 1 (oceans and lakes).

      • light: DirectionalLight | null
      • object: Object3D
      • cache: { light: DirectionalLight | null; searched: boolean }

      Returns DirectionalLight | null