Appearance
@bendyline/molen-client/snow
Molen rendering client: three.js wrapper, snapshot sync, interpolation.
ts
import { /* … */ } from '@bendyline/molen-client/snow';Variables
SNOW_COVER_COLOR
ts
const SNOW_COVER_COLOR: readonly [number, number, number];Linear albedo of lying snow: bright, a little blue, short of white so sunlit slopes keep form.
SNOW_COVER_FACING
ts
const SNOW_COVER_FACING: readonly [number, number];World-normal up component across which a marked surface goes from bare to dusted, unless the material names its own range: walls stay clean and anything flatter than about 40 degrees is covered.
SNOW_COVER_GLSL
ts
const SNOW_COVER_GLSL: string;GLSL for the shared snow line. molenSnowLine(p, height, snow) is the share of ground covered at world XZ p (reduced by the period) and rendered height, for a snow uniform as writeSnowCoverValue fills it. Guarded, so a ground material that includes it and also takes the renderer's hook defines it once.
SNOW_COVER_PERIOD
ts
const SNOW_COVER_PERIOD: 4096 = 4096;Meters after which the snow line's wander repeats. A host passes world coordinates reduced by this period, which keeps float precision and survives floating-origin rebases; the terrain ground's own noise shares the period.
Functions
enableSnowCover()
ts
function enableSnowCover<T>(
material,
amount?,
facing?
): T;Let lying snow settle on a lit material: above the weather's snow line its up-facing surfaces whiten, on either backend, with no further calls. For roofs, ledges, crowns, props and parked cars; not for the ground (its materials draw their own snow), water, or anything that moves through the weather, such as an aircraft or a person. amount (0–1, default 1) thins the dusting: foliage holds less than a roof. facing is the range of the surface normal's up component over which it goes from bare to dusted (default SNOW_COVER_FACING: flat roofs white, walls clean); a lower range lets snow cling to steep sides, as on a conifer. A clone() stays marked, as does a copy() target marked again afterwards. Call it before the material first draws.
Type Parameters
T
T extends Material<MaterialEventMap>
Parameters
material
T
amount?
number
facing?
readonly [number, number]
Returns
T
snowCoverAmount()
ts
function snowCoverAmount(material): number;How much of the weather's lying snow settles on a material: 0 unless enableSnowCover marked it (or the material it was cloned from).
Parameters
material
Material
Returns
number
snowCoverFacing()
ts
function snowCoverFacing(material): readonly [number, number];The up-component range over which a material's surfaces go from bare to dusted.
Parameters
material
Material
Returns
readonly [number, number]
snowLineNode()
ts
function snowLineNode(
tsl,
p,
height,
snow
): F;molenSnowLine as TSL nodes; tsl is the caller's lazily loaded three/tsl.
Parameters
tsl
__module
p
V2
height
F
snow
Node<"vec4">
Returns
F
writeSnowCoverValue()
ts
function writeSnowCoverValue(
target,
cover,
worldOriginY?
): void;Write a snow cover (or none) into a vec4 uniform value: the line in rendered Y, which is world Y less the floating origin's, the transition band, and an amount of 1.
Parameters
target
Vector4
cover
| { depth?: number; depthGain?: number; level: number; maxDepth?: number; transition?: number; } | undefined
worldOriginY?
number
Returns
void