opynsim
Unofficial C++ Documentation
Loading...
Searching...
No Matches
cached_model_renderer.h
Go to the documentation of this file.
1#pragma once
2
7
8#include <memory>
9#include <optional>
10#include <span>
11
12namespace opyn { struct ModelRendererParams; }
13namespace opyn { class ModelStatePair; }
14namespace osc { class Rect; }
15namespace osc { class RenderTexture; }
16namespace osc { class SceneCache; }
17namespace osc { struct Ray; }
18namespace osc { struct SceneDecoration; }
19
20namespace opyn
21{
22 class CachedModelRenderer final {
23 public:
24 explicit CachedModelRenderer(const std::shared_ptr<osc::SceneCache>&);
27 CachedModelRenderer& operator=(const CachedModelRenderer&) = delete;
30
32 const ModelStatePair&,
34 float aspectRatio
35 );
36
37 osc::RenderTexture& onDraw(
38 const ModelStatePair&,
40 osc::Vector2 dims,
41 float devicePixelRatio,
42 osc::AntiAliasingLevel antiAliasingLevel
43 );
44 osc::RenderTexture& updRenderTexture();
45
46 std::span<const osc::SceneDecoration> getDrawlist() const;
47
48 // Returns an `AABB` that tightly bounds all geometry in the scene, or `std::nullopt`
49 // if the scene contains no geometry.
50 //
51 // This includes hidden/invisible elements that exist for hittesting/rim-highlighting
52 // purposes.
53 std::optional<osc::AABB> bounds() const;
54
55 // Returns an `AABB` that tightly bounds all visible geometry in the scene, or `std::nullopt`
56 // if the scene contains no visible geometry.
57 //
58 // This is useful if (e.g.) you want to ensure a scene camera only tries to scope the visible
59 // parts of a scene (#1029).
60 std::optional<osc::AABB> visibleBounds() const;
61
62 std::optional<osc::SceneCollision> getClosestCollision(
64 osc::Vector2 mouseScreenPosition,
65 const osc::Rect& viewportScreenRect
66 ) const;
67
68 private:
69 class Impl;
70 std::unique_ptr<Impl> m_Impl;
71 };
72}
Definition cached_model_renderer.h:22
std::span< const osc::SceneDecoration > getDrawlist() const
CachedModelRenderer(const CachedModelRenderer &)=delete
std::optional< osc::AABB > visibleBounds() const
osc::RenderTexture & updRenderTexture()
CachedModelRenderer(CachedModelRenderer &&) noexcept
osc::RenderTexture & onDraw(const ModelStatePair &, const ModelRendererParams &, osc::Vector2 dims, float devicePixelRatio, osc::AntiAliasingLevel antiAliasingLevel)
std::optional< osc::AABB > bounds() const
void autoFocusCamera(const ModelStatePair &, ModelRendererParams &, float aspectRatio)
std::optional< osc::SceneCollision > getClosestCollision(const ModelRendererParams &, osc::Vector2 mouseScreenPosition, const osc::Rect &viewportScreenRect) const
CachedModelRenderer(const std::shared_ptr< osc::SceneCache > &)
Definition model_state_pair.h:19
Definition component_registry.h:14
Definition custom_decoration_generator.h:5
Definition model_renderer_params.h:16