Loading...
Searching...
No Matches
SceneSummary.hpp
1#pragma once
2#include <ossia/dataflow/geometry_port.hpp>
3
4#include <Threedim/GeometryViewer/SceneMonitor.hpp>
5
6#include <QMatrix4x4>
7
8#include <vector>
9
10namespace Gfx::GeometryViewer
11{
14{
15 enum Kind : uint8_t
16 {
17 Light,
18 Camera
19 } kind{};
20 ossia::light_type light{};
22 float color[3]{1.f, 1.f, 1.f};
24 float yfov{}, aspect{1.f};
25 QMatrix4x4 world;
27 int32_t row{-1};
28};
29
33{
35 const ossia::mesh_primitive* primitive{};
36 const ossia::geometry_spec* legacy{};
37 std::size_t legacy_index{};
38 QMatrix4x4 world;
39 ossia::material_component_ptr material;
40};
41
44{
46 static constexpr std::size_t max_draws = 4096;
47
48 SceneSummary summary;
49 std::vector<SceneDrawItem> draws;
53 ossia::aabb bounds{{1.f, 1.f, 1.f}, {-1.f, -1.f, -1.f}};
54 std::vector<SceneGizmo> gizmos;
55
56 void clear()
57 {
58 summary.counts = {};
59 summary.rows.clear();
60 draws.clear();
62 bounds = {{1.f, 1.f, 1.f}, {-1.f, -1.f, -1.f}};
63 gizmos.clear();
64 }
65};
66
69void describeScene(const ossia::scene_spec& scene, SceneDescription& out);
70
72ossia::aabb transformBounds(const ossia::aabb& box, const QMatrix4x4& m) noexcept;
73
74void unite(ossia::aabb& into, const ossia::aabb& box) noexcept;
75
77bool instanceMatrix(
78 const ossia::instance_component& inst, uint32_t i, QMatrix4x4& out) noexcept;
79
81uint32_t instancesInMemory(const ossia::instance_component& inst) noexcept;
82
84std::string materialName(
85 const ossia::material_component& m, const ossia::scene_state* state);
86}
What the viewer shows of a scene.
Definition SceneSummary.hpp:44
uint64_t skipped_instances
Instances left out past max_draws, or whose transforms are not in memory.
Definition SceneSummary.hpp:51
ossia::aabb bounds
The union of the bounds of what is drawn, in the space of the scene.
Definition SceneSummary.hpp:53
static constexpr std::size_t max_draws
The most draws a scene gets, instances included.
Definition SceneSummary.hpp:46
Definition SceneSummary.hpp:33
const ossia::mesh_primitive * primitive
Either a primitive, or a geometry of a mesh's legacy geometry.
Definition SceneSummary.hpp:35
A light or a camera of the scene, where the viewer draws its gizmo.
Definition SceneSummary.hpp:14
float yfov
Vertical field of view in radians, width over height; 0 for orthographic.
Definition SceneSummary.hpp:24
float color[3]
Straight RGB.
Definition SceneSummary.hpp:22
int32_t row
Its row in the summary.
Definition SceneSummary.hpp:27
Definition SceneMonitor.hpp:60