neon-sprawl/client/scripts/occlusion_policy.gd

31 lines
1.3 KiB
GDScript

extends Resource
## OcclusionPolicy — config for the RayCast-based per-surface material fade used by
## [IsometricFollowCamera] (NEON-27). No `class_name` — see repo Godot headless / CI notes.
## Master switch. When false, no rays are cast and any active overrides are restored.
@export var enabled: bool = true
## Target alpha applied to occluder surfaces (0 = fully transparent, 1 = opaque).
@export_range(0.0, 1.0) var fade_alpha: float = 0.25
## Scene group that opts a [CollisionObject3D] into occlusion fading.
@export var occluder_group: String = "occluder"
## Physics collision mask for the ray. Default 1 (world geometry layer).
## The Player is on layer 2 and is already excluded with this default.
@export_flags_3d_physics var occluder_collision_mask: int = 1
## Max successive [method PhysicsDirectSpaceState3D.intersect_ray] calls per frame.
## Caps cost when occluders are stacked along the ray.
@export var max_occluder_cast_depth: int = 4
## When > 0, emits [method push_warning] when the active occluder count reaches this
## value. Set to 0 to disable. Marker for stress-test reference (TODO E9.M1 telemetry).
@export var occluder_count_log_threshold: int = 0
## Returns true when the policy should be applied this frame.
func is_valid() -> bool:
return enabled and fade_alpha >= 0.0