Files
open-wc/src/render/wmo/wmo_render_build_step_planner.gd
T

41 lines
1.2 KiB
GDScript

class_name WmoRenderBuildStepPlanner
extends RefCounted
## Selects one value-only WMO render-group build operation without engine objects.
const OPERATION_MESH: StringName = &"mesh"
const OPERATION_MULTIMESH: StringName = &"multimesh"
const OPERATION_COMPLETE: StringName = &"complete"
## Selects the next mesh-first build operation and returns its selected index
## plus the cursor values to adopt after that one operation. Counts and cursors
## are intentionally not clamped so the loader's historical comparisons remain
## exact for every integer input.
func plan_step(
mesh_count: int,
mesh_index: int,
multimesh_count: int,
multimesh_index: int
) -> Dictionary:
if mesh_index < mesh_count:
return {
"operation": OPERATION_MESH,
"selected_index": mesh_index,
"next_mesh_index": mesh_index + 1,
"next_multimesh_index": multimesh_index,
}
if multimesh_index < multimesh_count:
return {
"operation": OPERATION_MULTIMESH,
"selected_index": multimesh_index,
"next_mesh_index": mesh_index,
"next_multimesh_index": multimesh_index + 1,
}
return {
"operation": OPERATION_COMPLETE,
"selected_index": -1,
"next_mesh_index": mesh_index,
"next_multimesh_index": multimesh_index,
}