threejs-worldgen
    Preparing search index...

    Class Props

    Street and countryside props: every placement is assembled from a few unit shapes, and all of them are drawn as one InstancedMesh per (shape, material) pair, single-material, with typed-array per-instance tint (aTint, read in colorNode) and weather states (aStates). Power poles and pylons with the same line are strung with sagging catenary cables (instanced segments).

    Per-prop weather goes through Props.states, a threejs-weathering InstanceStates with one entry per placement, so applyDamage, StormDamage and sampleField work on props directly (positions in Props.positions). Damaged poles, lights and signs lean; wet props darken and shine; snow settles on top; burnt props char.

    const props = await Props.create({ scene, placements: decorateRoads(city.graph!, world).placements })
    props.states.set(3, { damage: 1 }) // prop 3 leans over
    applyDamage({ instances: props.states, positions: props.positions }, x, z, 20, 0.8)
    props.set({ night: 1, states: { wetness: 0.7 } }) // lamps on, everything wet
    Index
    meshes: Map<
        string,
        InstancedMesh<
            BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>,
            Material<MaterialEventMap> | Material<MaterialEventMap>[],
            Object3DEventMap,
        >,
    > = ...

    The instanced meshes, by shape|material (and cables).

    object: Group<Object3DEventMap> = ...

    Root object, in frame-local coordinates (add it where the placements' frame is, e.g. city.local).

    options: PropsOptions

    Resolved settings.

    positions: Float32Array = ...

    Placement positions, xyz per placement (for applyDamage, StormDamage, sampleField).

    Weather per placement (wetness, snow, burn, damage). Replaced when the number of placements changes.

    uniforms: {
        burn: UniformNode<"float", number>;
        damage: UniformNode<"float", number>;
        heat: UniformNode<"float", number>;
        lampIntensity: UniformNode<"float", number>;
        night: UniformNode<"float", number>;
        snow: UniformNode<"float", number>;
        trafficCycle: UniformNode<"float", number>;
        wetness: UniformNode<"float", number>;
    } = ...

    Shared material uniforms.

    Type Declaration

    • burn: UniformNode<"float", number>

      Burn floor, 0…1.

    • damage: UniformNode<"float", number>

      Damage floor, 0…1.

    • heat: UniformNode<"float", number>

      Ember glow, 0…1.

    • lampIntensity: UniformNode<"float", number>

      Lamp brightness (emissive multiplier).

    • night: UniformNode<"float", number>

      0 day … 1 night (used when no night node is given).

    • snow: UniformNode<"float", number>

      Snow floor, 0…1.

    • trafficCycle: UniformNode<"float", number>

      Seconds per traffic light cycle.

    • wetness: UniformNode<"float", number>

      Wetness floor for every prop, 0…1.

    • Changes settings, merging into the current ones. New placements rebuild the meshes; everything else is instant.

      Parameters

      Returns this

    • Applies per-prop states (lean, cable ice sag, shader states) when they changed. Called automatically when a scene was given (and by <Props>); cheap when nothing changed.

      Returns void