| 141 | } |
| 142 | |
| 143 | void motion_3d(int x, int y) |
| 144 | { |
| 145 | if ((x == last_position.x) && (y == last_position.y)) |
| 146 | { |
| 147 | return; |
| 148 | } |
| 149 | |
| 150 | auto tr = wf::ensure_named_transformer<wf::scene::view_3d_transformer_t>( |
| 151 | current_view, wf::TRANSFORMER_3D, transformer_3d, current_view); |
| 152 | |
| 153 | current_view->get_transformed_node()->begin_transform_update(); |
| 154 | float dx = x - last_position.x; |
| 155 | float dy = y - last_position.y; |
| 156 | float ascale = glm::radians(sensitivity / 60.0f); |
| 157 | float dir = invert ? -1.f : 1.f; |
| 158 | tr->rotation = glm::rotate<float>(tr->rotation, vlen(dx, dy) * ascale, |
| 159 | {dir *dy, dir * dx, 0}); |
| 160 | current_view->get_transformed_node()->end_transform_update(); |
| 161 | last_position = {(double)x, (double)y}; |
| 162 | } |
| 163 | |
| 164 | wf::plugin_activation_data_t grab_interface = { |
| 165 | .name = "wrot", |
nothing calls this directly
no test coverage detected