// Ready function, called once at the beginning of the scene when all children are ready public override void _Ready() { // Assign required nodes objectBody = GetNode <StaticBody>("ViewportContainer/Viewport/ObjectRoot/Object1"); ray = GetNode <RayCast>("ViewportContainer/Viewport/ObjectRoot/HiddenLineRay"); freeCameraRoot = GetNode <Spatial>("ViewportContainer/Viewport/ObjectRoot/CameraRoot"); orthoCameraRoot = GetNode <Spatial>("ViewportContainer/Viewport/ObjectRoot/OrthoCameraRoot"); // Populate the list of planes with the nodes of each BoxPlaneControl object planes = new Spatial[PLANE_COUNT] { GetNode <Spatial>("ViewportContainer/Viewport/ObjectRoot/FrontPlaneControl"), GetNode <Spatial>("ViewportContainer/Viewport/ObjectRoot/RightPlaneControl"), GetNode <Spatial>("ViewportContainer/Viewport/ObjectRoot/BackPlaneControl"), GetNode <Spatial>("ViewportContainer/Viewport/ObjectRoot/LeftPlaneControl"), GetNode <Spatial>("ViewportContainer/Viewport/ObjectRoot/TopPlaneControl"), GetNode <Spatial>("ViewportContainer/Viewport/ObjectRoot/BottomPlaneControl") }; // All faces are hidden at first isFaceShown = new bool[PLANE_COUNT] { false, false, false, false, false, false }; // Initialize the required static variables in the PlaneControl class PlaneControl.Initialize(objectBody.GetChild <MeshInstance>(0), ray, PlaneControl.ORTHOGRAPHIC); // Set the display size PlaneControl.SetScreenSize(PLANE_X_SCALE, PLANE_Y_SCALE, MAX_FOCUS); // Set the zoom of the PlaneControl class // A zoom value of 1 is set because this scene requires orthographic projection (without scaling to screen size) PlaneControl.SetZoom(MAX_FOCUS); // Set the projection colours ProjectionRoot.SetColours(true, false); }
// Use this for initialization void Awake() { OSCHandler.Instance.Init(); //init OSC projectionRoot = GameObject.Find("MainPlayer").transform.Find("ProjectionRoot").GetComponent<ProjectionRoot>(); //pr2 = GameObject.Find("ERL Controller 2").transform.Find("ProjectionRoot").GetComponent<ProjectionRoot>(); pointerRoot = GameObject.Find("PointerRoot").GetComponent<PointerControl>(); DontDestroyOnLoad(gameObject); }
// Use this for initialization void Awake() { OSCHandler.Instance.Init(); //init OSC projectionRoot = GameObject.Find("MainPlayer").transform.Find("ProjectionRoot").GetComponent <ProjectionRoot>(); //pr2 = GameObject.Find("ERL Controller 2").transform.Find("ProjectionRoot").GetComponent<ProjectionRoot>(); pointerRoot = GameObject.Find("PointerRoot").GetComponent <PointerControl>(); DontDestroyOnLoad(gameObject); }
// Function that is called when the "Switch Colours" slider is toggled // Connected to the "ColoursToggleSlider" slider through the editor public void _on_ColoursToggleSlider_toggled(bool isPressed) { // If enabled, set the projection colours to the high contrast mode, otherwise, set them to regular colours if (isPressed) { ProjectionRoot.SetColours(false, true); } else { ProjectionRoot.SetColours(false, false); } // Update the display Display(); }
// Function that is called when the high contrast mode is changed // Connected to the "ColoursSlider" slider through the editor public void _on_ColoursSlider_toggled(bool isPressed) { // Depending on whether the high contrast mode is enabled, set the projection colours if (isPressed) { ProjectionRoot.SetColours(true, true); } else { ProjectionRoot.SetColours(true, false); } // Update the display UpdatePlanes(); }
// Ready function, called once at the beginning of the scene when all children are ready public override void _Ready() { // Assignment of required nodes // ObjectRoot (root of all 3D nodes) objectRoot = GetNode <Spatial>("HorizontalViewContainer/ObjectViewContainter/ObjectViewport/ObjectRoot"); // PlaneControl Objects topViewPlane = GetNode <Spatial>("HorizontalViewContainer/ObjectViewContainter/ObjectViewport/ObjectRoot/TopViewPlane"); frontViewPlane = GetNode <Spatial>("HorizontalViewContainer/ObjectViewContainter/ObjectViewport/ObjectRoot/FrontViewPlane"); sideViewPlane = GetNode <Spatial>("HorizontalViewContainer/ObjectViewContainter/ObjectViewport/ObjectRoot/RightViewPlane"); auxiliaryViewPlane = GetNode <Spatial>("HorizontalViewContainer/ObjectViewContainter/ObjectViewport/ObjectRoot/AuxiliaryViewPlane"); // ProjectionRoot Objects mainDisplayRoot = GetNode <Node2D>("HorizontalViewContainer/MainProjectionDisplayContainer/MainProjectionViewport/ProjectionRoot"); topViewRoot = GetNode <Node2D>("HorizontalViewContainer/MainProjectionDisplayContainer/ViewGridContainer/TopViewportContainer/TopViewport/TopViewRoot"); frontViewRoot = GetNode <Node2D>("HorizontalViewContainer/MainProjectionDisplayContainer/ViewGridContainer/FrontViewportContainer/FrontViewport/FrontViewRoot"); sideViewRoot = GetNode <Node2D>("HorizontalViewContainer/MainProjectionDisplayContainer/ViewGridContainer/SideViewportContainer/SideViewport/SideViewRoot"); auxiliaryViewRoot = GetNode <Node2D>("HorizontalViewContainer/MainProjectionDisplayContainer/ViewGridContainer/AuxiliaryViewportContainer/AuxiliaryViewport/AuxiliaryViewRoot"); // UI Control Nodes ControlsNode = GetNode <Control>("HorizontalViewContainer/ObjectViewContainter/ObjectViewport/Controls"); FocusZoomSlider = GetNode <HSlider>("HorizontalViewContainer/ObjectViewContainter/ObjectViewport/Controls/ControlsPanel/ViewControl/FocusZoomSlider"); ObjectXDegSlider = GetNode <HSlider>("HorizontalViewContainer/ObjectViewContainter/ObjectViewport/Controls/ControlsPanel/ObjectControl/HBoxContainer/SlidersVBoxContainer/ObjectXDegSlider"); ObjectYDegSlider = GetNode <HSlider>("HorizontalViewContainer/ObjectViewContainter/ObjectViewport/Controls/ControlsPanel/ObjectControl/HBoxContainer/SlidersVBoxContainer/ObjectYDegSlider"); ObjectZDegSlider = GetNode <HSlider>("HorizontalViewContainer/ObjectViewContainter/ObjectViewport/Controls/ControlsPanel/ObjectControl/HBoxContainer/SlidersVBoxContainer/ObjectZDegSlider"); viewList = GetNode <OptionButton>("HorizontalViewContainer/ObjectViewContainter/ObjectViewport/Controls/ControlsPanel/ViewControl/ViewSelectList"); viewGrid = GetNode <GridContainer>("HorizontalViewContainer/MainProjectionDisplayContainer/ViewGridContainer"); // RayCast Node ray = GetNode <RayCast>("HorizontalViewContainer/ObjectViewContainter/ObjectViewport/ObjectRoot/HiddenLineRayCast"); // Populate the objects array with the required NodePaths for (int index = 0; index < OBJECT_COUNT; index++) { objects[index] = objectRoot.GetChild <StaticBody>(index + FIRST_OBJECT_INDEX).GetPath(); } // The second object is initially selected currentObjectIndex = 1; // Get the object's static body from the selected NodePath in the objects array objectBody = GetNode <StaticBody>(objects[currentObjectIndex]); // Initialize the required static variables in the PlaneControl class PlaneControl.Initialize(objectBody.GetChild <MeshInstance>(0), ray, PlaneControl.ORTHOGRAPHIC); // Set the screen size so that the projection is properly scaled PlaneControl.SetScreenSize(LARGE_PLANE_X_SCALE, LARGE_PLANE_Y_SCALE, MAX_FOCUS); // Set the zoom value of the PlaneControl class according to the focus/zoom slider's value PlaneControl.SetZoom((float)FocusZoomSlider.Value); // Set the colours that the projection is to be displayed in, by specifying whether the projection is on the cube, and whether the colours have been switched ProjectionRoot.SetColours(false, false); // Auxiliary view is disabled at first isAuxEnabled = false; // Set the display nodes and display onto the screen SetDisplay(); Display(); }