diff options
| -rw-r--r-- | adapters/fparkan-render-vulkan/src/ffi/smoke.rs | 10 | ||||
| -rw-r--r-- | apps/fparkan-game/src/main.rs | 17 | ||||
| -rw-r--r-- | docs/reference/environment-effects.md | 3 |
3 files changed, 24 insertions, 6 deletions
diff --git a/adapters/fparkan-render-vulkan/src/ffi/smoke.rs b/adapters/fparkan-render-vulkan/src/ffi/smoke.rs index acea7e19..06d1d4de 100644 --- a/adapters/fparkan-render-vulkan/src/ffi/smoke.rs +++ b/adapters/fparkan-render-vulkan/src/ffi/smoke.rs @@ -3321,6 +3321,16 @@ mod tests { &[], ); assert_eq!(order, vec![0, 4, 2, 3, 1]); + + let order = sorted_world_draw_order( + 5, + &ranges, + &[Some(true), Some(false), None, None, None], + &[Some(2.0), None, None, None, None], + &[2, 3], + ); + // Depth-writing world, sky, disk, transparent world, flare. + assert_eq!(order, vec![1, 2, 3, 0, 4]); } #[test] diff --git a/apps/fparkan-game/src/main.rs b/apps/fparkan-game/src/main.rs index 4760a1b0..e176fd13 100644 --- a/apps/fparkan-game/src/main.rs +++ b/apps/fparkan-game/src/main.rs @@ -3132,6 +3132,12 @@ impl EnvironmentGpuScene { ) }) .map(|layer| layer.range.range_index) + .chain(self.sprites.iter().filter_map(|sprite| { + sprite + .flare_index + .is_none() + .then_some(sprite.range.range_index) + })) .collect() } @@ -3516,8 +3522,8 @@ impl EnvironmentGpuScene { ); // Preserve the native sky order while keeping the indexed mesh - // contiguous. The screen gradient must be the first draw, and the - // cloud dome follows all directional sprites. Reordering the range + // contiguous. The screen gradient comes first. Disks are drawn before + // the transparent world queue and flares follow it. Reordering the range // metadata alone would leave first_index values pointing into the old // segment order, so move each index segment together with its range. let range_for_kind = |kind: SkyPassKind| { @@ -3660,10 +3666,9 @@ impl EnvironmentGpuScene { projected_sun, viewport, view_forward: camera.forward(), - // Flares use the same terrain/object ray query as the native - // visibility gate. The sun sprite itself deliberately stays - // independent of this test, matching the native layer's - // `requires_occlusion` split. + // The glare samples world occlusion at the sun's center. The + // disk is behind the transparent world queue so foliage can + // cover it per fragment and leave its cutouts visible. unoccluded: native_sun_unoccluded_with_world( terrain, mesh, diff --git a/docs/reference/environment-effects.md b/docs/reference/environment-effects.md index 78e6de99..e9e28101 100644 --- a/docs/reference/environment-effects.md +++ b/docs/reference/environment-effects.md @@ -338,6 +338,9 @@ world_depth = 0.1 + (0.99 - 0.1) * (clip_z / clip_w) В Vulkan диапазон задаётся динамическим viewport отдельно для мировых пакетов; экранные TL и фоновые sky-пакеты сохраняют диапазон `0–1`. +Мировая прозрачная очередь рисуется поверх дисков. Так непрозрачные пиксели +текстуры кроны закрывают диск, а просветы пропускают свет. Для бликов действует +отдельная проверка лучом к центру солнца по рельефу и объектам. Матрица проекции и плоскости отсечения при этом не меняются. Константы мирового профиля записывает GOG `Terrain.dll` RVA `0x27422–0x27452` из таблицы `0x65088/0x6508C/0x650A0/0x650A4` (near, far, MinZ, MaxZ). GOG `Ngi32.dll` |
