mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-21 22:59:19 +02:00
Reset transform stack before the visual load pass
Defensive fix: when starting the deferred visual pass, clear the origin/scale stacks and rotation before the directives are replayed. A scenery that leaves an unbalanced origin on the stack during the infrastructure pass would otherwise have it applied a second time, shifting every deferred visual node. Balanced sceneries (the common case) are unaffected -- the directives rebuild the same state. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -172,6 +172,14 @@ state_serializer::deserialize_continue(std::shared_ptr<deserializer_state> state
|
|||||||
if( ( false == state->visualphase )
|
if( ( false == state->visualphase )
|
||||||
&& ( true == Input.restartReplay( scene::scenery_load_pass::visual ) ) ) {
|
&& ( true == Input.restartReplay( scene::scenery_load_pass::visual ) ) ) {
|
||||||
state->visualphase = true;
|
state->visualphase = true;
|
||||||
|
// rebuild the transform state from scratch for the visual pass: the directives
|
||||||
|
// (origin/rotate/scale) are replayed in order, so resetting here reproduces the
|
||||||
|
// single-pass placement exactly. without this, an unbalanced origin left on the
|
||||||
|
// stack by the infrastructure pass would be applied a second time and shift every
|
||||||
|
// deferred visual node ("terrain dumped next to the tracks").
|
||||||
|
Scratchpad.location.offset = {};
|
||||||
|
Scratchpad.location.scale = {};
|
||||||
|
Scratchpad.location.rotation = glm::vec3{};
|
||||||
return false; // infrastructure ready -> go to driver; visuals continue there
|
return false; // infrastructure ready -> go to driver; visuals continue there
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user