| 288 | } |
| 289 | |
| 290 | void SkyEditor::HandleSunScale(float angle_from_sun) { |
| 291 | Mouse* mouse = &(Input::Instance()->getMouse()); |
| 292 | |
| 293 | if (!m_sun_scaling // && angle_from_sun > m_sun_angular_rad && angle_from_sun < m_sun_angular_rad*1.2f |
| 294 | && mouse->mouse_down_[Mouse::LEFT] == Mouse::CLICKED && m_sun_selected) { // start |
| 295 | HandleTransformationStarted(); |
| 296 | m_sun_scaling = true; |
| 297 | scale_angle_zero_ = angle_from_sun; |
| 298 | |
| 299 | if (ActiveCameras::Get()->m_camera_object != NULL) { |
| 300 | ActiveCameras::Get()->m_camera_object->IgnoreMouseInput(true); |
| 301 | } |
| 302 | } else if (m_sun_scaling) { |
| 303 | if (mouse->mouse_down_[Mouse::LEFT]) { // continue |
| 304 | if (scale_angle_zero_ != 0) { |
| 305 | float factor = angle_from_sun / scale_angle_zero_; |
| 306 | ScaleSun(factor); |
| 307 | scale_angle_zero_ = angle_from_sun; |
| 308 | } |
| 309 | } else { // stop |
| 310 | if (scale_angle_zero_ != 0) { |
| 311 | float factor = angle_from_sun / scale_angle_zero_; |
| 312 | ScaleSun(factor); |
| 313 | scale_angle_zero_ = angle_from_sun; |
| 314 | } |
| 315 | m_sun_scaling = false; |
| 316 | |
| 317 | if (ActiveCameras::Get()->m_camera_object != NULL) { |
| 318 | ActiveCameras::Get()->m_camera_object->IgnoreMouseInput(false); |
| 319 | } |
| 320 | |
| 321 | HandleTransformationStopped(); |
| 322 | } |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | static float GetSignedAngleBetween(const vec3& n, const vec3& v1, const vec3& v2) { |
| 327 | const vec3 a = normalize(v1); |
no test coverage detected