private void OnBackgroundRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if ((e.Cancelled)) { } else if (e.Error != null) { } else { Trackball trackball = new Trackball(); trackball.EventSource = previewImageGrid; viewport.Camera.Transform = trackball.Transform; //FlyMotionController flyMotionController = new FlyMotionController(); //flyMotionController.EventSource = previewImageGrid; //viewport.Camera.Transform = flyMotionController.Transform; previewImageGrid.MouseMove += OnViewportGridMouseMove; if (START_ORBIT) { m_timer.Start(); } } }
private void Trackball_3DTools_Initialisation() { //Trackball_3DTools initialisation: Trackball_3DTools = new Trackball(); Trackball_3DTools.EventSource = mainViewport; this.mainViewport.Camera.Transform = Trackball_3DTools.Transform; }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { _track = new Trackball(); _track.Attach(this); _track.Slaves.Add((Viewport3D)this.FindName("myViewport")); _track.Enabled = true; }
public Form1() { InitializeComponent(); // Form params: string param; bool useTexture, globalColor, useNormals, usePtSize; string name; MouseButtons trackballButton; InitParams(out param, out tooltip, out name, out trackballButton, out center, out diameter, out useTexture, out globalColor, out useNormals, out usePtSize); checkTexture.Checked = useTexture; checkGlobalColor.Checked = globalColor; checkNormals.Checked = useNormals; checkPointSize.Checked = usePtSize; textParam.Text = param ?? ""; Text += " (" + rev + ") '" + name + '\''; SetLightEye(center, diameter); // Trackball: tb = new Trackball(center, diameter); tb.Button = trackballButton; InitShaderRepository(); }
public Form1() { InitializeComponent(); // I'm going to merge init data from Construction and AnimatedCamera. string cparam; string cname; string ctooltip; Construction.InitParams(out cname, out cparam, out ctooltip); string mparam; string mname; string mtooltip; AnimatedCamera.InitParams(out mname, out mparam, out mtooltip); tooltip = ctooltip + '\n' + mtooltip; textParam.Text = cparam + ", " + mparam; Text += " (" + rev + ") '" + cname + ',' + mname + '\''; // Default = Trackball. cam = tb = new Trackball(center, diameter); camera = new AnimatedCamera(textParam.Text); InitShaderRepository(); }
public Form1() { InitializeComponent(); string param; string name; bool useTexture, globalColor, useNormals, useWireframe, useMT; InitParams(out name, out param, out tooltip, out center, out diameter, out useTexture, out globalColor, out useNormals, out useWireframe, out useMT); checkTexture.Checked = useTexture; checkGlobalColor.Checked = globalColor; checkNormals.Checked = useNormals; checkWireframe.Checked = useWireframe; checkMultithread.Checked = useMT; textParam.Text = param ?? ""; Text += " (" + rev + ") '" + name + '\''; // Trackball. tb = new Trackball(center, diameter); tb.Button = MouseButtons.Left; OGL = new OpenglState(this, glControl1); OGL.InitShaderRepository(); }
public Form1() { InitializeComponent(); form = this; string param; string userTooltip; string name; string expr; MouseButtons trackballButton; Graph.InitParams(out param, out userTooltip, out expr, out name, out trackballButton); textParam.Text = param ?? ""; tooltip = "minZoom=<float>,maxZoom=<float>,zoom=<float>,perspective=<bool>,fov=<degrees>,backgr=<color>,light=<vector3>,color=<color>,Ka=<float>,shininess=<float>"; if (!string.IsNullOrEmpty(userTooltip)) { tooltip = tooltip + '\r' + userTooltip; } textExpression.Text = expr; Text += " (" + rev + ") '" + name + '\''; // Trackball. tb = new Trackball(gr.center, gr.diameter); tb.Button = trackballButton; }
public void Copy(Trackball trackball) { m_LongClickSeconds = trackball.m_LongClickSeconds; ScreenToWorld = trackball.ScreenToWorld; ScreenDensity = trackball.ScreenDensity; TouchSlop = trackball.TouchSlop; MaxScale = trackball.MaxScale; }
private void OnLoaded(object sender, EventArgs e) { // setup trackball for moving the model around _trackball = new Trackball(); _trackball.Attach(this); _trackball.Slaves.Add(myViewport3D); _trackball.Enabled = true; }
public override void RotateWithEvent(NSEvent theEvent) { base.RotateWithEvent(theEvent); var r = SCNQuaternion.FromAxisAngle(new SCNVector3(0, 0, 1), -theEvent.Rotation / 180); r.Normalize(); Trackball.Rotate(r); }
public override void MagnifyWithEvent(NSEvent theEvent) { base.MagnifyWithEvent(theEvent); var magnification = theEvent.Magnification; var zoom = new SCNVector3(magnification, magnification, magnification); Trackball.Zoom(zoom); }
public void Trackball_Test1() { // // TODO: Add test logic here // Vector3D v = new Vector3D(1, 1, 1); Trackball.RotateTheVector3D(v, 1, 1, 2, 2); }
public CubeControl() { InitializeComponent(); _trackball = new Trackball(); _trackball.Attach(this); _trackball.Slaves.Add(myViewport3D); _trackball.Enabled = true; BeginStoryboard((Storyboard)FindResource("RotateStoryboard")); }
private void GraphScene3D(Canvas screenCanvas, String eqX, String eqY, String eqZ) { // We do this so we can get good error information. // The values return by these calls are ignored. FunctionParser.Parse(eqX); FunctionParser.Parse(eqY); FunctionParser.Parse(eqZ); PerspectiveCamera camera = new PerspectiveCamera(); camera.Position = new Point3D(0, 0, 5); camera.LookDirection = new Vector3D(0, 0, -2); camera.UpDirection = new Vector3D(0, 1, 0); camera.NearPlaneDistance = 1; camera.FarPlaneDistance = 100; camera.FieldOfView = 45; Model3DGroup group = null; group = new Model3DGroup(); FunctionMesh mesh = new FunctionMesh(eqX, eqY, eqZ, UMin, UMax, VMin, VMax); group.Children.Add(new GeometryModel3D(mesh.CreateMesh(UGrid + 1, VGrid + 1), new DiffuseMaterial(Brushes.Blue))); group.Children.Add(new DirectionalLight(Colors.White, new Vector3D(-1, -1, -1))); Viewport3D viewport = new Viewport3D(); //<newcode> ModelVisual3D sceneVisual = new ModelVisual3D(); sceneVisual.Content = group; viewport.Children.Clear(); viewport.Children.Add(sceneVisual); //</newcode> //viewport.Models = group; viewport.Camera = camera; viewport.Width = CanvasWidth; viewport.Height = CanvasHeight; viewport.ClipToBounds = true; screenCanvas.Children.Clear(); screenCanvas.Children.Add(viewport); _tb = new Trackball(); _tb.Attach(screenCanvas); _tb.Enabled = true; _tb.Servants.Add(viewport); screenCanvas.IsVisibleChanged += new DependencyPropertyChangedEventHandler(screenCanvas_IsVisibleChanged); }
public override void MouseDragged(NSEvent theEvent) { if (theEvent.ModifierFlags.HasFlag(NSEventModifierMask.CommandKeyMask)) { Trackball.DragZoom(ConvertPointFromView(theEvent.LocationInWindow, null), (float)Frame.Width, (float)Frame.Height); } else { Trackball.DragRotate(ConvertPointFromView(theEvent.LocationInWindow, null), (float)Frame.Width, (float)Frame.Height); } base.MouseDragged(theEvent); isDragging = true; }
public override void KeyDown(NSEvent theEvent) { switch (theEvent.KeyCode) { case (ushort)NSKey.UpArrow when theEvent.ModifierFlags.HasFlag(NSEventModifierMask.ShiftKeyMask): Trackball.PanUp(); break; case (ushort)NSKey.DownArrow when theEvent.ModifierFlags.HasFlag(NSEventModifierMask.ShiftKeyMask): Trackball.PanDown(); break; case (ushort)NSKey.LeftArrow when theEvent.ModifierFlags.HasFlag(NSEventModifierMask.ShiftKeyMask): Trackball.PanLeft(); break; case (ushort)NSKey.RightArrow when theEvent.ModifierFlags.HasFlag(NSEventModifierMask.ShiftKeyMask): Trackball.PanRight(); break; case (ushort)NSKey.UpArrow: Trackball.RotateUp(); break; case (ushort)NSKey.DownArrow: Trackball.RotateDown(); break; case (ushort)NSKey.LeftArrow: Trackball.RotateLeft(); break; case (ushort)NSKey.RightArrow: Trackball.RotateRight(); break; case (ushort)NSKey.Escape: Trackball.Reset(); break; default: base.KeyDown(theEvent); break; } }
public Form1() { InitializeComponent(); string param; string name; InitParams(out name, out param, out tooltip, out center, out diameter); textParam.Text = param ?? ""; Text += " (" + rev + ") '" + name + '\''; // Trackball. tb = new Trackball(center, diameter); tb.Button = MouseButtons.Left; }
private void OnBackgroundRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if ((e.Cancelled)) { } else if (e.Error != null) { } else { Trackball trackball = new Trackball(); trackball.EventSource = previewImageGrid; viewport.Camera.Transform = trackball.Transform; } }
public MainWindow() { InitializeComponent(); //// Kinectが接続されているかどうかを確認する //if ( KinectSensor.KinectSensors.Count == 0 ) { // throw new Exception( "Kinectを接続してください" ); //} //// Kinectの動作を開始する //StartKinect( KinectSensor.KinectSensors[0] ); _trackball = new Trackball(); _trackball.Attach(this); _trackball.Slaves.Add(myViewport3D); _trackball.Enabled = true; }
public override void ScrollWheel(NSEvent theEvent) { base.ScrollWheel(theEvent); if (theEvent.ModifierFlags.HasFlag(NSEventModifierMask.CommandKeyMask)) { float zoom = -(float)(theEvent.ScrollingDeltaY / Frame.Height); Trackball.Zoom(new SCNVector3(zoom, zoom, zoom)); } else { Trackball.Pan(new Vector3( (float)(theEvent.ScrollingDeltaX / Frame.Width), (float)(-theEvent.ScrollingDeltaY / Frame.Height), 0)); } }
/// <summary> /// Standard constructor of MainWindow /// </summary> public MainWindow() { InitializeComponent(); buffer = new BufferClass(); this.Background = buffer.getBackgroundBrush(); // Sets the background getBuildingSurfaces(); // Build the roofs of the buildings getBuildingWalls(); // Build the walls of the buildings getLanduseSurfaces(); // Build the landuses getGrassSurface(); getCameraAndLight(); // Set up the camera and the light (same direction) // Set up the trackball (rotate, zoom and translate the camera) // This class is downloaded from: http://3dtools.codeplex.com/SourceControl/latest#3DTools/3DTools/Trackball.cs var trackball = new Trackball(); trackball.EventSource = viewportGrid; myViewport3D.Camera.Transform = trackball.Transform; }
public Form1() { InitializeComponent(); form = this; string param; string name; string expr; MouseButtons trackballButton; Graph.InitParams(out param, out tooltip, out expr, out name, out trackballButton); textParam.Text = param ?? ""; textExpression.Text = expr; Text += " (" + rev + ") '" + name + '\''; // Trackball: tb = new Trackball(center, diameter); tb.Button = trackballButton; // Graph object: gr = new Graph(); }
private void OnLoaded(object sender, EventArgs e) { // setup trackball for moving the model around _trackball = new Trackball(); _trackball.Attach(this); _trackball.Servants.Add(myViewport3D); _trackball.Enabled = true; // Get the mesh objects for changing the material ModelVisual3D mv3d = myViewport3D.Children[0] as ModelVisual3D; Model3DGroup m3dgBase = mv3d.Content as Model3DGroup; Model3DGroup m3dg = m3dgBase.Children[0] as Model3DGroup; _TopPlane = m3dg.Children[2] as GeometryModel3D; _BottomPlane = m3dg.Children[3] as GeometryModel3D; m3dg = m3dgBase.Children[1] as Model3DGroup; _FrontSpinPlane = m3dg.Children[0] as GeometryModel3D; _BackSpinPlane = m3dg.Children[1] as GeometryModel3D; AnimateToNextPicture(); }
public Form1() { InitializeComponent(); // Form params: string param; bool useTexture, globalColor, useNormals, usePtSize; Vector3 center; float diameter; InitParams(out param, out center, out diameter, out useTexture, out globalColor, out useNormals, out usePtSize); checkTexture.Checked = useTexture; checkGlobalColor.Checked = globalColor; checkNormals.Checked = useNormals; checkPointSize.Checked = usePtSize; textParam.Text = param ?? ""; Text += " (rev: " + rev + ')'; SetLightEye(center, diameter); // Trackball: tb = new Trackball(center, diameter); InitShaderRepository(); }
public Form1() { InitializeComponent(); string param; string branch; Program.InitParams(out param, out branch); textParam.Text = param ?? ""; Text += " (" + rev + ") '" + branch + '\''; // Trackball: tb = new Trackball(center, diameter); InitShaderRepository(); //Set the timer tick event timer.Interval = 4000; timer.Tick += delegate { label_percentageReport.Text = String.Empty; timer.Stop(); }; }
public void InitFromIniFile(string iniFilepath) { var ini = IniFile.FromFile(iniFilepath); this.MainSection = new Main(); this.ResolutionSection = new Resolution(); this.IntroVideoSection = new IntroVideo(); this.SoundSection = new Sound(); this.AttractModeSection = new AttractMode(); this.KeyboardSection = new Keyboard(); this.LEDBlinkySection = new LEDBlinky(); this.HiScoreSection = new HiScore(); this.StartupProgramSection = new StartupProgram(); this.ExitProgramSection = new ExitProgram(); this.OptimizerSection = new Optimizer(); this.P1ControlsSection = new P1Controls(); this.P2ControlsSection = new P2Controls(); this.P1JoystickSection = new P1Joystick(); this.P2JoystickSection = new P2Joystick(); this.TrackballSection = new Trackball(); this.SpinnerSection = new Spinner(); InitSections(ini, this.MainSection, this.ResolutionSection, this.IntroVideoSection, this.SoundSection, this.AttractModeSection, this.KeyboardSection , this.LEDBlinkySection, this.HiScoreSection, this.StartupProgramSection, this.ExitProgramSection, this.OptimizerSection, this.P1ControlsSection, this.P2ControlsSection , this.P1JoystickSection, this.P2JoystickSection, this.TrackballSection, this.SpinnerSection); }
public VectorViewer() { InitializeComponent(); Trackball trackball = new Trackball { EventSource = border }; viewport.Camera.Transform = trackball.Transform; viewport.Children.Add(line); XY.Children.Add(xyline); XZ.Children.Add(xzline); YZ.Children.Add(yzline); line.Thickness = 2; line.Color = Colors.Green; xyline.Thickness = 2; xyline.Color = Colors.Green; xzline.Thickness = 2; xzline.Color = Colors.Green; yzline.Thickness = 2; yzline.Color = Colors.Green; viewport.Children.Add(rotline); XY.Children.Add(xyrotline); XZ.Children.Add(xzrotline); YZ.Children.Add(yzrotline); rotline.Thickness = 2; rotline.Color = Colors.Red; xyrotline.Thickness = 2; xyrotline.Color = Colors.Red; xzrotline.Thickness = 2; xzrotline.Color = Colors.Red; yzrotline.Thickness = 2; yzrotline.Color = Colors.Red; axis = Axis.VE_Axis_Default; xAxis.ItemsSource = Enum.GetNames(typeof(AxisAlignment)); yAxis.ItemsSource = Enum.GetNames(typeof(AxisAlignment)); zAxis.ItemsSource = Enum.GetNames(typeof(AxisAlignment)); /* * vol.Points.Add(new Point3D(100, 100, -100)); * vol.Points.Add(new Point3D(100, -100, -100)); * * vol.Points.Add(new Point3D(100, -100, -100)); * vol.Points.Add(new Point3D(-100, -100, -100)); * * vol.Points.Add(new Point3D(-100, -100, -100)); * vol.Points.Add(new Point3D(-100, 100, -100)); * * vol.Points.Add(new Point3D(-100, 100, -100)); * vol.Points.Add(new Point3D(100, 100, -100)); * * vol.Points.Add(new Point3D(100, 100, 100)); * vol.Points.Add(new Point3D(100, -100, 100)); * * vol.Points.Add(new Point3D(100, -100, 100)); * vol.Points.Add(new Point3D(-100, -100, 100)); * * vol.Points.Add(new Point3D(-100, -100, 100)); * vol.Points.Add(new Point3D(-100, 100, 100)); * * vol.Points.Add(new Point3D(-100, 100, 100)); * vol.Points.Add(new Point3D(100, 100, 100)); * * vol.Points.Add(new Point3D(100, 100, 100)); * vol.Points.Add(new Point3D(100, 100, -100)); * * vol.Points.Add(new Point3D(-100, -100, 100)); * vol.Points.Add(new Point3D(-100, -100, -100)); * * vol.Points.Add(new Point3D(100, -100, 100)); * vol.Points.Add(new Point3D(100, -100, -100)); * * vol.Points.Add(new Point3D(-100, 100, 100)); * vol.Points.Add(new Point3D(-100, 100, -100)); * * vol.Thickness = 1; * vol.Color = Colors.Gray; * viewport.Children.Add(vol); */ xAxis.SelectedItem = axis.X.ToString(); yAxis.SelectedItem = axis.Y.ToString(); zAxis.SelectedItem = axis.Z.ToString(); Draw(null, null); }
public InputHandler() { InitializeComponent(); _trackball = new Trackball(); }
private void GraphScene3D(Canvas screenCanvas,String eqX, String eqY, String eqZ) { // We do this so we can get good error information. // The values return by these calls are ignored. FunctionParser.Parse(eqX); FunctionParser.Parse(eqY); FunctionParser.Parse(eqZ); PerspectiveCamera camera = new PerspectiveCamera(); camera.Position = new Point3D(0, 0, 5); camera.LookDirection = new Vector3D(0, 0, -2); camera.UpDirection = new Vector3D(0, 1, 0); camera.NearPlaneDistance = 1; camera.FarPlaneDistance = 100; camera.FieldOfView = 45; Model3DGroup group = null; group = new Model3DGroup(); FunctionMesh mesh = new FunctionMesh(eqX, eqY, eqZ, UMin, UMax, VMin, VMax); group.Children.Add(new GeometryModel3D(mesh.CreateMesh(UGrid + 1, VGrid + 1), new DiffuseMaterial(Brushes.Blue))); group.Children.Add(new DirectionalLight(Colors.White, new Vector3D(-1, -1, -1))); Viewport3D viewport = new Viewport3D(); //<newcode> ModelVisual3D sceneVisual = new ModelVisual3D(); sceneVisual.Content = group; viewport.Children.Clear(); viewport.Children.Add(sceneVisual); //</newcode> //viewport.Models = group; viewport.Camera = camera; viewport.Width = CanvasWidth; viewport.Height = CanvasHeight; viewport.ClipToBounds = true; screenCanvas.Children.Clear(); screenCanvas.Children.Add(viewport); _tb = new Trackball(); _tb.Attach(screenCanvas); _tb.Enabled = true; _tb.Servants.Add(viewport); screenCanvas.IsVisibleChanged += new DependencyPropertyChangedEventHandler(screenCanvas_IsVisibleChanged); }
public ViewControlCamera3D() { this.InitializeComponent(); _trackBall = new Trackball(); }
private void OnLoaded(object sender, EventArgs args) { immediate.Focus(); viewport = new Viewport3D(); trackball = new Trackball(); trackball.Servants.Add(viewport); trackball.Attach(screen); trackball.Enabled = true; graphNone.Header = Settings.functionNone; graph.Header = Settings.function; graph2D.Header = Settings.function2D; graph3D.Header = Settings.function3D; graphOptions.Header = Settings.function; graphOptions2D.Header = Settings.function2D; graphOptions3D.Header = Settings.function3D; // Workaround for registry bug (key base must exist before getting values - else default won't work) Registry.SetValue(regSaveBase, "Version", "GraphCalc v.1.0", RegistryValueKind.String); xMin.Text = (string)Registry.GetValue(regSaveBase, Settings.xMinReg, Settings.xMinDefault); xMax.Text = (string)Registry.GetValue(regSaveBase, Settings.xMaxReg, Settings.xMaxDefault); yMin.Text = (string)Registry.GetValue(regSaveBase, Settings.yMinReg, Settings.yMinDefault); yMax.Text = (string)Registry.GetValue(regSaveBase, Settings.yMaxReg, Settings.yMaxDefault); xMinLabel.Text = Settings.xMin; xMaxLabel.Text = Settings.xMax; yMinLabel.Text = Settings.yMin; yMaxLabel.Text = Settings.yMax; xMin2D.Text = (string)Registry.GetValue(regSaveBase, Settings.xMin2DReg, Settings.xMin2DDefault); xMax2D.Text = (string)Registry.GetValue(regSaveBase, Settings.xMax2DReg, Settings.xMax2DDefault); yMin2D.Text = (string)Registry.GetValue(regSaveBase, Settings.yMin2DReg, Settings.yMin2DDefault); yMax2D.Text = (string)Registry.GetValue(regSaveBase, Settings.yMax2DReg, Settings.yMax2DDefault); tMin2D.Text = (string)Registry.GetValue(regSaveBase, Settings.tMin2DReg, Settings.tMin2DDefault); tMax2D.Text = (string)Registry.GetValue(regSaveBase, Settings.tMax2DReg, Settings.tMax2DDefault); tStep2D.Text = (string)Registry.GetValue(regSaveBase, Settings.tStep2DReg, Settings.tStep2DDefault); xMin2DLabel.Text = Settings.xMin2D; xMax2DLabel.Text = Settings.xMax2D; yMin2DLabel.Text = Settings.yMin2D; yMax2DLabel.Text = Settings.yMax2D; tMin2DLabel.Text = Settings.tMin2D; tMax2DLabel.Text = Settings.tMax2D; tStep2DLabel.Text = Settings.tStep2D; uMin.Text = (string)Registry.GetValue(regSaveBase, Settings.uMinReg, Settings.uMinDefault); uMax.Text = (string)Registry.GetValue(regSaveBase, Settings.uMaxReg, Settings.uMaxDefault); uGrid.Text = (string)Registry.GetValue(regSaveBase, Settings.uGridReg, Settings.uGridDefault); vMin.Text = (string)Registry.GetValue(regSaveBase, Settings.vMinReg, Settings.vMinDefault); vMax.Text = (string)Registry.GetValue(regSaveBase, Settings.vMaxReg, Settings.vMaxDefault); vGrid.Text = (string)Registry.GetValue(regSaveBase, Settings.vGridReg, Settings.vGridDefault); uMinLabel.Text = Settings.uMin; uMaxLabel.Text = Settings.uMax; uGridLabel.Text = Settings.uGrid; vMinLabel.Text = Settings.vMin; vMaxLabel.Text = Settings.vMax; vGridLabel.Text = Settings.vGrid; y.Text = (string)Registry.GetValue(regSaveBase, Settings.yReg, Settings.yDefault); xt.Text = (string)Registry.GetValue(regSaveBase, Settings.xtReg, Settings.xtDefault); yt.Text = (string)Registry.GetValue(regSaveBase, Settings.ytReg, Settings.ytDefault); fx.Text = (string)Registry.GetValue(regSaveBase, Settings.fxReg, Settings.fxDefault); fy.Text = (string)Registry.GetValue(regSaveBase, Settings.fyReg, Settings.fyDefault); fz.Text = (string)Registry.GetValue(regSaveBase, Settings.fzReg, Settings.fzDefault); yLabel.Text = Settings.y; xtLabel.Text = Settings.xt; ytLabel.Text = Settings.yt; fxLabel.Text = Settings.fx; fyLabel.Text = Settings.fy; fzLabel.Text = Settings.fz; }
public MeshView() { InitializeComponent(); ball = new Trackball(this.Width * 1.0, this.Height * 1.0); }