v0.8.0: map roads/sidewalks, per-vertex depth bias, retail camera controls

- ra3.map: capture the object RoadType; ra3.models pairs the map's
  Start/End road objects and drapes a flat textured ribbon along each
  segment (tessellated to the relief).
- Ground decals (roads/sidewalks) get a per-vertex screen-space depth
  offset (scene::vertex.bias) applied in the object shader and the
  software rasteriser, so they no longer z-fight or clip into the
  terrain at top-down angles.
- Tactical view aligned with retail (SAGE LookAtTranslator): middle-drag
  orbits yaw/pitch, a middle click resets angle/pitch/zoom, arrow keys
  pan, wheel zooms within the retail zoom range; WASD pan removed and
  left-drag no longer rotates.
- ui_event gains middle/right/released buttons; Vulkan + SDL map them.
- docs: roads, depth bias and camera controls.
This commit is contained in:
EnderTheCoder
2026-09-29 20:37:24 +08:00
parent 70f35d8382
commit 8047e80ed6
14 changed files with 229 additions and 33 deletions
+23 -2
View File
@@ -328,8 +328,29 @@ The map's `ObjectsList` chunk is a list of nested `Object` assets —
`Coord3D`, Z `angle`, `RoadType` u32, a `u16`-prefixed type-name and a property
list whose keys index the shared name table (`ra3.map::parse_objects`). Each
type resolves to the `W3DMesh` parts whose instance name equals it or starts
with `<type>.`. Objects whose type is a `Road` template (the sidewalk/road
segments) are not meshes and are not drawn yet.
with `<type>.`.
### Roads / sidewalks (`Road` assets)
The flat sidewalk and road decals are not meshes: the map places them as
**consecutive pairs** of objects — a `RoadType::Start` (`2`) and a
`RoadType::End` (`4`) at the segment's two ends (`Angled` `8`, `TightCurve`
`64` and `EndCap` `128` are curve/cap flags; `BridgeStart/End` `16/32` are
bridges). The road's type-name (`IslandFortressSidewalk01`, ...) resolves to a
compiled `Road` asset in the same art stream:
```
Road: u32 version, u32 pad, u32 textureCount, f32 roadWidth, f32 pad,
f32 ???, then textureCount texture references (diffuse, normal)
```
`ra3.models` pairs the objects in file order, emits a flat quad ribbon of
`roadWidth` along each segment (overlapping the joins by half a width), sampled
with the diffuse texture, and lifts it onto the terrain. Retail gives roads a
small depth offset toward the screen so they do not clip into the ground; the
object pass reproduces that with the same negative depth bias used for the other
ground decals (`depthBiasConstant/SlopeFactor` on Vulkan, a half-unit bias in the
software rasteriser).
### Map display names