MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / HandleSunScale

Method HandleSunScale

Source/Editors/sky_editor.cpp:290–324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288}
289
290void 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
326static float GetSignedAngleBetween(const vec3& n, const vec3& v1, const vec3& v2) {
327 const vec3 a = normalize(v1);

Callers 1

UpdateMethod · 0.80

Calls 2

GetFunction · 0.50
IgnoreMouseInputMethod · 0.45

Tested by

no test coverage detected