@adatechnology/game-urban-three 0.3.16 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -22,10 +22,37 @@ scene.add(drawn.root)
22
22
  - Each part becomes a mesh in the order it was added: boxes with the team's rounded edge (a 4x4x4 grid per face, edge vertices on an arc), tapered cylinders, flat-shaded cones and prisms, planes that only receive shadows, crowns that only cast, canvas signs and labels.
23
23
  - The small boxes (road dashes, sandbags) are one instanced mesh, and the windows two (lit ones glow, dark ones are a dark pane). The instance matrices are the page's.
24
24
  - Lights are real `PointLight` and `SpotLight` objects; `drawn.lights` lists them. `animate(t)` flickers the failing lamps (`I * (sin(23t + x) > 0.3 || sin(3.1t) > 0.85 ? 0.15 : 1)`) and moves each searchlight target around its tower.
25
+ - `physicalLights: true` (with `lights`, off by default): each lamp's source gets `physicalIntensityOf(part)` and each searchlight's `physicalIntensityOf(part, beam)`. The team's numbers were tuned on r128 without physically correct lights (no inverse square), so under r155+ they light almost nothing; the factor makes the ground at the foot of the lamp (or where the beam lands) as bright as on the page. Without the option the sources keep the page's numbers; the path without `lights` never changes them.
26
+ - `flickerLenses: true` (off by default): a failing lamp of `game-urban` (its lens and its light carry a `flickerPhase`) blinks its head with its light. The phase is rounded to one of `LAMP_FLICKER.groups` (4) groups, each with one lens material per colour, and both follow `flickerLevel(t, groupPhase)`, so a lamp that got no real light still blinks; at most 4 more materials per colour. Without the option the lens stays lit and the light keeps the page formula above, on both paths. `t` is the time the host passes to `animate` (presentation only).
25
27
  - A `terrain` part becomes the square mesh with vertex colours (flat shaded, roughness 1, casts and receives shadows); the water is a plane part drawn after it.
26
28
  - A `placement` part (a vehicle of the fleet, a species of the pack) becomes a group at the spot, turned and scaled, holding the object a resolver made: `createUrbanThree(THREE, { resolvers: { vehicle: createVehicleResolver(vehiclesThree), plant: createPlantResolver(THREE) } })`. The vehicle resolver uses the `lite` build of `game-vehicles-three` (six fused meshes) and the plant resolver `generate` and `createPlantObject` of `game-vegetation`; each is built once for an id and paint (or seed) and cloned for every spot, sharing geometry and materials. An id the package does not know leaves the spot empty. `resolver.dispose()` frees them.
27
29
  - `draw(scene, { root })` draws into a group of yours. Works on three r160 and later.
28
30
 
31
+ ## Utility networks
32
+
33
+ `drawNetworks(networks, options)` draws the aerial networks of `@adatechnology/game-urban/networks` (`generateNetworks`):
34
+
35
+ ```ts
36
+ const drawn = createUrbanThree(THREE, { lights, physicalLights: true, flickerLenses: true })
37
+ .drawNetworks(generated.networks, { isNight, lamps: { lit: 0.8, flicker: 0.15 }, surfaceAt: generated.surfaceAt, poles: urban.poles })
38
+ scene.add(drawn.root)
39
+ // each frame: drawn.animate(t); when the camera moved: drawn.setFocus(x, z)
40
+ ```
41
+
42
+ - Each `concrete_distribution` pole (or any registry pole with `slots`) stands at its node, turned with its arm toward its lamp: the mast
43
+ instanced per spec, the hardware of `distributionHardwareOf` (crossarm and pin insulators where it carries medium voltage, the low-voltage
44
+ clamp, one telecom clamp per cable, the arm and luminaire, the transformer's bracket and bushings) one instanced mesh of boxes, the
45
+ transformer tanks and reserve coils one instanced mesh of cylinders, the lenses one more.
46
+ - The conductors hang from the pole's slots with the sag the generator laid them with (`y − 4·sag·t·(1 − t)`, 8 stretches): three bare
47
+ medium-voltage phases, one multiplexed low-voltage cable, the telecom bundle (a cable per clamp), the drops (power from the low-voltage clamp,
48
+ telecom from the top cable) to each lot's anchor, and a guy against each pull of a corner or end pole, anchored on the sidewalk (`surfaceAt`).
49
+ Each class is one merged tube mesh; `spans` maps every edge to its index range there and in the far lines (R8).
50
+ - Level of detail: `setFocus(x, z)` keeps the spans within `nearDistance` (90 m) as tubes and draws the others as one `LineSegments`, by
51
+ rewriting each index buffer once when a span changes side. About ten draw calls near for a whole district, one far.
52
+ - The lamps are the network's `light` nodes with `networkLampsOf` (the `lampStateOf` of #470 by the seed and the node's place); a lit one is a
53
+ source of the host's light budget, a failing one blinks its lens and its light on its flicker group.
54
+ - `dispose()` removes the sources and frees every geometry and material it made.
55
+
29
56
  The scene hash, the lists of instances and the surface of each material (shadows, roughness, metalness, flat shading) of 34 cases are tested against the page.
30
57
 
31
58
  ## Geometry