コード例 #1
0
 public SceneViewWindow(SceneViewController controller, CameraMover cameraMover, String name, BackgroundScene background, int zIndexStart)
 {
     this.zIndexStart      = zIndexStart;
     this.background       = background;
     this.controller       = controller;
     this.cameraMover      = cameraMover;
     this.name             = name;
     this.startPosition    = cameraMover.Translation;
     this.startLookAt      = cameraMover.LookAt;
     transparencyStateName = name;
     NearPlaneWorld        = 230;
     NearFarLength         = 450;
     MinNearDistance       = 1;
 }
コード例 #2
0
        public TextureSceneView(SceneViewController controller, CameraMover cameraMover, String name, BackgroundScene background, int zIndexStart, int width, int height)
            : base(controller, cameraMover, name, background, zIndexStart)
        {
            resourceLoader   = new ManualResourceLoader(this);
            this.TextureName = name;
            texture          = TextureManager.getInstance().createManual(name, MyGUIInterface.Instance.CommonResourceGroup.FullName, TextureType.TEX_TYPE_2D, (uint)width, (uint)height, 1, 0, ogreTextureFormat, TextureUsage.TU_RENDERTARGET, resourceLoader, false, 0);

            pixelBuffer          = texture.Value.getBuffer();
            renderTexture        = pixelBuffer.Value.getRenderTarget();
            this.RenderingEnded += TextureSceneView_RenderingEnded;

            rendererWindow       = new ManualWindow(renderTexture);
            this.RendererWindow  = rendererWindow;
            this.ClearEveryFrame = true;

            this.BackColor = new Engine.Color(0, 0, 0, 0);
        }
コード例 #3
0
        void processInputEvents(EventLayer eventLayer)
        {
            if (currentGesture == Gesture.None)
            {
                SceneViewWindow activeWindow = sceneViewController.ActiveWindow;
                if (activeWindow != null && eventLayer.EventProcessingAllowed)
                {
                    CameraMover cameraMover = activeWindow.CameraMover;
                    if (cameraMover.AllowManualMovement)
                    {
                        IntVector3 mouseCoords = eventLayer.Mouse.AbsolutePosition;

                        if (MoveCamera.FirstFrameDown)
                        {
                            eventLayer.makeFocusLayer();
                            currentlyInMotion = true;
                            eventLayer.alertEventsHandled();
                            if (mouseUndoPosition == null)
                            {
                                mouseUndoPosition = activeWindow.createCameraPosition();
                            }
                        }
                        else if (MoveCamera.FirstFrameUp)
                        {
                            eventLayer.clearFocusLayer();
                            currentlyInMotion = false;

                            if (mouseUndoPosition != null)
                            {
                                activeWindow.pushUndoState(mouseUndoPosition);
                                mouseUndoPosition = null;
                            }
                        }
                        mouseCoords = eventLayer.Mouse.RelativePosition;
                        if (currentlyInMotion)
                        {
                            int x = mouseCoords.x;
                            int y = mouseCoords.y;
                            switch (movementMode)
                            {
                            case CameraMovementMode.Rotate:
                                if (cameraMover.AllowRotation)
                                {
                                    travelTracker.traveled(mouseCoords);
                                    if (LockX.Down)
                                    {
                                        x = 0;
                                    }
                                    if (LockY.Down)
                                    {
                                        y = 0;
                                    }
                                    cameraMover.rotateFromMotion(x, y);
                                    eventLayer.alertEventsHandled();
                                }
                                break;

                            case CameraMovementMode.Pan:
                                travelTracker.traveled(mouseCoords);
                                if (LockX.Down)
                                {
                                    x = 0;
                                }
                                if (LockY.Down)
                                {
                                    y = 0;
                                }
                                cameraMover.panFromMotion(x, y, eventLayer.Mouse.AreaWidth, eventLayer.Mouse.AreaHeight);
                                eventLayer.alertEventsHandled();
                                break;

                            case CameraMovementMode.Zoom:
                                if (cameraMover.AllowZoom)
                                {
                                    travelTracker.traveled(mouseCoords);
                                    cameraMover.zoomFromMotion(mouseCoords.y);
                                    eventLayer.alertEventsHandled();
                                }
                                break;
                            }
                        }
                        if (cameraMover.AllowZoom)
                        {
                            if (ZoomInCamera.Down)
                            {
                                if (mouseUndoPosition == null)
                                {
                                    mouseUndoPosition = activeWindow.createCameraPosition();
                                }
                                mouseWheelTimer.Stop();
                                mouseWheelTimer.Start();
                                cameraMover.incrementZoom(-1);
                                eventLayer.alertEventsHandled();
                            }
                            else if (ZoomOutCamera.Down)
                            {
                                if (mouseUndoPosition == null)
                                {
                                    mouseUndoPosition = activeWindow.createCameraPosition();
                                }
                                mouseWheelTimer.Stop();
                                mouseWheelTimer.Start();
                                cameraMover.incrementZoom(1);
                                eventLayer.alertEventsHandled();
                            }
                        }
                    }
                }
            }
        }
コード例 #4
0
        public MDISceneViewWindow(RendererWindow rendererWindow, SceneViewController controller, CameraMover cameraMover, String name, BackgroundScene background, int zIndexStart)
            : base(controller, cameraMover, name, background, zIndexStart)
        {
            this.createBackground(((OgreWindow)PluginManager.Instance.RendererPlugin.PrimaryWindow).OgreRenderTarget, false);

            //MDI Window
            mdiWindow = new MDIDocumentWindow(Name);
            mdiWindow.AllowedDockLocations = DockLocation.Center;
            mdiWindow.SuppressLayout       = true;
            mdiWindow.Content              = this;
            mdiWindow.SuppressLayout       = false;
            mdiWindow.Caption              = Name;
            mdiWindow.Closed              += new EventHandler(mdiWindow_Closed);
            mdiWindow.ActiveStatusChanged += new EventHandler(mdiWindow_ActiveStatusChanged);

            PrimaryActionSelect.FirstFrameDownEvent   += selectEvent;
            SecondaryActionSelect.FirstFrameDownEvent += selectEvent;

            this.RendererWindow = rendererWindow;
        }
コード例 #5
0
        public SingleViewCloneWindow(NativeOSWindow parentWindow, WindowInfo windowInfo, SceneViewController controller, CameraMover cameraMover, String name, BackgroundScene background, int zIndexStart, bool floatOnParent)
            : base(controller, cameraMover, name, background, zIndexStart)
        {
            IntVector2 location = SystemInfo.getDisplayLocation(windowInfo.MonitorIndex);

            location.y          = -1;
            osWindow            = new NativeOSWindow(parentWindow, "Clone Window", location, new IntSize2(windowInfo.Width, windowInfo.Height), floatOnParent);
            this.rendererWindow = (OgreWindow)OgreInterface.Instance.createRendererWindow(new WindowInfo(osWindow, "CloneWindow"));
            this.createBackground(rendererWindow.OgreRenderTarget, true);
            this.RendererWindow = rendererWindow;
            osWindow.show();
            osWindow.Closed += osWindow_Closed;

            transparencyStateName           = controller.ActiveWindow.CurrentTransparencyState;
            controller.ActiveWindowChanged += controller_ActiveWindowChanged;
        }