opynsim
Unofficial C++ Documentation
Loading...
Searching...
No Matches
scene_helpers.h
Go to the documentation of this file.
1#pragma once
2
10#include <liboscar/maths/bvh.h>
14
15#include <functional>
16#include <optional>
17#include <span>
18
19namespace osc { class BVH; }
20namespace osc { class Camera; }
21namespace osc { class Mesh; }
22namespace osc { class Rect; }
23namespace osc { class SceneCache; }
24namespace osc { struct AABB; }
25namespace osc { struct LineSegment; }
26namespace osc { struct PolarPerspectiveCamera; }
27namespace osc { struct Ray; }
28namespace osc { struct Transform; }
29
30namespace osc
31{
34 const BVH&,
35 const std::function<void(SceneDecoration&&)>& out
36 );
37
40 const AABB&,
41 const std::function<void(SceneDecoration&&)>& out
42 );
43
46 std::span<const AABB>,
47 const std::function<void(SceneDecoration&&)>& out
48 );
49
52 const BVH&,
53 const std::function<void(SceneDecoration&&)>& out
54 );
55
58 const std::function<void(SceneDecoration&&)>& out,
59 float scale = 5.0f
60 );
61
64 const std::function<void(SceneDecoration&&)>& out
65 );
66
69 const std::function<void(SceneDecoration&&)>& out
70 );
71
74 const std::function<void(SceneDecoration&&)>& out
75 );
76
88 const ArrowProperties&,
89 const std::function<void(SceneDecoration&&)>& out
90 );
91
94 const LineSegment&,
95 const Color&,
96 float radius,
97 const std::function<void(SceneDecoration&&)>& out
98 );
99
100 // updates the given BVH with the given component decorations
102 std::span<const SceneDecoration>,
103 BVH&
104 );
105
106 // calls `out` with each `SceneCollision` found along `world_space_ray`
108 const BVH& scene_bvh,
109 SceneCache&,
110 std::span<const SceneDecoration>,
111 const Ray& world_space_ray,
112 const std::function<void(SceneCollision&&)>& out
113 );
114
115 // returns all collisions along `world_space_ray`
116 std::vector<SceneCollision> get_all_ray_collisions_with_scene(
117 const BVH& scene_bvh,
118 SceneCache&,
119 std::span<const SceneDecoration>,
120 const Ray& world_space_ray
121 );
122
123 // returns closest ray-triangle collision along `world_space_ray`
125 const Mesh&,
126 const BVH& triangle_bvh,
127 const Transform&,
128 const Ray& world_space_ray
129 );
130
131 // returns closest ray-triangle collision in world space for a given mouse position
132 // within the given render rectangle
135 const Mesh&,
136 const BVH& triangle_bvh,
139 );
140
141 // returns scene rendering parameters for an generic panel
145 Vector2 dimensions,
146 float device_pixel_ratio
147 );
148
149 // returns a triangle BVH for the given triangle mesh, or an empty BVH if the mesh is non-triangular or empty
151
152 // returns `FrustumPlanes` that represent the clipping planes of `camera` when rendering to an
153 // output that has an aspect ratio of `aspect_ratio`
155}
Definition anti_aliasing_level.h:11
Definition bvh.h:23
Definition camera.h:27
Definition mesh.h:33
Definition rect.h:17
Definition scene_cache.h:25
Definition custom_decoration_generator.h:5
void draw_aabbs(SceneCache &, std::span< const AABB >, const std::function< void(SceneDecoration &&)> &out)
SceneRendererParams calc_standard_dark_scene_render_params(const PolarPerspectiveCamera &, AntiAliasingLevel, Vector2 dimensions, float device_pixel_ratio)
void update_scene_bvh(std::span< const SceneDecoration >, BVH &)
void draw_arrow(SceneCache &, const ArrowProperties &, const std::function< void(SceneDecoration &&)> &out)
void draw_xz_floor_lines(SceneCache &, const std::function< void(SceneDecoration &&)> &out, float scale=5.0f)
void draw_line_segment(SceneCache &, const LineSegment &, const Color &, float radius, const std::function< void(SceneDecoration &&)> &out)
void for_each_ray_collision_with_scene(const BVH &scene_bvh, SceneCache &, std::span< const SceneDecoration >, const Ray &world_space_ray, const std::function< void(SceneCollision &&)> &out)
void draw_bvh(SceneCache &, const BVH &, const std::function< void(SceneDecoration &&)> &out)
BVH create_triangle_bvh(const Mesh &)
void draw_xz_grid(SceneCache &, const std::function< void(SceneDecoration &&)> &out)
constexpr U to(T &&value)
Definition conversion.h:56
std::optional< RayCollision > get_closest_world_space_ray_triangle_collision(const Mesh &, const BVH &triangle_bvh, const Transform &, const Ray &world_space_ray)
void draw_xy_grid(SceneCache &, const std::function< void(SceneDecoration &&)> &out)
void draw_bvh_leaf_nodes(SceneCache &, const BVH &, const std::function< void(SceneDecoration &&)> &out)
FrustumPlanes calc_frustum_planes(const Camera &camera, float aspect_ratio)
std::vector< SceneCollision > get_all_ray_collisions_with_scene(const BVH &scene_bvh, SceneCache &, std::span< const SceneDecoration >, const Ray &world_space_ray)
Matrix< T, 4, 4 > scale(const Matrix< T, 4, 4 > &m, const Vector< T, 3 > &v)
Definition matrix_functions.h:78
void draw_aabb(SceneCache &, const AABB &, const std::function< void(SceneDecoration &&)> &out)
void draw_yz_grid(SceneCache &, const std::function< void(SceneDecoration &&)> &out)
Definition aabb.h:14
Definition scene_helpers.h:77
float neck_thickness
Definition scene_helpers.h:81
Vector3 start
Definition scene_helpers.h:78
float tip_length
Definition scene_helpers.h:80
Vector3 end
Definition scene_helpers.h:79
Color color
Definition scene_helpers.h:83
SceneDecorationFlags decoration_flags
Definition scene_helpers.h:84
float head_thickness
Definition scene_helpers.h:82
Definition frustum_planes.h:10
Definition line_segment.h:13
Definition polar_perspective_camera.h:14
Definition ray.h:13
static constexpr Rgba black()
Definition rgba.h:38
Definition scene_collision.h:12
Definition scene_decoration.h:15
Definition scene_renderer_params.h:13
Definition transform.h:11