| 1269 | } |
| 1270 | |
| 1271 | void VisualizerImpl::render() { |
| 1272 | |
| 1273 | auto now = std::chrono::high_resolution_clock::now(); |
| 1274 | float delta_time = std::chrono::duration<float>(now - last_frame_time_).count(); |
| 1275 | last_frame_time_ = now; |
| 1276 | |
| 1277 | // Clamp delta time to prevent huge jumps (min 30 FPS) |
| 1278 | delta_time = std::min(delta_time, 1.0f / 30.0f); |
| 1279 | |
| 1280 | const bool viewport_export_locked = gui_manager_ && gui_manager_->isViewportExportLocked(); |
| 1281 | if (window_manager_) { |
| 1282 | window_manager_->updateWindowSize("render_begin"); |
| 1283 | } |
| 1284 | if (viewport_export_locked && window_manager_) { |
| 1285 | window_manager_->pollEvents(); |
| 1286 | } |
| 1287 | |
| 1288 | // Tick Python frame callback for animations |
| 1289 | if (python::has_frame_callback()) { |
| 1290 | python::tick_frame_callback(delta_time); |
| 1291 | if (rendering_manager_) { |
| 1292 | rendering_manager_->markDirty(DirtyFlag::ALL); |
| 1293 | } |
| 1294 | } |
| 1295 | |
| 1296 | // Update input controller with viewport bounds |
| 1297 | if (gui_manager_) { |
| 1298 | auto pos = gui_manager_->getViewportPos(); |
| 1299 | auto size = gui_manager_->getViewportSize(); |
| 1300 | input_controller_->updateViewportBounds(pos.x, pos.y, size.x, size.y); |
| 1301 | if (tool_context_) { |
| 1302 | tool_context_->updateViewportBounds(pos.x, pos.y, size.x, size.y); |
| 1303 | } |
| 1304 | } |
| 1305 | |
| 1306 | // Update point cloud mode in input controller |
| 1307 | auto* rendering_manager = getRenderingManager(); |
| 1308 | if (rendering_manager) { |
| 1309 | const auto& settings = rendering_manager->getSettings(); |
| 1310 | input_controller_->setPointCloudMode(settings.point_cloud_mode); |
| 1311 | } |
| 1312 | |
| 1313 | if (input_controller_) { |
| 1314 | if (!viewport_export_locked) { |
| 1315 | input_controller_->update(delta_time); |
| 1316 | } |
| 1317 | } |
| 1318 | |
| 1319 | if (gui_manager_) { |
| 1320 | gui_manager_->updateInteractiveTransitions(); |
| 1321 | } |
| 1322 | const bool interactive_transition_settling = |
| 1323 | gui_manager_ && gui_manager_->isInteractiveTransitionSettling(); |
| 1324 | |
| 1325 | // Get viewport region from GUI. This accounts for menu/tool/status panels and must be |
| 1326 | // shared by every graphics backend so camera aspect and render resolution match the viewport. |
| 1327 | ViewportRegion viewport_region; |
| 1328 | bool has_viewport_region = false; |
nothing calls this directly
no test coverage detected