mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 18:16:40 +00:00
ebb9c91bdf
The frame loop — surface acquisition, parallel cull dispatch, streaming drive, two-pass main render, HiZ resolve, edge pass, screenshot capture, FrameStats emission, interactive / bench heartbeat, bench summary + auto-quit — all live in ViewportCore now. ViewportWindow::render() shrinks to the Qt-only prelude: isExposed() guard, fpsIntegrate() (fly-mode WASD step), then core_.render(). The overlay renderer stays Qt-bound (OverlayRenderer.h carries QString labels). Core reaches it via two new ViewportHost virtuals: encodeOverlaysInMainPass (section gizmos, highlights, pivot, lines, points — in-MSAA-pass) and encodeOverlaysPostMain (corner axis, marquee, labels — on the resolved surface). The QtViewportHost implementation in ViewportWindow forwards each to overlays_.X(). FrameStats moves to its own Qt-free header (FrameStats.h) with ViewportWindow::FrameStats re-exported as a using-alias so the bonsai-side signal binding keeps working. ViewportHost::onFrameStats replaces the placeholder 4-double signature with the typed POD. OverlayFrame moves alongside (OverlayFrame.h) so the host overlay callbacks can carry it without dragging Qt into core. Bench + frame-stats + cull-tuning state (min_pixel_radius_, motion_min_pixel_radius_, lod1_pixel_threshold_, cull_threads_enabled_, prev_camera_*, has_prev_camera_, last_cull_was_motion_, last_visible_*, last_cull_*ms_, last_stream_ms_, bench_*, interactive_frame_count_, frame_time_ms_window_/_sum_/_count_/_head_) move to ViewportCore; VW keeps reference aliases so the env-var prelude, setBenchmarkFrames, and the various tool keybind setters keep compiling unchanged. Smoke checks: --screenshot path renders + saves a clean PNG; --benchmark 10 runs the warm gate, prints the per-frame log + summary, and exits cleanly via host_->quit().
44 lines
2.3 KiB
C++
44 lines
2.3 KiB
C++
/********************************************************************************
|
|
* *
|
|
* This file is part of IfcOpenShell. *
|
|
* *
|
|
* IfcOpenShell is free software: you can redistribute it and/or modify *
|
|
* it under the terms of the Lesser GNU General Public License as published by *
|
|
* the Free Software Foundation, either version 3.0 of the License, or *
|
|
* (at your option) any later version. *
|
|
* *
|
|
* IfcOpenShell is distributed in the hope that it will be useful, *
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
* Lesser GNU General Public License for more details. *
|
|
* *
|
|
* You should have received a copy of the Lesser GNU General Public License *
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
* *
|
|
********************************************************************************/
|
|
|
|
#ifndef IFCVIEWER_FRAMESTATS_H
|
|
#define IFCVIEWER_FRAMESTATS_H
|
|
|
|
#include <cstdint>
|
|
|
|
// Per-frame statistics emitted from render() so the embedder can
|
|
// surface them (bonsai's status bar, the web-side dev console, the
|
|
// benchmark accumulator). Pure POD so it travels through ViewportHost
|
|
// without dragging Qt along. ViewportWindow::FrameStats re-exports
|
|
// this so existing bonsai callers still see the familiar
|
|
// ViewportWindow::FrameStats type.
|
|
struct FrameStats {
|
|
float fps;
|
|
float frame_time_ms;
|
|
std::uint32_t total_objects;
|
|
std::uint32_t visible_objects;
|
|
std::uint32_t total_triangles;
|
|
std::uint32_t visible_triangles;
|
|
std::uint32_t unique_meshes;
|
|
std::uint32_t gl_draw_calls; // wgpu draw-call count; name kept for bonsai parity
|
|
std::uint32_t indirect_sub_draws; // sub-draws packed into the chunk-indirect lists
|
|
};
|
|
|
|
#endif // IFCVIEWER_FRAMESTATS_H
|