@adatechnology/game-weather-three

中文文档
0.5.11发布于 2026/11/08MITTypeScriptES Module构建来源已验证近 30 天下载 2159

three.js renderer for @adatechnology/game-weather: the game's rain curtain (14 000 GPU points), the near rain and mist and ash on the game-vfx pools, linear and exponential fog with zone fog, the sky that dims in rain, lightning, headlights in rain and a

原始使用文档

@adatechnology/game-weather-three

The three.js picture of @adatechnology/game-weather: the rain, fog, sky, lightning, headlights and heat of the weather that a createWeather world samples. It reads weather.sample() once a frame and draws it; it never advances the weather.

PartWhat it drawsWhere it comes from
Rain curtain (createRainCurtain)14 000 GPU points in a 70 m x 25 m box that follows the camera, falling 13 m/s; shader texts character for character; sized by the weather's drops (the whole curtain at 4 000, the storm) and by the profile (low 0.35, medium 0.7, high 1)game jogo.js, const RAIN = 14000
Near rain (createNearRain)the Workshop's streaks (engine.rain, up to 4 000, slanted by the wind), the splashes on the normal sprite pool and the rings (only where puddleAt says there is a puddle, within 12 / (1 + quality) m); game-vfx-three draws themWorkshop W313-331
Mist and ash (emitAirborne)mistPerSecond puffs of low mist and ashPerSecond flakes of falling ash a second around the camera, into the same poolWorkshop neblina, W1085-1086
Fog (createFog, fogOf)linear fog (near 25 m, far from the weather: 220 clear, 140 rain) or exponential-squared fog where the weather has a density (fog 0.075), and the zone fog (colour, far, weight; near 4 m at full weight)game skyUpdate and ZONA_NEBLINA
Sky (createSky)night colour 0x0b0f18 to day 0x8796a6 by sample.sun, times sample.skyScale (the page's 0.8 in rain), pulled to the zone colour; it also gives the fog its colourgame skyUpdate
Lightning (createLightning)the double flash of sample.flash: hemisphere light + 3.2 I, background + I * (.25, .27, .32), screen white I * .12Workshop chuva, W1068-1072
Headlights (createHeadlights)two spot lights and two additive beam cones on any Object3D, lit at night, in rain or in fog, real light only within 40 m of the camera, and rain that glows inside the beam (up to 600 lit drops a second)Workshop farol, W101-103 and W1161-1170
Heat haze (createHeatHaze)warm bands that rise over the lower half of the view, by sample.hazeSDK-made: no team delivered it

createWeatherRenderer(THREE, { scene, camera, weather, vfx, profile, zone, puddles, puddleAt, headlights, layers }) puts them together: update(dt) each frame, setLayer(id, on) for far_rain, near_rain, mist, fog, sky, lightning, headlights and haze, setZoneFog, setProfile, headlights.attach(car, lensMaterial). Without vfx only the curtain, fog, sky, lightning light, headlights and haze are drawn.

import * as THREE from 'three'
import { createWeather } from '@adatechnology/game-weather'
import { createWeatherRenderer } from '@adatechnology/game-weather-three'

const weather = createWeather({ seed: 1, start: 'storm' })
const picture = createWeatherRenderer(THREE, { scene, camera, weather, vfx })
// every frame
weather.advance(dt)
picture.update(dt)

Bench

createWeatherTestModule({ visual: createWeatherVisual({ vfx: room.vfx }) }) (the module of game-weather) adds the picture to the weather bench: seven layers (rain curtain, near rain and splashes, mist and ash, sky, lightning, headlights, heat haze; names in pt-BR and en), and a lamp rig in front of the camera to show the headlights. The rig's car is not drawn here: pass vehicles: (THREE) => createVehiclesThree(THREE, { kit }) (game-vehicles-three, with the fleet installed) and it builds a fleet car (rigVehicle, default midsize_sedan) under the lamps, so it follows the vehicles SDK; without it the rig has only the lamps and their beams. layers: { sky: false } keeps a room's own sky; the bench's own fog layer reaches the renderer too. The fog layer gives back the fog the host had when it is switched off.

Proof

  • tools/golden/bin/record-weather-visual.mjs cuts the rain block of jogo.js (const RAIN = 14000 to skyUpdate) and runs it in a vm with three.js stubs under a seeded Math.random; the fixture tools/golden/fixtures/weather/game-rain-curtain.json keeps the SHA-256 of the 42 000 floats, the shader texts and the sky, zone and fog lines of the page. tests/rain-curtain-golden.test.ts compares the points bit for bit, the shaders character for character and the numbers of sky, fog, lightning, headlights, mist and ash against the page text.
  • The Workshop's chuva (three intensities), neblina and farol run in game-vfx as effects (rain_and_puddles, fog_and_ash, headlights_in_rain), with their own golden of the events and the pools (vfx-workshop-weather.json).

No game content here: no names of a city or a faction. Peer dependency: three ^0.160.

版本与发布记录

@adatechnology/game-weather-three 共发布 24 个版本,首次发布于 2026/10/25;过去 12 个月发布了 24 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.5.11latest2026/11/08今天
0.5.102026/11/07今天
0.5.92026/11/07今天
0.5.82026/11/071 天前
0.5.72026/11/071 天前
0.5.62026/11/071 天前

关于 @adatechnology/game-weather-three 的常见问题

@adatechnology/game-weather-three 是什么?

three.js renderer for @adatechnology/game-weather: the game's rain curtain (14 000 GPU points), the near rain and mist and ash on the game-vfx pools, linear and exponential fog with zone fog, the sky that dims in rain, lightning, headlights in rain and a

如何安装 @adatechnology/game-weather-three?

在项目目录运行 npm install @adatechnology/game-weather-three,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:three(^0.160.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@adatechnology/game-weather-three 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@adatechnology/game-weather-three 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@adatechnology/game-weather-three 可以商用吗?

@adatechnology/game-weather-three 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@adatechnology/game-weather-three 的下载量有多少?

根据 npm 官方下载统计,@adatechnology/game-weather-three 在 2026/10/05 – 2026/11/03 这 30 天内被下载 2,159 次,日均约 72 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@adatechnology/game-weather-three 还在维护吗?

最新版本 0.5.11 发布于 2026/11/08(今天);至今共发布 24 个版本,其中过去 12 个月发布了 24 个;首次发布于 2026/10/25。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。