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:
@@ -841,9 +841,11 @@ export namespace ra3::terrain {
|
||||
const auto inv_a = w0 * p0.inv_a + w1 * p1.inv_a + w2 * p2.inv_a;
|
||||
const auto depth = 1.0F / inv_a;
|
||||
const auto pixel = static_cast<usize>(y) * static_cast<usize>(rw) + static_cast<usize>(x);
|
||||
// Ground decals sit exactly on the terrain; a small bias
|
||||
// (mirrors the GPU depth bias) keeps them from z-fighting.
|
||||
if (depth - 0.5F >= zbuf[pixel]) continue;
|
||||
// Ground decals carry a per-vertex bias toward the camera
|
||||
// (the retail shader's screen-space depth offset); it
|
||||
// keeps roads/sidewalks from z-fighting the terrain.
|
||||
const auto bias = w0 * v0.bias + w1 * v1.bias + w2 * v2.bias;
|
||||
if (depth - bias - 1.0F >= zbuf[pixel]) continue;
|
||||
|
||||
const auto tu = (w0 * v0.u * p0.inv_a + w1 * v1.u * p1.inv_a + w2 * v2.u * p2.inv_a) * depth;
|
||||
const auto tv = (w0 * v0.v * p0.inv_a + w1 * v1.v * p1.inv_a + w2 * v2.v * p2.inv_a) * depth;
|
||||
|
||||
Reference in New Issue
Block a user