Created
April 7, 2020 14:57
-
-
Save mfkl/189cba32b4863bf1289a79444f352053 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void PanUpdated(object sender, PanUpdatedEventArgs e) | |
{ | |
switch (e.StatusType) | |
{ | |
case GestureStatus.Running: | |
if (ScreenWidth > 0 && ScreenHeight > 0) | |
{ | |
double range = Math.Max(ScreenWidth, ScreenHeight); | |
float yaw = (float)(Fov * -e.TotalX / range);// up/down | |
float pitch = (float)(Fov * -e.TotalY / range);// left/right | |
MediaPlayer.UpdateViewpoint(Yaw + yaw, Pitch + pitch, Roll, Fov); | |
} | |
break; | |
case GestureStatus.Started: | |
case GestureStatus.Canceled: | |
break; | |
case GestureStatus.Completed: | |
Fov = MediaPlayer.Viewpoint.Fov; | |
Pitch = MediaPlayer.Viewpoint.Pitch; | |
Roll = MediaPlayer.Viewpoint.Roll; | |
Yaw = MediaPlayer.Viewpoint.Yaw; | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment