37 auto e = var.cast<entt::handle>();
49 auto& selected_camera = selected_camera_comp.
get_camera();
50 const auto view_proj = selected_camera.get_view_projection();
51 const auto bounds = selected_camera.get_local_bounding_box();
62 aabb.min =
to_bx(bounds.min);
63 aabb.max =
to_bx(bounds.max);
73 const auto&
light = light_comp.get_light();
81 auto oposite = tan_angle * adjacent;
86 math::vec3 from = transform_comp.get_position_global();
87 math::vec3 to = from + transform_comp.get_z_axis_local() * adjacent;
93 auto oposite = tan_angle * adjacent;
98 math::vec3 from = transform_comp.get_position_global();
99 math::vec3 to = from + transform_comp.get_z_axis_local() * adjacent;
109 math::vec3
center = transform_comp.get_position_global();
120 math::vec3 from1 = transform_comp.get_position_global();
121 math::vec3 to1 = from1 + transform_comp.get_z_axis_local() * 1.0f;
123 bx::Cylinder cylinder = {
to_bx(from1),
to_bx(to1), 0.1f};
126 math::vec3 from2 = to1;
127 math::vec3 to2 = from2 + transform_comp.get_z_axis_local() * 0.5f;
129 bx::Cone cone = {
to_bx(from2),
to_bx(to2), 0.25f};
137 const auto& probe = probe_comp.
get_probe();
145 aabb.min =
to_bx(-probe.box_data.extents);
146 aabb.max =
to_bx(probe.box_data.extents);
153 auto radius = probe.get_face_extents(0, world_transform);
154 auto transform = world_transform;
155 transform.reset_scale();
256 auto bbox = text_comp.get_bounds();
258 if(frustum.test_obb(bbox, world_transform))
265 aabb.min =
to_bx(bbox.min);
266 aabb.max =
to_bx(bbox.max);
280 if(frustum.test_aabb(bounds))
286 aabb.min =
to_bx(bounds.min);
287 aabb.max =
to_bx(bounds.max);
298 const auto shape = particle_emitter_comp.get_shape();
299 const auto scale = particle_emitter_comp.get_emission_shape_scale();
300 const auto direction = particle_emitter_comp.get_direction();
301 const float shape_size = 1.0f;
307 auto transform = math::scale(math::mat4(1.0f),
scale);
311 math::vec3
center{0.0f, 0.0f, 0.0f};
321 auto transform = math::scale(math::mat4(1.0f),
scale);
325 math::vec3
center{0.0f, 0.0f, 0.0f};
332 const int num_arcs = 8;
333 for(
int i = 0; i < num_arcs; ++i)
335 const float angle = (3.14159265f *
static_cast<float>(i)) /
static_cast<float>(num_arcs);
336 const float cos_a = math::cos(angle);
337 const float sin_a = math::sin(angle);
341 const float x_pos = cos_a * shape_size;
342 const float z_pos = sin_a * shape_size;
346 const int arc_segments = 16;
347 bool first_point =
true;
349 for(
int j = 0; j <= arc_segments; ++j)
351 const float arc_angle = (3.14159265f *
static_cast<float>(j)) /
static_cast<float>(arc_segments);
352 const float y = shape_size * math::sin(arc_angle);
353 const float radius_at_height = shape_size * math::cos(arc_angle);
355 const float x = cos_a * radius_at_height;
356 const float z = sin_a * radius_at_height;
371 const int num_horizontal_circles = 2;
372 for(
int i = 1; i <= num_horizontal_circles; ++i)
374 const float height_ratio =
static_cast<float>(i) /
static_cast<float>(num_horizontal_circles + 1);
375 const float y_pos = shape_size * height_ratio;
376 const float radius_at_height = shape_size * math::sqrt(1.0f - height_ratio * height_ratio);
387 auto transform = math::scale(math::mat4(1.0f),
scale);
391 math::vec3
center{0.0f, 0.0f, 0.0f};
400 const float half_size = shape_size;
402 box_aabb.min = {-half_size *
scale.x, -half_size *
scale.y, -half_size *
scale.z};
403 box_aabb.max = {half_size *
scale.x, half_size *
scale.y, half_size *
scale.z};
410 const float half_size = shape_size;
412 rect_aabb.min = {-half_size *
scale.x, -0.01f, -half_size *
scale.z};
413 rect_aabb.max = {half_size *
scale.x, 0.01f, half_size *
scale.z};
423 const float arrow_length = shape_size * 0.5f;
424 const float arrow_head_size = arrow_length * 0.2f;
435 dd.
encoder.
lineTo(-arrow_head_size, arrow_length - arrow_head_size, 0.0f);
437 dd.
encoder.
lineTo(arrow_head_size, arrow_length - arrow_head_size, 0.0f);
439 dd.
encoder.
lineTo(0.0f, arrow_length - arrow_head_size, -arrow_head_size);
441 dd.
encoder.
lineTo(0.0f, arrow_length - arrow_head_size, arrow_head_size);
447 const int num_arrows = 6;
448 for(
int i = 0; i < num_arrows; ++i)
450 const float angle = (2.0f * 3.14159265f *
static_cast<float>(i)) /
static_cast<float>(num_arrows);
451 const float cos_a = math::cos(angle);
452 const float sin_a = math::sin(angle);
455 dd.
encoder.
moveTo(cos_a * shape_size * 0.3f, 0.0f, sin_a * shape_size * 0.3f);
456 dd.
encoder.
lineTo(cos_a * arrow_length, 0.0f, sin_a * arrow_length);
459 const float head_x = cos_a * arrow_length;
460 const float head_z = sin_a * arrow_length;
461 const float back_x = cos_a * (arrow_length - arrow_head_size);
462 const float back_z = sin_a * (arrow_length - arrow_head_size);
465 dd.
encoder.
lineTo(back_x - sin_a * arrow_head_size * 0.5f, 0.0f, back_z + cos_a * arrow_head_size * 0.5f);
467 dd.
encoder.
lineTo(back_x + sin_a * arrow_head_size * 0.5f, 0.0f, back_z - cos_a * arrow_head_size * 0.5f);
481 hpp::for_each_tuple_type<all_inspectable_components>(
485 auto component = e.try_get<ctype>();
492 auto var_comp = entt::forward_as_meta(*component);
501 auto e = var.cast<entt::handle>();
512 const auto& world_transform = transform_comp.get_transform_global();
514 constexpr float MIN_VISIBLE_DISTANCE = 1.0f;
515 constexpr float MIN_FADE_RANGE = 0.5f;
517 constexpr float MAX_VISIBLE_DISTANCE = 50.0f;
518 constexpr float MAX_FADE_RANGE = 25.0f;
520 auto dist = math::distance(world_transform.get_position(), cam.
get_position());
523 float distance_alpha = 1.0f;
524 if(dist < MIN_VISIBLE_DISTANCE)
527 float fade_start = MIN_VISIBLE_DISTANCE - MIN_FADE_RANGE;
528 distance_alpha = math::clamp((dist - fade_start) / MIN_FADE_RANGE, 0.0f, 1.0f);
530 else if(dist > MAX_VISIBLE_DISTANCE)
533 distance_alpha = math::clamp(1.0f - (dist - MAX_VISIBLE_DISTANCE) / MAX_FADE_RANGE, 0.0f, 1.0f);
537 auto alpha = em.billboard_data.opacity * distance_alpha;
546 if(!transform_comp.is_active_global())
551 auto icon = tm.get_gizmo_icon(e);
556 const auto&
light = light_comp.get_light();
572 icon->native_handle(),
573 to_bx(world_transform.get_position()),
576 em.billboard_data.size);
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, particle_emitter_component, ui_document_component > all_inspectable_components