public TestWindowNode(DemoElements elementEnum, HudParentBase parent = null) : base(parent) { this.elementEnum = elementEnum; cameraNode = new CamSpaceNode(this); window = GetTestWindow(elementEnum); window.Register(cameraNode); }
protected override void HandleInput(Vector2 cursorPos) { // Update matrix transform based on input if (instanceList.Selection != null) { CamSpaceNode node = instanceList.Selection.AssocMember.cameraNode; // Scale node.IsScreenSpace = screenSpaceToggle.IsBoxChecked; node.UseResScaling = resScaleToggle.IsBoxChecked; node.PlaneScale = scaleBar.Current; // Rotation node.RotationAxis = new Vector3(xAxisBar.Current, yAxisBar.Current, zAxisBar.Current); node.RotationAngle = angleBar.Current; // Translation node.TransformOffset = new Vector3D(xPosBar.Current, yPosBar.Current, zPosBar.Current); } }
/// <summary> /// Updates UI to match the configuration of the node just selected /// </summary> private void UpdateSelection(object sender, EventArgs args) { if (instanceList.Selection != null) { CamSpaceNode node = instanceList.Selection.AssocMember.cameraNode; // Scale screenSpaceToggle.IsBoxChecked = node.IsScreenSpace; resScaleToggle.IsBoxChecked = node.UseResScaling; scaleBar.Current = (float)node.PlaneScale; // Rotation angleBar.Current = node.RotationAngle; xAxisBar.Current = node.RotationAxis.X; yAxisBar.Current = node.RotationAxis.Y; zAxisBar.Current = node.RotationAxis.Z; // Translation xPosBar.Current = (float)node.TransformOffset.X; yPosBar.Current = (float)node.TransformOffset.Y; zPosBar.Current = (float)node.TransformOffset.Z; } }