fix(render): honor native shadow caster defaults
Docs Deploy / Build and Deploy MkDocs (push) Successful in 31s
Docs Deploy / Build and Deploy MkDocs (push) Successful in 31s
This commit is contained in:
2 files changed
+33
-10
No files matched your search
@@ -3841,6 +3841,11 @@ const PROTOTYPE_TYPE_FORT: u32 = u32::from_le_bytes(*b"FORT");
|
|||||||
const PROTOTYPE_TYPE_BTLU: u32 = u32::from_le_bytes(*b"BTLU");
|
const PROTOTYPE_TYPE_BTLU: u32 = u32::from_le_bytes(*b"BTLU");
|
||||||
const PROTOTYPE_TYPE_STAT: u32 = u32::from_le_bytes(*b"STAT");
|
const PROTOTYPE_TYPE_STAT: u32 = u32::from_le_bytes(*b"STAT");
|
||||||
|
|
||||||
|
// shortcut: the preview does not load shade.cfg yet, so use CShade's native
|
||||||
|
// defaults until the settings loader is implemented.
|
||||||
|
const NATIVE_DEFAULT_ROB_SHADOWS_ON: bool = true;
|
||||||
|
const NATIVE_DEFAULT_BLD_SHADOWS_ON: bool = false;
|
||||||
|
|
||||||
/// Maps the resolved registry type to the native object-kind selector used by
|
/// Maps the resolved registry type to the native object-kind selector used by
|
||||||
/// CSun/CShade. The mission object's raw kind is an unrelated TMA field; the
|
/// CSun/CShade. The mission object's raw kind is an unrelated TMA field; the
|
||||||
/// renderer receives the registry provenance from the prepared visual.
|
/// renderer receives the registry provenance from the prepared visual.
|
||||||
@@ -3853,6 +3858,14 @@ fn native_shadow_kind(source_type: Option<u32>) -> Option<u32> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn native_shadow_caster_enabled(native_kind: u32) -> bool {
|
||||||
|
if native_kind == 4 {
|
||||||
|
NATIVE_DEFAULT_ROB_SHADOWS_ON
|
||||||
|
} else {
|
||||||
|
NATIVE_DEFAULT_BLD_SHADOWS_ON
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn compose_unit_pose(parent: VulkanNodePose, child: VulkanNodePose) -> VulkanNodePose {
|
fn compose_unit_pose(parent: VulkanNodePose, child: VulkanNodePose) -> VulkanNodePose {
|
||||||
let rotated = rotate_unit_vector(child.translation, parent.rotation);
|
let rotated = rotate_unit_vector(child.translation, parent.rotation);
|
||||||
VulkanNodePose {
|
VulkanNodePose {
|
||||||
@@ -4288,7 +4301,9 @@ fn static_preview_mesh_and_materials(
|
|||||||
mesh_components += 1;
|
mesh_components += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(native_kind) = root_native_kind {
|
if let Some(native_kind) =
|
||||||
|
root_native_kind.filter(|kind| native_shadow_caster_enabled(*kind))
|
||||||
|
{
|
||||||
let caster_id = u32::try_from(shadow_casters.len())
|
let caster_id = u32::try_from(shadow_casters.len())
|
||||||
.map_err(|_| "shadow caster id exceeds u32".to_string())?;
|
.map_err(|_| "shadow caster id exceeds u32".to_string())?;
|
||||||
if let Some(caster) = aggregate_shadow_caster(
|
if let Some(caster) = aggregate_shadow_caster(
|
||||||
@@ -6439,10 +6454,13 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn native_sun_object_source_types_map_to_world_kinds() {
|
fn native_shadow_kind_mapping_keeps_sun_eligibility_separate_from_caster_defaults() {
|
||||||
assert_eq!(native_shadow_kind(Some(PROTOTYPE_TYPE_FORT)), Some(3));
|
assert_eq!(native_shadow_kind(Some(PROTOTYPE_TYPE_FORT)), Some(3));
|
||||||
assert_eq!(native_shadow_kind(Some(PROTOTYPE_TYPE_BTLU)), Some(4));
|
assert_eq!(native_shadow_kind(Some(PROTOTYPE_TYPE_BTLU)), Some(4));
|
||||||
assert_eq!(native_shadow_kind(Some(PROTOTYPE_TYPE_STAT)), Some(10));
|
assert_eq!(native_shadow_kind(Some(PROTOTYPE_TYPE_STAT)), Some(10));
|
||||||
|
assert!(!native_shadow_caster_enabled(3));
|
||||||
|
assert!(native_shadow_caster_enabled(4));
|
||||||
|
assert!(!native_shadow_caster_enabled(10));
|
||||||
assert!(native_sun_object_kind_eligible(Some(PROTOTYPE_TYPE_FORT)));
|
assert!(native_sun_object_kind_eligible(Some(PROTOTYPE_TYPE_FORT)));
|
||||||
assert!(native_sun_object_kind_eligible(Some(PROTOTYPE_TYPE_BTLU)));
|
assert!(native_sun_object_kind_eligible(Some(PROTOTYPE_TYPE_BTLU)));
|
||||||
assert!(native_sun_object_kind_eligible(Some(PROTOTYPE_TYPE_STAT)));
|
assert!(native_sun_object_kind_eligible(Some(PROTOTYPE_TYPE_STAT)));
|
||||||
|
|||||||
+13
-8
@@ -625,15 +625,20 @@ Lightmap не является обычной diffuse texture. WEAR содерж
|
|||||||
отдельным slot или texture stage. Замена lightmap предварительным умножением в
|
отдельным slot или texture stage. Замена lightmap предварительным умножением в
|
||||||
diffuse texture ломает LOD, atlas coordinates и динамическую модуляцию.
|
diffuse texture ломает LOD, atlas coordinates и динамическую модуляцию.
|
||||||
|
|
||||||
Vulkan preview строит projected shadows для выбранных зданий и роботов,
|
Vulkan preview строит проецируемые тени для объектов, отбрасывающих тени,
|
||||||
отбрасывает spheres вне шести clip-плоскостей с радиусом `sphere + 100` и
|
отбрасывает сферы вне шести clip-плоскостей с радиусом `sphere + 100` и
|
||||||
сохраняет порядок видимых кандидатов; frame builder обрабатывает не более 20
|
сохраняет порядок видимых кандидатов; frame builder обрабатывает не более 20
|
||||||
casters. Текущая реализация выделяет страницы в atlas `256 x 256` с 28 page
|
объектов. Текущая реализация выделяет страницы в atlas `256 x 256` с 28 page
|
||||||
slots и использует одну smoothing pass. Вызов preview передаёт `fade = 1.0` и
|
slots и использует одно сглаживание. Preview применяет native defaults
|
||||||
LOD defaults: minimum LOD `1` и detail multiplier `1.0` отдельно для зданий и
|
`RobShadowsOn = true` и `BldShadowsOn = false`: объект kind `4` проверяет
|
||||||
роботов. Rust-путь не загружает `shade.cfg`: эти значения задаются кодом, а
|
первый флаг, остальные kinds — второй. Поэтому роботы BTLU остаются объектами,
|
||||||
параметры файла пока не влияют на preview. Проекция учитывает вклад
|
отбрасывающими тени, а объекты FORT и STAT их не создают. Preview пока не
|
||||||
directional и point lights.
|
загружает `shade.cfg`, поэтому значения из пользовательского файла не меняют
|
||||||
|
список объектов, отбрасывающих тени. Проверка действует только на проецируемые
|
||||||
|
тени: отдельный список объектов для затенения солнца по-прежнему включает
|
||||||
|
FORT, BTLU и STAT. Вызов preview передаёт `fade = 1.0` и LOD defaults:
|
||||||
|
minimum LOD `1` и detail multiplier `1.0` отдельно для зданий и роботов.
|
||||||
|
Проекция учитывает вклад directional и point lights.
|
||||||
|
|
||||||
Receiver projection обрезает projected quad по рёбрам треугольника. Native ray
|
Receiver projection обрезает projected quad по рёбрам треугольника. Native ray
|
||||||
query descriptor в `+0x10` требует наличия всех переданных bits, а descriptor
|
query descriptor в `+0x10` требует наличия всех переданных bits, а descriptor
|
||||||
|
|||||||
Reference in new issue
Block a user