Exemplo n.º 1
0
 private void OnKeyUp(object sender, KeyboardKeyEventArgs e)
 {
     if (e.Key == KeyboardKey.N)
     {
         _nKeyDown = false;
     }
     else if (e.Key == KeyboardKey.F)
     {
         _fKeyDown = false;
     }
     else if (e.Key == KeyboardKey.C)
     {
         _cKeyDown = false;
     }
 }
Exemplo n.º 2
0
 private void KeyUp(object sender, KeyboardKeyEventArgs e)
 {
     m_keyDownTime.Remove(e.Key);
 }
Exemplo n.º 3
0
 private void KeyDown(object sender, KeyboardKeyEventArgs e)
 {
     m_keyDownTime.Add(e.Key, Stopwatch.GetTimestamp());
 }
Exemplo n.º 4
0
        private void OnKeyDown(object sender, KeyboardKeyEventArgs e)
        {
            if (e.Key == KeyboardKey.N)
            {
                _nKeyDown = true;
            }
            else if (e.Key == KeyboardKey.F)
            {
                _fKeyDown = true;
            }
            else if (e.Key == KeyboardKey.C)
            {
                _cKeyDown = true;
            }
            else if (_nKeyDown && ((e.Key == KeyboardKey.Up) || (e.Key == KeyboardKey.Down)))
            {
                _nearDistance += (e.Key == KeyboardKey.Up) ? 1 : -1;

                UpdatePlanesAndDepthTests();
            }
            else if (_fKeyDown && ((e.Key == KeyboardKey.Up) || (e.Key == KeyboardKey.Down)))
            {
                _cubeRootFarDistance += (e.Key == KeyboardKey.Up) ? 1 : -1;

                UpdatePlanesAndDepthTests();
            }
            else if ((e.Key == KeyboardKey.Plus) || (e.Key == KeyboardKey.KeypadPlus) ||
                (e.Key == KeyboardKey.Minus) || (e.Key == KeyboardKey.KeypadMinus))
            {
                _cubeRootPlaneHeight += ((e.Key == KeyboardKey.Plus) || (e.Key == KeyboardKey.KeypadPlus)) ? 1 : -1;

                UpdatePlaneOrigin();
            }
            else if ((e.Key == KeyboardKey.Left) || (e.Key == KeyboardKey.Right))
            {
                _depthFormatIndex += (e.Key == KeyboardKey.Right) ? 1 : -1;
                if (_depthFormatIndex < 0)
                {
                    _depthFormatIndex = 2;
                }
                else if (_depthFormatIndex > 2)
                {
                    _depthFormatIndex = 0;
                }

                UpdateFramebufferAttachments();
            }
            else if (e.Key == KeyboardKey.D)
            {
                _depthTestLess = !_depthTestLess;

                UpdatePlanesAndDepthTests();
            }
            else if (e.Key == KeyboardKey.L)
            {
                _logarithmicDepthBuffer = !_logarithmicDepthBuffer;

                UpdateLogarithmicDepthBuffer();
            }
            else if (_cKeyDown && ((e.Key == KeyboardKey.Up) || (e.Key == KeyboardKey.Down)))
            {
                _logarithmicDepthConstant += (e.Key == KeyboardKey.Up) ? 0.1 : -0.1;

                UpdateLogarithmicDepthConstant();
            }

            UpdateHUD();
        }
Exemplo n.º 5
0
        private void OnKeyUp(object sender, KeyboardKeyEventArgs e)
        {
            if (e.Key == KeyboardKey.S)
            {
                _scaleWorldCoordinates = !_scaleWorldCoordinates;

                CreateCamera();
                CreateAlgorithm();
            }
            else if ((e.Key == KeyboardKey.Left) || (e.Key == KeyboardKey.Right))
            {
                _jitterAlgorithm += (e.Key == KeyboardKey.Right) ? 1 : -1;

                if (_jitterAlgorithm < JitterAlgorithm.RelativeToWorld)
                {
                    _jitterAlgorithm = JitterAlgorithm.GPURelativeToEyeLOD;
                }
                else if (_jitterAlgorithm > JitterAlgorithm.GPURelativeToEyeLOD)
                {
                    _jitterAlgorithm = JitterAlgorithm.RelativeToWorld;
                }

                CreateAlgorithm();
            }
            else if ((e.Key == KeyboardKey.Down) || (e.Key == KeyboardKey.Up))
            {
                _camera.Range += (e.Key == KeyboardKey.Down) ? FromMeters(0.01) : FromMeters(-0.01);
            }
        }
Exemplo n.º 6
0
        private void OnKeyDown(object sender, KeyboardKeyEventArgs e)
        {
            if ((e.Key == KeyboardKey.Left) || (e.Key == KeyboardKey.Right))
            {
                _tile.ShadingAlgorithm += (e.Key == KeyboardKey.Right) ? 1 : -1;
                if (_tile.ShadingAlgorithm < RayCastedTerrainShadingAlgorithm.ByHeight)
                {
                    _tile.ShadingAlgorithm = RayCastedTerrainShadingAlgorithm.ByRaySteps;
                }
                else if (_tile.ShadingAlgorithm > RayCastedTerrainShadingAlgorithm.ByRaySteps)
                {
                    _tile.ShadingAlgorithm = RayCastedTerrainShadingAlgorithm.ByHeight;
                }
            }
            if (e.Key == KeyboardKey.W)
            {
                _tile.ShowWireframe = !_tile.ShowWireframe;
            }

            UpdateHUD();
        }
 private void OnKeyDown(object sender, KeyboardKeyEventArgs e)
 {
     if (e.Key == KeyboardKey.U)
     {
         _sceneState.SunPosition = _sceneState.Camera.Eye;
     }
     else if (e.Key == KeyboardKey.W)
     {
         _clipmap.Wireframe = !_clipmap.Wireframe;
         UpdateHUD();
     }
     else if (e.Key == KeyboardKey.B)
     {
         if (!_clipmap.BlendRegionsEnabled)
         {
             _clipmap.BlendRegionsEnabled = true;
             _clipmap.ShowBlendRegions = false;
         }
         else if (_clipmap.ShowBlendRegions)
         {
             _clipmap.BlendRegionsEnabled = false;
         }
         else
         {
             _clipmap.ShowBlendRegions = true;
         }
         UpdateHUD();
     }
     else if (e.Key == KeyboardKey.L)
     {
         _clipmap.LodUpdateEnabled = !_clipmap.LodUpdateEnabled;
         UpdateHUD();
     }
     else if (e.Key == KeyboardKey.C)
     {
         _clipmap.ColorClipmapLevels = !_clipmap.ColorClipmapLevels;
         if (_clipmap.ColorClipmapLevels)
         {
             _clipmap.ShowImagery = false;
             _clipmap.Lighting = true;
         }
         UpdateHUD();
     }
     else if (e.Key == KeyboardKey.I)
     {
         _clipmap.ShowImagery = !_clipmap.ShowImagery;
         _clipmap.Lighting = !_clipmap.ShowImagery;
         if (_clipmap.ShowImagery)
         {
             _clipmap.ColorClipmapLevels = false;
         }
         UpdateHUD();
     }
     else if (e.Key == KeyboardKey.S)
     {
         _clipmap.Lighting = !_clipmap.Lighting;
         UpdateHUD();
     }
     else if (e.Key == KeyboardKey.Z)
     {
         if (_lookCamera != null)
         {
             double longitude = -119.5326056;
             double latitude = 37.74451389;
             Geodetic3D halfDome = new Geodetic3D(Trig.ToRadians(longitude), Trig.ToRadians(latitude), 2700.0);
             _lookCamera.ViewPoint(_ellipsoid, halfDome);
             _lookCamera.Azimuth = 0.0;
             _lookCamera.Elevation = Trig.ToRadians(30.0);
             _lookCamera.Range = 10000.0;
         }
     }
     else if (e.Key == KeyboardKey.F)
     {
         if (_lookCamera != null)
         {
             _lookCamera.Dispose();
             _lookCamera = null;
             _flyCamera = new CameraFly(_sceneState.Camera, _window);
             _flyCamera.MovementRate = 1200.0;
         }
         else if (_flyCamera != null)
         {
             _flyCamera.Dispose();
             _flyCamera = null;
             _sceneState.Camera.Target = new Vector3D(0.0, 0.0, 0.0);
             _lookCamera = new CameraLookAtPoint(_sceneState.Camera, _window, _ellipsoid);
             _lookCamera.UpdateParametersFromCamera();
         }
         UpdateHUD();
     }
     else if (_flyCamera != null && (e.Key == KeyboardKey.Plus || e.Key == KeyboardKey.KeypadPlus))
     {
         _flyCamera.MovementRate *= 2.0;
         UpdateHUD();
     }
     else if (_flyCamera != null && (e.Key == KeyboardKey.Minus || e.Key == KeyboardKey.KeypadMinus))
     {
         _flyCamera.MovementRate *= 0.5;
         UpdateHUD();
     }
     else if (e.Key == KeyboardKey.E)
     {
         if (_clipmap.Ellipsoid.MaximumRadius == _clipmap.Ellipsoid.MinimumRadius)
         {
             _clipmap.Ellipsoid = Ellipsoid.Wgs84;
             _globe.Shape = Ellipsoid.Wgs84;
         }
         else
         {
             double radius = Ellipsoid.Wgs84.MaximumRadius;
             _clipmap.Ellipsoid = new Ellipsoid(radius, radius, radius);
             _globe.Shape = _clipmap.Ellipsoid;
         }
     }
 }
Exemplo n.º 8
0
        private void OnKeyDown(object sender, KeyboardKeyEventArgs e)
        {
            if ((e.Key == KeyboardKey.Left) || (e.Key == KeyboardKey.Right) ||
                (e.Key == KeyboardKey.Up) || (e.Key == KeyboardKey.Down))
            {
                if (e.Key == KeyboardKey.Left)
                {
                    _granularityInDegrees = Math.Max(_granularityInDegrees - 1.0, 1.0);
                }
                else if (e.Key == KeyboardKey.Right)
                {
                    _granularityInDegrees = Math.Min(_granularityInDegrees + 1.0, 30.0);
                }
                else if (e.Key == KeyboardKey.Up)
                {
                    _semiMinorAxis = Math.Min(_semiMinorAxis + _semiMinorAxisDelta, 2.0);
                }
                else if (e.Key == KeyboardKey.Down)
                {
                    _semiMinorAxis = Math.Max(_semiMinorAxis - _semiMinorAxisDelta, 0.1);
                }
                SetShape();
            }
            else if ((e.Key == KeyboardKey.Number1) ||
                     (e.Key == KeyboardKey.Keypad1))
            {
                _sampledPoints.Show = !_sampledPoints.Show;
            }
            else if ((e.Key == KeyboardKey.Number2) ||
                     (e.Key == KeyboardKey.Keypad2))
            {
                _polyline.Show = !_polyline.Show;
            }
            else if ((e.Key == KeyboardKey.Number3) || 
                     (e.Key == KeyboardKey.Keypad3))
            {
                _plane.Show = !_plane.Show;
            }

            CreateScene();
        }
Exemplo n.º 9
0
 private void OnKeyDown(object sender, KeyboardKeyEventArgs e)
 {
     if (e.Key == KeyboardKey.U)
     {
         _silhouette = !_silhouette;
     }
     else if (e.Key == KeyboardKey.S)
     {
         _showSilhouette = !_showSilhouette;
     }
 }
Exemplo n.º 10
0
 private void OnKeyUp(object sender, KeyboardKeyEventArgs e)
 {
     if (e.Key == KeyboardKey.O)
     {
         _oKeyDown = false;
     }
 }
Exemplo n.º 11
0
        private void OnKeyDown(object sender, KeyboardKeyEventArgs e)
        {
            if (e.Key == KeyboardKey.O)
            {
                _oKeyDown = true;
            }
            else if (_oKeyDown && ((e.Key == KeyboardKey.Left) || (e.Key == KeyboardKey.Right)))
            {
                _quad.DayNightOutput += (e.Key == KeyboardKey.Right) ? 1 : -1;

                if (_quad.DayNightOutput < DayNightOutput.Composite)
                {
                    _quad.DayNightOutput = DayNightOutput.BlendBuffer;
                }
                else if (_quad.DayNightOutput > DayNightOutput.BlendBuffer)
                {
                    _quad.DayNightOutput = DayNightOutput.Composite;
                }
            }
            else if (e.Key == KeyboardKey.V)
            {
                _showVectorData = !_showVectorData;
            }
            else if (e.Key == KeyboardKey.W)
            {
                _wireframe = !_wireframe;

                _countries.Wireframe = _wireframe;
                _states.Wireframe = _wireframe;
                _rivers.Wireframe = _wireframe;
                _populatedPlaces.Wireframe = _wireframe;
                _airports.Wireframe = _wireframe;
                _amtrakStations.Wireframe = _wireframe;
            }

            UpdateHUD();
        }
        private void OnKeyDown(object sender, KeyboardKeyEventArgs e)
        {
            if ((e.Key == KeyboardKey.Up) || (e.Key == KeyboardKey.Down))
            {
                if (e.Key == KeyboardKey.Up)
                {
                    _semiMinorAxis = Math.Min(_semiMinorAxis + _semiMinorAxisDelta, 1.0);
                }
                else
                {
                    _semiMinorAxis = Math.Max(_semiMinorAxis - _semiMinorAxisDelta, 0.1);
                }
                _globeShape = new Ellipsoid(1, 1, _semiMinorAxis);

                CreateScene();
            }
        }