Working on state for location
This commit is contained in:
1 parent
e0968b5522
commit
b01e970554
13 files changed
+494
-101
No files matched your search
@@ -230,4 +230,31 @@ namespace ZL {
|
||||
renderer.RenderUniform1f("uAlpha", 1.0f);
|
||||
}
|
||||
|
||||
void InteractiveObjectState::save(nlohmann::json& out) const
|
||||
{
|
||||
out["positionX"] = position.x();
|
||||
out["positionY"] = position.y();
|
||||
out["positionZ"] = position.z();
|
||||
out["rotationY"] = rotationY;
|
||||
out["scale"] = scale;
|
||||
out["alpha"] = alpha;
|
||||
out["isActive"] = isActive;
|
||||
// isAnimating and animTask are not saved: animations snap to their end
|
||||
// state on load (the final position/scale/alpha is already in the fields above).
|
||||
}
|
||||
|
||||
void InteractiveObjectState::load(const nlohmann::json& in)
|
||||
{
|
||||
position.x() = in.value("positionX", position.x());
|
||||
position.y() = in.value("positionY", position.y());
|
||||
position.z() = in.value("positionZ", position.z());
|
||||
rotationY = in.value("rotationY", rotationY);
|
||||
scale = in.value("scale", scale);
|
||||
alpha = in.value("alpha", alpha);
|
||||
isActive = in.value("isActive", isActive);
|
||||
// Cancel any in-flight animation; state was restored to final values above.
|
||||
isAnimating = false;
|
||||
animTask.reset();
|
||||
}
|
||||
|
||||
} // namespace ZL
|
||||
Reference in new issue
Block a user