15#include <hpp/type_name.hpp>
16#include <hpp/utility.hpp>
22auto to_bx(
const math::vec3& data) -> bx::Vec3
24 return {data.x, data.y, data.z};
27auto from_bx(
const bx::Vec3& data) -> math::vec3
29 return {data.x, data.y, data.z};
36 auto e = var.cast<entt::handle>();
48 auto& selected_camera = selected_camera_comp.
get_camera();
49 const auto view_proj = selected_camera.get_view_projection();
50 const auto bounds = selected_camera.get_local_bounding_box();
61 aabb.min =
to_bx(bounds.min);
62 aabb.max =
to_bx(bounds.max);
72 const auto&
light = light_comp.get_light();
80 auto oposite = tan_angle * adjacent;
85 math::vec3 from = transform_comp.get_position_global();
86 math::vec3 to = from + transform_comp.get_z_axis_local() * adjacent;
92 auto oposite = tan_angle * adjacent;
97 math::vec3 from = transform_comp.get_position_global();
98 math::vec3 to = from + transform_comp.get_z_axis_local() * adjacent;
108 math::vec3
center = transform_comp.get_position_global();
119 math::vec3 from1 = transform_comp.get_position_global();
120 math::vec3 to1 = from1 + transform_comp.get_z_axis_local() * 1.0f;
122 bx::Cylinder cylinder = {
to_bx(from1),
to_bx(to1), 0.1f};
125 math::vec3 from2 = to1;
126 math::vec3 to2 = from2 + transform_comp.get_z_axis_local() * 0.5f;
128 bx::Cone cone = {
to_bx(from2),
to_bx(to2), 0.25f};
136 const auto& probe = probe_comp.
get_probe();
144 aabb.min =
to_bx(-probe.box_data.extents);
145 aabb.max =
to_bx(probe.box_data.extents);
152 auto radius = probe.get_face_extents(0, world_transform);
153 auto transform = world_transform;
154 transform.reset_scale();
255 auto bbox = text_comp.get_bounds();
257 if(frustum.test_obb(bbox, world_transform))
264 aabb.min =
to_bx(bbox.min);
265 aabb.max =
to_bx(bbox.max);
272 hpp::for_each_tuple_type<all_inspectable_components>(
276 auto component = e.try_get<ctype>();
283 auto var_comp = entt::forward_as_meta(*component);
292 auto e = var.cast<entt::handle>();
303 const auto& world_transform = transform_comp.get_transform_global();
305 constexpr float MIN_VISIBLE_DISTANCE = 1.0f;
306 constexpr float MIN_FADE_RANGE = 0.5f;
308 constexpr float MAX_VISIBLE_DISTANCE = 50.0f;
309 constexpr float MAX_FADE_RANGE = 25.0f;
311 auto dist = math::distance(world_transform.get_position(), cam.
get_position());
314 float distance_alpha = 1.0f;
315 if(dist < MIN_VISIBLE_DISTANCE)
318 float fade_start = MIN_VISIBLE_DISTANCE - MIN_FADE_RANGE;
319 distance_alpha = math::clamp((dist - fade_start) / MIN_FADE_RANGE, 0.0f, 1.0f);
321 else if(dist > MAX_VISIBLE_DISTANCE)
324 distance_alpha = math::clamp(1.0f - (dist - MAX_VISIBLE_DISTANCE) / MAX_FADE_RANGE, 0.0f, 1.0f);
328 auto alpha = em.billboard_data.opacity * distance_alpha;
337 if(!transform_comp.is_active_global())
342 auto icon = tm.get_gizmo_icon(e);
347 const auto&
light = light_comp.get_light();
363 icon->native_handle(),
364 to_bx(world_transform.get_position()),
367 em.billboard_data.size);
Class that contains core camera data, used for rendering and other purposes.
auto get_projection_mode() const -> projection_mode
Gets the projection mode.
auto get_camera() -> camera &
Gets the camera object.
Class representing a camera. Contains functionality for manipulating and updating a camera....
auto test_billboard(float size, const math::transform &t) const -> bool
auto z_unit_axis() const -> math::vec3
Retrieves the z-axis unit vector of the camera's local coordinate system.
auto get_position() const -> const math::vec3 &
Retrieves the current position of the camera.
auto get_frustum() const -> const math::frustum &
Retrieves the current camera object frustum.
Class that contains core light data, used for rendering and other purposes.
Class that contains core reflection probe data, used for rendering and other purposes.
auto get_probe() const -> const reflection_probe &
Gets the reflection probe object.
void draw_billboard(DebugDrawEncoder &dd, bgfx::TextureHandle icon_texture, const bx::Vec3 &icon_center, const bx::Vec3 &camera_pos, const bx::Vec3 &camera_look_dir, float half_size)
@ box
Box type reflection probe.
std::tuple< tag_component, layer_component, prefab_component, prefab_id_component, transform_component, test_component, model_component, animation_component, bone_component, submesh_component, camera_component, assao_component, tonemapping_component, fxaa_component, ssr_component, light_component, skylight_component, reflection_probe_component, physics_component, audio_source_component, audio_listener_component, text_component, ui_document_component > all_inspectable_components
void draw_gizmo_var(rtti::context &ctx, entt::meta_any &var, const camera &cam, gfx::dd_raii &dd)
auto to_bx(const glm::vec3 &data) -> bx::Vec3
void draw(const bx::Aabb &_aabb)
void drawCone(const bx::Vec3 &_from, const bx::Vec3 &_to, float _radius)
void setColor(uint32_t _abgr)
void setWireframe(bool _wireframe)
void setState(bool _depthTest, bool _depthWrite, bool _clockwise, bool _alphaWrite=false, bool _alphaBlend=true)
void pushTransform(const void *_mtx)
void drawFrustum(const void *_viewProj)
void drawCircle(const bx::Vec3 &_normal, const bx::Vec3 &_center, float _radius, float _weight=0.0f)
void setLod(uint8_t _lod)
void draw_billboard(rtti::context &ctx, entt::meta_any &var, const camera &cam, gfx::dd_raii &dd) override
void draw(rtti::context &ctx, entt::meta_any &var, const camera &cam, gfx::dd_raii &dd) override
float range
The range of the point light.
float get_range() const
Gets the range of the spot light.
float get_outer_angle() const
Gets the outer angle of the spot light.
float get_inner_angle() const
Gets the inner angle of the spot light.
Struct representing a light.
light_type type
The type of the light.
math::color color
The color of the light.
point point_data
Data specific to point lights.
spot spot_data
Data specific to spot lights.