Lysa Nodes  0.0
Lysa Nodes — Scene Graph for the Lysa Engine
Rotation

RotatingAssetScene::onProcess

The asset rotation is implemented in RotatingAssetScene::onProcess, which SceneTree calls once per rendered frame after propagating _process to all child nodes.

void RotatingAssetScene::onProcess(const double alpha) {
// Advance the rotation angle
rotationAngle += static_cast<float>(alpha) * ROTATION_SPEED;
if (rotationAngle > lysa::radians(360.0f)) {
rotationAngle -= lysa::radians(360.0f);
}
// Apply the rotation to the asset root node
assetRoot->setTransform(lysa::float4x4::rotation_y(rotationAngle));
// ... camera movement code ...
}

Frame-rate independence

rotationAngle is incremented by alpha * ROTATION_SPEED each call, so the angular velocity is constant regardless of frame rate. ROTATION_SPEED is 0.025f rad/s.

Once rotationAngle exceeds 2π the full circle is subtracted to prevent floating-point drift over long runtimes.

setTransform

assetRoot->setTransform(lysa::float4x4::rotation_y(rotationAngle));

Node::setTransform calls updateGlobalTransform which cascades to every descendant in the subtree. For each MeshInstance descendant, MeshInstance::updateGlobalTransform pushes the new world transform and AABB to the GPU-side lysa::MeshInstance immediately. There is no equivalent of the manual SceneTree::onProcess base-class call; SceneTree itself handles the GPU sync via updateInstance after onProcess returns.

onProcess call order

The SceneTree PROCESS handler executes in this order each frame:

  1. child->_process(alpha) for each top-level child (cascades recursively).
  2. onProcess(alpha) — the RotatingAssetScene override runs here.
  3. updateInstance — walks the tree and copies every MeshInstance's current transform and AABB into the GPU per-frame buffer.
  4. render() — called by the Application's PROCESS subscription, which was registered after the scene tree's subscription.

Always mutate nodes inside onProcess (step 2) or inside child nodes' onProcess callbacks (step 1) so that updateInstance (step 3) sees the final transforms for the current frame.

Math reference

Symbol Description
lysa::float4x4 Row-major 4×4 matrix
float4x4::identity() Identity matrix
float4x4::rotation_x/y/z(radians) Single-axis rotation matrix
float4x4::translation(x, y, z) Translation matrix
float4x4::scale(s) Uniform scale matrix
lysa::mul(A, B) Matrix multiplication (A applied first, then B)
lysa::radians(degrees) Degrees-to-radians conversion
lysa::perspective(fov, aspect, near, far) Reversed-Z perspective projection
lysa::quaternion Quaternion type
lysa::euler_angles(q) Extracts Euler angles from a quaternion

Next : Application class