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
31 osc::RenderTexture& onDraw(
32 const ModelStatePair&,
34 osc::Vector2 dims,
35 float devicePixelRatio,
36 osc::AntiAliasingLevel antiAliasingLevel
37 );
38 osc::RenderTexture& updRenderTexture();
39
40 std::span<const osc::SceneDecoration> getDrawlist() const;
41
42 // Returns an `AABB` that tightly bounds all geometry in the scene, or `std::nullopt`
43 // if the scene contains no geometry.
44 //
45 // This includes hidden/invisible elements that exist for hittesting/rim-highlighting
46 // purposes.
47 std::optional<osc::AABB> bounds() const;
48
49 // Returns an `AABB` that tightly bounds all visible geometry in the scene, or `std::nullopt`
50 // if the scene contains no visible geometry.
51 //
52 // This is useful if (e.g.) you want to ensure a scene camera only tries to scope the visible
53 // parts of a scene (#1029).
54 std::optional<osc::AABB> visibleBounds() const;
55
56 // Updates the internal decoration cache and returns `visibleBounds()`.
57 std::optional<osc::AABB> visibleBounds(const ModelStatePair&, const ModelRendererParams&);
58
59 std::optional<osc::SceneCollision> getClosestCollision(
61 osc::Vector2 mouseScreenPosition,
62 const osc::Rect& viewportScreenRect
63 ) const;
64
65 private:
66 class Impl;
67 std::unique_ptr<Impl> m_Impl;
68 };
69}
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
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