From cd81380dafc3fafe0cf5a42058c29b3d822dd46f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20=C5=A0toura=C4=8D?= <525032@mail.muni.cz> Date: Wed, 22 May 2024 10:28:40 +0200 Subject: [PATCH] remove unnecessary comments --- src/algo/src/misc.cpp | 8 +------- src/edit/include/edit/scene.hpp | 4 ---- src/edit/src/editor.cpp | 21 ------------------- src/edit/src/scene.cpp | 29 --------------------------- src/filein/src/module_loader.cpp | 2 +- src/filein/src/rofiworld_loader.cpp | 4 ++-- src/gui/src/ui.cpp | 3 --- src/rofi/include/rofi/connector.hpp | 1 - src/rofi/include/rofi/module.hpp | 1 - src/rofi/include/rofi/voxel_graph.hpp | 3 +-- src/rofi/src/connector.cpp | 14 ------------- src/rofi/src/module.cpp | 11 +--------- src/rofi/src/rofiworld.cpp | 1 - src/rofi/src/voxel_graph.cpp | 2 -- 14 files changed, 6 insertions(+), 98 deletions(-) diff --git a/src/algo/src/misc.cpp b/src/algo/src/misc.cpp index 96fed7a..982d699 100644 --- a/src/algo/src/misc.cpp +++ b/src/algo/src/misc.cpp @@ -46,8 +46,6 @@ node_ptr find_node_with_rofi_object(const std::vector<node_ptr> &nodes, objectba glm::quat get_connector_face_rotation(glm::vec3 local_direction) { ASSUMPTION(glm::length(local_direction) == 1.0f); - // if (rofi::vec_to_enum(local_direction) == rofi::side::z_neg) - // return glm::angleAxis(glm::radians(180.0f), glm::vec3(0.0f, 0.0f, 1.0f)); return glm::rotation(rofi::enum_to_vec(rofi::side::z_neg), local_direction); } @@ -55,7 +53,7 @@ glm::quat get_connector_face_rotation(glm::vec3 local_direction) glm::quat get_shared_voxel_face_rotation(glm::vec3 local_direction) { ASSUMPTION(glm::length(local_direction) == 1.0f); - return glm::rotation(rofi::enum_to_vec(rofi::side::z_neg), -local_direction); // * glm::angleAxis(glm::radians(180.0f), glm::vec3(0.0f, 0.0f, 1.0f)); + return glm::rotation(rofi::enum_to_vec(rofi::side::z_neg), -local_direction); } bool face_each_other(node_ptr fst_node, node_ptr snd_node, glm::vec3 axis) @@ -136,8 +134,6 @@ glm::vec3 convert_to_rofi_export_coordinates(const glm::vec3 &position, const gl glm::mat4 convert_to_rofi_export_coordinates(const glm::mat4 &editor_matrix) { - // E -> E' - // auto m = // glm::toMat4(glm::angleAxis(glm::radians(90.0f), glm::vec3(0.0f, 0.0f, -1.0f))) // glm::toMat4(glm::angleAxis(glm::radians(90.0f), glm::vec3(0.0f, -1.0f, 0.0f))) // * glm::toMat4(glm::angleAxis(glm::radians(90.0f), glm::vec3(-1.0f, 0.0f, 0.0f))) @@ -169,8 +165,6 @@ glm::mat4 convert_to_editor_import_coordinates(const glm::mat4 &rofi_matrix) 1, 0, 0, 0, // col Z 0, 0, 0, 1 // col W ); - - // const auto corrected_component_matrix = rofi_matrix * A_neg_X_local_correction_matrix; auto m = glm::inverse(get_magic_matrix()) * rofi_matrix * glm::inverse(A_neg_X_local_correction_matrix); diff --git a/src/edit/include/edit/scene.hpp b/src/edit/include/edit/scene.hpp index baf1e33..1697d57 100644 --- a/src/edit/include/edit/scene.hpp +++ b/src/edit/include/edit/scene.hpp @@ -21,10 +21,6 @@ class Scene { private: std::vector<node_ptr> scene; - // node_ptr selection; - // node_ptr selection_AABB; - // node_ptr side_highlight; - // glm::vec3 highlight_direction; std::vector<node_ptr> selections = { nullptr }; std::vector<node_ptr> selection_AABBs = { nullptr }; std::vector<node_ptr> side_highlights = { nullptr }; diff --git a/src/edit/src/editor.cpp b/src/edit/src/editor.cpp index 7383819..36c6917 100644 --- a/src/edit/src/editor.cpp +++ b/src/edit/src/editor.cpp @@ -266,7 +266,6 @@ void Editor::resetBuildModeIIVariables() void Editor::update() { - // WARNING: Not tested when placed here, before the rest of the methods updateEnvironment(); /* User Input */ @@ -405,12 +404,6 @@ void Editor::changeModeI() using enum mode_I; auto previous_mode = editor_mode_I; - /* Contextual change */ - // if (keyboard.just_pressed().contains("B")) - // editor_mode_I = editor_mode_I == build ? spectate : build; - // if (keyboard.just_pressed().contains(";")) - // editor_mode_I = editor_mode_I == debug ? spectate : debug; - /* Independent change */ if (keyboard.down().contains("LeftCtrl")) { @@ -636,11 +629,8 @@ void Editor::doBuildUniversalAction() void Editor::doBuildPadAction() { - // hoverOver(); selectObject(); updateAllowedComponents(); - // updateBuildHint(); - // controlBuild(); createPad(selected_pad_width, selected_pad_height); selection_previous_frame = scene->getSelection(); } @@ -1471,13 +1461,6 @@ glm::vec3 Editor::getNewItemLocalDirection() const ASSUMPTION(selection); ASSUMPTION(isConnector(selection) || isVoxel(selection)); - // if (isConnector(selection)) - // { - // auto connector = getConnector(selection); - // if (!connector->isFull() && !connector->isEmpty()) - // return rofi::enum_to_vec(rofi::side::x_pos); - // } - return scene->getHighlightDirection(); } @@ -2255,8 +2238,6 @@ void Editor::doAddModuleAction() void Editor::doConnectModuleAction() { controlConnectModule(); - // hoverOver(); - // selectObject(); selectModule(); updateSelectedConnectors(); updateConnectionHint(); @@ -2275,7 +2256,6 @@ void Editor::doManipulateModuleAction() void Editor::doRotateComponentAction() { - // selectObject(); selectModule(); updateSelectedComponent(); updateRotationHint(); @@ -2861,7 +2841,6 @@ bool Editor::detectCollision(bool something_changed, rofiworld_ptr rofiworld) if (!something_changed) return false; - // toggleRoFIInvalidStateMesh(false, collided_modules); std::set<module_ptr> curr_collided_modules; auto collision_detected = rofiworld->detectCollision(curr_collided_modules); diff --git a/src/edit/src/scene.cpp b/src/edit/src/scene.cpp index e8ec652..6a7924b 100644 --- a/src/edit/src/scene.cpp +++ b/src/edit/src/scene.cpp @@ -34,26 +34,6 @@ void Scene::createScene() camera_light_node->setScale(glm::vec3(0.1f, 0.1f, 0.1f)); addLight(camera_light_node, glm::vec4(0.0f), glm::vec4(0.5f), glm::vec4(0.0f), false, true); - // Mesh light_cube_green(lit_cube_vertices, - // std::vector<float>{}, - // lit_cube_indices, - // glm::vec3(0.0f, 1.0f, 0.0f), - // "basic"); - // addNode(glm::vec3(3.0f, 1.5f, 0.0f)); - // scene.back()->setScale(glm::vec3(0.1f, 0.1f, 0.1f)); - // addMesh(scene.back(), light_cube_green); - // addLight(scene.back(), glm::vec3(0.0f, 2.0f, 0.0f), true); - - /* ADD SKYBOX */ - // const std::vector<std::filesystem::path> skybox_paths = { - // "./data/images/skybox/right.jpg", - // "./data/images/skybox/left.jpg", - // "./data/images/skybox/top.jpg", - // "./data/images/skybox/bottom.jpg", - // "./data/images/skybox/front.jpg", - // "./data/images/skybox/back.jpg" - // }; - const std::vector<std::filesystem::path> skybox_paths = { "./data/images/kloofendal_cloudy/right.png", "./data/images/kloofendal_cloudy/left.png", @@ -63,15 +43,6 @@ void Scene::createScene() "./data/images/kloofendal_cloudy/back.png" }; - // const std::vector<std::filesystem::path> skybox_paths = { - // "./data/images/tron_skybox/front.png", - // "./data/images/tron_skybox/back.png", - // "./data/images/tron_skybox/top.png", - // "./data/images/tron_skybox/bottom.png", - // "./data/images/tron_skybox/right.png", - // "./data/images/tron_skybox/left.png" - // }; - addSkyboxNode("./data/models/cubemap_cube.obj", skybox_paths); /* ADD GRID */ diff --git a/src/filein/src/module_loader.cpp b/src/filein/src/module_loader.cpp index 829c38f..b63ed46 100644 --- a/src/filein/src/module_loader.cpp +++ b/src/filein/src/module_loader.cpp @@ -272,7 +272,7 @@ void export_joints_fixed_open(boost::json::array &joints, voxel_graph_ptr &voxel } } - /* Joints on Cube-Voxels */ // ??? + /* Joints on Cube-Voxels */ for (const auto &connector : voxel_graph->getConnections()) { auto connector_true_type = connector->getType(true); diff --git a/src/filein/src/rofiworld_loader.cpp b/src/filein/src/rofiworld_loader.cpp index bfc22b9..c7e0163 100644 --- a/src/filein/src/rofiworld_loader.cpp +++ b/src/filein/src/rofiworld_loader.cpp @@ -39,8 +39,8 @@ void export_modules(boost::json::array &modules_array, const std::map<module_ptr export_module_universal(modules_array, module, id); if (module_type == "pad") export_module_pad(modules_array, module, id); - if (module_type == "unknown") - export_module_unknown(modules_array, module, id); // TO DO + // if (module_type == "unknown") + // export_module_unknown(modules_array, module, id); // TO DO } } diff --git a/src/gui/src/ui.cpp b/src/gui/src/ui.cpp index 892be6c..7f2b3f0 100644 --- a/src/gui/src/ui.cpp +++ b/src/gui/src/ui.cpp @@ -795,8 +795,6 @@ void module_movement_ui(const osi::Window &window, edit::UIData &data) data.module_position = convert_to_editor_coordinates(position - prev_position); data.is_moving_module = data.module_position != glm::vec3(0.0f); - - // data.selected_module->getNode()->setPosVec(position); } @@ -816,7 +814,6 @@ void module_rotation_ui(const osi::Window &window, edit::UIData &data) ImGui::DragFloat("Step", &data.module_rotation_step, 0.25f, 0.0f, 90.0f, "%.3f", ImGuiSliderFlags_AlwaysClamp); - // const auto module_rotation = glm::toQuat(convert_to_rofi_coordinates(data.selected_module->getNode()->getRotationMatWorld())); glm::vec3 euler_angles = convert_to_rofi_coordinates(glm::eulerAngles(data.selected_module->getNode()->getRotationWorld())); euler_angles = glm::degrees(euler_angles); glm::vec3 prev_euler_angles = euler_angles; diff --git a/src/rofi/include/rofi/connector.hpp b/src/rofi/include/rofi/connector.hpp index 84dc476..0a98ab6 100644 --- a/src/rofi/include/rofi/connector.hpp +++ b/src/rofi/include/rofi/connector.hpp @@ -89,7 +89,6 @@ public: class OpenConnector : public Connector { - // bool occupied = false; OpenConnector(const OpenConnector &other); OpenConnector(const OpenConnector &&other); diff --git a/src/rofi/include/rofi/module.hpp b/src/rofi/include/rofi/module.hpp index 2328426..cb0c1b4 100644 --- a/src/rofi/include/rofi/module.hpp +++ b/src/rofi/include/rofi/module.hpp @@ -23,7 +23,6 @@ class Module std::string name; std::string type; - // uint64_t module_id; std::map<objectbase_ptr, uint64_t> component_ids; std::map<connector_ptr, std::string> connector_docks; diff --git a/src/rofi/include/rofi/voxel_graph.hpp b/src/rofi/include/rofi/voxel_graph.hpp index fd2e1c8..1116195 100644 --- a/src/rofi/include/rofi/voxel_graph.hpp +++ b/src/rofi/include/rofi/voxel_graph.hpp @@ -10,7 +10,6 @@ namespace rofi { -// enum class connector_type {fixed, open, rotation, shared_rotation}; enum component { voxel, fixed_con, open_con, rotation_con, shared_rotation_con }; class VoxelGraph; @@ -73,7 +72,7 @@ public: // void join(connector_ptr connector, voxel_ptr fst_voxel, voxel_ptr snd_voxel); void disjoin(connector_ptr connector, voxel_ptr voxel); - // void disjoin(glm::vec3 direction, voxel_ptr voxel); //vec jako const ref + // void disjoin(glm::vec3 direction, voxel_ptr voxel); void disjoinConnectors(connector_ptr fst_connector, connector_ptr snd_connector); void disjoinAll(voxel_ptr voxel); void disjoinAll(connector_ptr connector); diff --git a/src/rofi/src/connector.cpp b/src/rofi/src/connector.cpp index 1c12088..2eda2fe 100644 --- a/src/rofi/src/connector.cpp +++ b/src/rofi/src/connector.cpp @@ -134,13 +134,11 @@ void Connector::connectVoxel(side s, voxel_weak_ptr voxel) (voxel_side.first == side::undefined ? voxel_side.first : voxel_side.second) = s; - // ASSUMPTION(voxel_side.first != voxel_side.second); // Wrong ASSUMPTION(connection.first.lock() != connection.second.lock()); if (voxel_side.first != side::undefined && voxel_side.second != side::undefined) { ASSUMPTION(!connection.first.expired() && !connection.second.expired()); - // ASSUMPTION(enum_to_vec(voxel_side.first) == -enum_to_vec(voxel_side.second)); // Wrong } } void Connector::disconnectVoxel(voxel_weak_ptr voxel) @@ -236,18 +234,6 @@ std::shared_ptr<OpenConnector> OpenConnector::copy(std::shared_ptr<OpenConnector /* ROTATION CONNECTOR */ -// const connector_type RotationConnector::getType(voxel_weak_ptr from_voxel) -// { -// if (isEmpty()) -// return connector_type::rotation; - -// if (from_voxel.expired()) -// return semantic_type; - -// // This expects, that host Voxel of Rotation connector is always first in pair -// return from_voxel.lock() == connection.first.lock() ? connector_type::rotation : semantic_type; -// } - RotationConnector::RotationConnector(const RotationConnector &other) : Connector(other) { diff --git a/src/rofi/src/module.cpp b/src/rofi/src/module.cpp index 409e9ce..f2453ad 100644 --- a/src/rofi/src/module.cpp +++ b/src/rofi/src/module.cpp @@ -133,16 +133,7 @@ void Module::setComponentIDsUniversal() component_ids.emplace(voxel, 9); } - // Shoes // Shoes do not get placed into the map as the key - connector is already placed as roficom - // for (const auto &connector : parts->getConnections()) - // { - // if (auto rot_con = std::dynamic_pointer_cast<RotationConnector>(connector); - // rot_con && rot_con->isHead()) - // { - // component_ids.emplace(connector, connector->getConnection().first.lock() == a_voxel ? 6 : 7); - // } - // } - + // Shoes do not get placed into the map as the key - connector is already placed as roficom } void Module::setComponentIDsGeneric() diff --git a/src/rofi/src/rofiworld.cpp b/src/rofi/src/rofiworld.cpp index 69617df..6fee13f 100644 --- a/src/rofi/src/rofiworld.cpp +++ b/src/rofi/src/rofiworld.cpp @@ -114,7 +114,6 @@ bool RofiWorld::reachable(module_ptr fst_module, module_ptr snd_module) const void RofiWorld::rotateVoxel(voxel_ptr voxel, float angle) { voxel->getNode()->rotateRotationQuat(glm::angleAxis(glm::radians(angle), glm::vec3(1.0f, 0.0f, 0.0f))); - // voxel->getNode()->rotateRotationQuat(glm::angleAxis(glm::radians(angle), -voxel->getNode()->getRotationAxisZLocal())); } void RofiWorld::rotateConnector(connector_ptr connector, float angle) diff --git a/src/rofi/src/voxel_graph.cpp b/src/rofi/src/voxel_graph.cpp index 3d355b7..7784266 100644 --- a/src/rofi/src/voxel_graph.cpp +++ b/src/rofi/src/voxel_graph.cpp @@ -41,8 +41,6 @@ void VoxelGraph::join(glm::vec3 local_direction, connector_ptr connector, voxel_ if (auto rot_con = std::dynamic_pointer_cast<RotationConnector>(connector) ; rot_con && rot_con->isHead() && rot_con->getType(voxel) == connector_type::rotation) { - // join(rot_con->getBoundConnectors().first.lock(), rot_con->getRotationAxis(), voxel); - // join(rot_con->getBoundConnectors().second.lock(), -rot_con->getRotationAxis(), voxel); joinSingular(vec_to_enum(rot_con->getRotationAxis()), rot_con->getBoundConnectors().first.lock(), voxel); joinSingular(vec_to_enum(-rot_con->getRotationAxis()), rot_con->getBoundConnectors().second.lock(), voxel); } -- GitLab