Remove some unused fields
This commit is contained in:
+1
-1
@@ -43,7 +43,7 @@ constexpr float scroll_ratio = 10;
|
||||
constexpr float trigger_click_thd = 0.8;
|
||||
|
||||
// Thresholds on the distance between the fingertip and GUI layers (positive: in front of the GUI, negative: behind the GUI)
|
||||
constexpr float fingertip_distance_hovering_thd = 0.15; // Max distance to have the cursor hovering
|
||||
constexpr float fingertip_distance_close_thd = 0.15; // Distance to switch between touch and aim interaction
|
||||
constexpr float fingertip_distance_touching_thd_hi = -0.01; // Distance to register a click
|
||||
constexpr float fingertip_distance_touching_thd_lo = -0.15; // Distance to register a click
|
||||
constexpr float fingertip_distance_stick_thd = -0.02; // Max distance where the fingertip is moved to be on the GUI
|
||||
|
||||
@@ -210,9 +210,6 @@ imgui_textures::imgui_textures(
|
||||
|
||||
std::vector<std::pair<ImVec2, float>> imgui_context::ray_plane_intersection(const imgui_context::controller_state & in) const
|
||||
{
|
||||
if (!in.active)
|
||||
return {};
|
||||
|
||||
std::vector<std::pair<ImVec2, float>> intersections;
|
||||
|
||||
for (const auto & i: layers_)
|
||||
@@ -581,20 +578,13 @@ std::vector<imgui_context::controller_state> imgui_context::read_controllers_sta
|
||||
index_tip.pose.position.y,
|
||||
index_tip.pose.position.z};
|
||||
// aim_orientation is ignored by ray_plane_intersection() for hands
|
||||
|
||||
state.active = true;
|
||||
}
|
||||
compute_pointer_position(state);
|
||||
|
||||
if (state.hover_distance < constants::gui::fingertip_distance_hovering_thd)
|
||||
{
|
||||
state.fingertip_hovering = true;
|
||||
if (state.hover_distance < constants::gui::fingertip_distance_close_thd)
|
||||
aim_interaction[ctrl.index] = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
state.pointer_position.reset();
|
||||
}
|
||||
|
||||
if (state.hover_distance < constants::gui::fingertip_distance_touching_thd_hi and state.hover_distance > constants::gui::fingertip_distance_touching_thd_lo)
|
||||
state.fingertip_touching = true;
|
||||
@@ -614,7 +604,6 @@ std::vector<imgui_context::controller_state> imgui_context::read_controllers_sta
|
||||
|
||||
if (auto location = application::locate_controller(ctrl.aim, world, display_time))
|
||||
{
|
||||
state.active = true;
|
||||
state.aim_position = location->first + glm::mat3_cast(location->second * ctrl.offset.second) * ctrl.offset.first;
|
||||
state.aim_orientation = location->second * ctrl.offset.second;
|
||||
compute_pointer_position(state);
|
||||
@@ -645,7 +634,7 @@ std::vector<imgui_context::controller_state> imgui_context::read_controllers_sta
|
||||
return new_states;
|
||||
}
|
||||
|
||||
void imgui_context::compute_pointer_position(imgui_context::controller_state & state)
|
||||
void imgui_context::compute_pointer_position(imgui_context::controller_state & state) const
|
||||
{
|
||||
auto intersections = ray_plane_intersection(state);
|
||||
|
||||
|
||||
@@ -109,8 +109,6 @@ public:
|
||||
|
||||
struct controller_state
|
||||
{
|
||||
bool active = false;
|
||||
|
||||
glm::vec3 aim_position = {0, 0, 0};
|
||||
glm::quat aim_orientation = {1, 0, 0, 0};
|
||||
|
||||
@@ -122,7 +120,6 @@ public:
|
||||
|
||||
bool squeeze_clicked = false;
|
||||
bool trigger_clicked = false;
|
||||
bool fingertip_hovering = false;
|
||||
bool fingertip_touching = false;
|
||||
ImGuiMouseSource source = ImGuiMouseSource_Mouse;
|
||||
};
|
||||
@@ -232,7 +229,7 @@ public:
|
||||
}
|
||||
|
||||
std::vector<std::pair<ImVec2, float>> ray_plane_intersection(const controller_state & in) const;
|
||||
void compute_pointer_position(controller_state & state);
|
||||
void compute_pointer_position(controller_state & state) const;
|
||||
|
||||
// Convert position from viewport coordinates to real-world
|
||||
glm::vec3 rw_from_vp(const ImVec2 & position);
|
||||
|
||||
@@ -542,7 +542,6 @@ std::optional<glm::vec3> scenes::lobby::check_recenter_action(XrTime predicted_d
|
||||
{
|
||||
// First frame of recentering
|
||||
imgui_context::controller_state state{
|
||||
.active = true,
|
||||
.aim_position = aim->first,
|
||||
.aim_orientation = aim->second,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user