// A wood that turns, standing in a wood that doesn't.
const broadleaf = new THREE.MeshLambertMaterial({ color: 0x6f9c3a });
attachSeasonalTint(broadleaf, { blossom: 0xf2a8c8, blossomShare: 0.6 });
attachSnow(broadleaf);
const pine = new THREE.MeshLambertMaterial({ color: 0x35592a });
attachSnow(pine); // snow, but no turn
configureSeason(broadleaf, climate);
configureSeason(pine, climate);
Give a stock three.js material a seasonal foliage tint: spring green through summer, gold through autumn, bare through winter, driven per cell by the climate texture's temperature channel — and a spring bloom, since this is the call that says the surface is a plant rather than a hillside.
This is the counterpart to attachSnow, and deliberately a separate call rather than part of it — because which of the two a plant gets is what distinguishes one from another. A pine takes snow and no tint and stays green all year; a broadleaf takes both and turns under the same snow. Handing a material one and not the other is the whole API.
summerdefaults to the material's owncolor, which is what makes the tint a no-op at midsummer instead of a wash that flattens the material — see FOLIAGE_GLSL for why the palette is applied as a ratio against it.The tint lands before SEASON_COLOR_SLOT and snow lands after, so the two compose in that order however they were attached.
Like
attachSnow, this needs the per-instancecellIndexattribute thatbuildScatterMeshesputs on every scatter mesh, and stays inert until configureSeason supplies a climate. Safe on a material that already has anonBeforeCompile, and idempotent.