public void FrameMove() { if (keysEnabled[keySave] && keys[keySave]) { keysEnabled[keySave] = false; if ((Control.ModifierKeys & Keys.Control) == Keys.Control) { record.Start(); } else { SaveToPng(); } } if (keysEnabled[keyMotion] && keys[keyMotion]) { keysEnabled[keyMotion] = false; viewer.MotionEnabled = !viewer.MotionEnabled; } if (keysEnabled[keyProjection] && keys[keyProjection]) { keysEnabled[keyProjection] = false; SwitchProjectionMode(); } if (keysEnabled[keyAmbient] && keys[keyAmbient]) { keysEnabled[keyAmbient] = false; SwitchRenderMode(RenderMode.Ambient); } if (keysEnabled[keyDepthMap] && keys[keyDepthMap]) { keysEnabled[keyDepthMap] = false; SwitchRenderMode(RenderMode.DepthMap); } if (keysEnabled[keyNormalMap] && keys[keyNormalMap]) { keysEnabled[keyNormalMap] = false; SwitchRenderMode(RenderMode.NormalMap); } if (keysEnabled[keyOcclusion] && keys[keyOcclusion]) { keysEnabled[keyOcclusion] = false; SwitchRenderMode(RenderMode.Occlusion); } if (keysEnabled[keyDiffusion] && keys[keyDiffusion]) { keysEnabled[keyDiffusion] = false; SwitchRenderMode(RenderMode.Diffusion); } if (keysEnabled[keyShadow] && keys[keyShadow]) { keysEnabled[keyShadow] = false; SwitchRenderMode(RenderMode.Shadow); } if (keysEnabled[keyConfigForm] && keys[keyConfigForm]) { keys[keyConfigForm] = false; keysEnabled[keyConfigForm] = true; // stale KeyUp event configForm.Show(); configForm.Activate(); } if (keysEnabled[keyFigure] && keys[keyFigure]) { keysEnabled[keyFigure] = false; viewer.NextFigure(); } if (keysEnabled[keyDelete] && keys[keyDelete]) { keysEnabled[keyDelete] = false; if (keys[(int)Keys.ControlKey]) { viewer.ClearFigureList(); } else { viewer.RemoveSelectedFigure(); } } if (keysEnabled[keyCameraReset] && keys[keyCameraReset]) { keysEnabled[keyCameraReset] = false; viewer.Camera.Reset(); viewer.Camera.SetTranslation(0.0f, +10.0f, +44.0f); } if (keysEnabled[keyCenter] && keys[keyCenter]) { keysEnabled[keyCenter] = false; viewer.Camera.ResetTranslation(); Figure fig; if (viewer.TryGetFigure(out fig)) { viewer.Camera.SetCenter(fig.Center + fig.Translation); } } if (keysEnabled[keyFigureForm] && keys[keyFigureForm]) { keys[keyFigureForm] = false; keysEnabled[keyFigureForm] = true; // stale KeyUp event figureForm.Show(); figureForm.Activate(); } float keyL = 0.0f; float keyR = 0.0f; float keyU = 0.0f; float keyD = 0.0f; float keyPush = 0.0f; float keyPull = 0.0f; if (keys[(int)Keys.Left]) { keyL = 2.0f; } if (keys[(int)Keys.Right]) { keyR = 2.0f; } if (keys[(int)Keys.PageUp]) { keyU = 2.0f; } if (keys[(int)Keys.PageDown]) { keyD = 2.0f; } if (keys[(int)Keys.Up]) { keyPush = 1.0f; } if (keys[(int)Keys.Down]) { keyPull = 1.0f; } if (Control.ModifierKeys == Keys.Shift) { Figure fig; if (viewer.TryGetFigure(out fig)) { fig.Move(keyR - keyL, keyU - keyD, keyPull - keyPush); } } else { viewer.Camera.Move(keyR - keyL, keyU - keyD, keyPull - keyPush); } }
public void FrameMove() { if (keysEnabled[keySave] && keys[keySave]) { keysEnabled[keySave] = false; viewer.SaveToPng("sample.png"); } if (keysEnabled[keyMotion] && keys[keyMotion]) { keysEnabled[keyMotion] = false; viewer.MotionEnabled = !viewer.MotionEnabled; } if (keysEnabled[keyShadow] && keys[keyShadow]) { keysEnabled[keyShadow] = false; viewer.ShadowShown = !viewer.ShadowShown; } if (keysEnabled[keySprite] && keys[keySprite]) { keysEnabled[keySprite] = false; viewer.SpriteShown = !viewer.SpriteShown; } if (keysEnabled[keyFigure] && keys[keyFigure]) { keysEnabled[keyFigure] = false; viewer.NextFigure(); } if (keysEnabled[keyDelete] && keys[keyDelete]) { keysEnabled[keyDelete] = false; if (keys[(int)Keys.ControlKey]) { viewer.ClearFigureList(); } else { viewer.RemoveSelectedFigure(); } } if (keysEnabled[keyCameraReset] && keys[keyCameraReset]) { keysEnabled[keyCameraReset] = false; viewer.Camera.Reset(); viewer.Camera.SetTranslation(0.0f, +10.0f, +44.0f); } if (keysEnabled[keyCenter] && keys[keyCenter]) { keysEnabled[keyCenter] = false; viewer.Camera.ResetTranslation(); Figure fig; if (viewer.TryGetFigure(out fig)) { viewer.Camera.SetCenter(fig.Center + fig.Translation); } } if (keysEnabled[keyFigureForm] && keys[keyFigureForm]) { keys[keyFigureForm] = false; keysEnabled[keyFigureForm] = true; // stale KeyUp event fig_form.Show(); fig_form.Activate(); } float keyL = 0.0f; float keyR = 0.0f; float keyU = 0.0f; float keyD = 0.0f; float keyPush = 0.0f; float keyPull = 0.0f; float keyZRol = 0.0f; if (keys[(int)Keys.Left]) { keyL = 2.0f; } if (keys[(int)Keys.Right]) { keyR = 2.0f; } if (keys[(int)Keys.PageUp]) { keyU = 2.0f; } if (keys[(int)Keys.PageDown]) { keyD = 2.0f; } if (keys[(int)Keys.Up]) { keyPush = 1.0f; } if (keys[(int)Keys.Down]) { keyPull = 1.0f; } if (keys[(int)Keys.A]) { keyZRol = -2.0f; } if (keys[(int)Keys.D]) { keyZRol = +2.0f; } if (Control.ModifierKeys == Keys.Shift) { Figure fig; if (viewer.TryGetFigure(out fig)) { fig.Move(keyR - keyL, keyU - keyD, keyPull - keyPush); } } else { viewer.Camera.Move(keyR - keyL, keyU - keyD, keyPull - keyPush); viewer.Camera.RotZ(DegreeToRadian(keyZRol)); } }
public void FrameMove() { if (keysEnabled[keySave] && keys[keySave]) { keysEnabled[keySave] = false; viewer.SaveToBitmap("sample.bmp"); } if (keysEnabled[keyMotion] && keys[keyMotion]) { keysEnabled[keyMotion] = false; viewer.SwitchMotionEnabled(); } if (keysEnabled[keyShadow] && keys[keyShadow]) { keysEnabled[keyShadow] = false; viewer.SwitchShadowShown(); } if (keysEnabled[keySprite] && keys[keySprite]) { keysEnabled[keySprite] = false; viewer.SwitchSpriteShown(); } if (keysEnabled[keyFigure] && keys[keyFigure]) { keysEnabled[keyFigure] = false; viewer.NextFigure(); } if (keysEnabled[keyDelete] && keys[keyDelete]) { keysEnabled[keyDelete] = false; if (keys[(int)Keys.ControlKey]) { viewer.ClearFigureList(); } else { viewer.RemoveSelectedFigure(); } } if (keysEnabled[keyCameraReset] && keys[keyCameraReset]) { keysEnabled[keyCameraReset] = false; camera.Reset(); Figure fig; if (viewer.TryGetFigure(out fig)) { camera.SetCenter(fig.Center); } } if (keysEnabled[keyFigureForm] && keys[keyFigureForm]) { keys[keyFigureForm] = false; keysEnabled[keyFigureForm] = true; // stale KeyUp event fig_form.Show(); fig_form.Activate(); } float keyL = 0.0f; float keyR = 0.0f; float keyU = 0.0f; float keyD = 0.0f; float keyPush = 0.0f; float keyPull = 0.0f; float keyZRol = 0.0f; if (keys[(int)Keys.Left]) { keyL = 2.0f; } if (keys[(int)Keys.Right]) { keyR = 2.0f; } if (keys[(int)Keys.PageUp]) { keyU = 2.0f; } if (keys[(int)Keys.PageDown]) { keyD = 2.0f; } if (keys[(int)Keys.Up]) { keyPush = 1.0f; } if (keys[(int)Keys.Down]) { keyPull = 1.0f; } if (keys[(int)Keys.A]) { keyZRol = -2.0f; } if (keys[(int)Keys.D]) { keyZRol = +2.0f; } camera.Move(keyR - keyL, keyU - keyD, keyPull - keyPush); camera.RotZ(DegreeToRadian(keyZRol)); }