public void Initialize() { Camera cam = Engine.Instance.SceneManager.AddCamera(new vector3df(0, 5, -10), new vector3df(0, 0, 0), new vector3df(0, 1, 0), 0.5f, 2400.0f, (float)Math.PI / 4.0f); Engine.Instance.ManualMeshServices.AddGridMesh("$grid10", 10, 1, new SColor(128, 128, 128)); gridSceneNode = Engine.Instance.SceneManager.AddMeshSceneNode("$grid10", null); coordSceneNode = Engine.Instance.SceneManager.AddCoordSceneNode(); coordSceneNode.SetPosition2D(E_POSITION_2D.EP2D_BOTTOMLEFT, 18); coordSceneNode.SetAxisText("x", "y", "z"); }
public void Initialize() { Engine.Instance.ManualMeshServices.AddGridMesh("$grid20", 20, 1, new SColor(128, 128, 128)); gridSceneNode = Engine.Instance.SceneManager.AddMeshSceneNode("$grid20", null); coordSceneNode = Engine.Instance.SceneManager.AddCoordSceneNode(); coordSceneNode.SetPosition2D(E_POSITION_2D.EP2D_BOTTOMLEFT, 18); coordSceneNode.SetAxisText("x", "y", "z"); lightCoordSceneNode = Engine.Instance.SceneManager.AddCoordSceneNode(); lightCoordSceneNode.Visible = false; lightCoordSceneNode.SetPosition2D(E_POSITION_2D.EP2D_TOPCENTER, 18); lightCoordSceneNode.SetAxisVisible(false, false, true); lightCoordSceneNode.SetAxisColor(new SColor(), new SColor(), new SColor(255, 255, 255)); lightCoordSceneNode.SetAxisText("", "", "light"); lightCoordSceneNode.SetAxisDir(E_AXIS.ESA_Z, Engine.Instance.SceneEnvironment.LightDir); }
public void OnMouseMessage(MouseMessage message, int x, int y, short zDelta) { switch (message) { case MouseMessage.MouseLButtonDown: if (!RCapture) { lastX = x; lastY = y; LCapture = true; } break; case MouseMessage.MouseLButtonUp: if (LCapture) { lastX = lastY = 0; LCapture = false; } RCapture = false; break; case MouseMessage.MouseRButtonDown: if (!LCapture) { lastX = x; lastY = y; RCapture = true; } break; case MouseMessage.MouseRButtonUp: if (RCapture) { lastX = lastY = 0; RCapture = false; } LCapture = false; break; case MouseMessage.MouseMove: { if (LCapture || RCapture) { float deltaX = x - lastX; float deltaY = y - lastY; bool bLight = ModelEditorService.Instance.IsShow(EditorShowOptions.LightCoord) && NativeMethods.IsKeyPressed('L'); if (bLight) { CoordSceneNode lightCoord = ModelSceneService.Instance.LightCoordSceneNode; lightCoord.PitchYawFPS(deltaY * 0.2f, deltaX * 0.2f); Engine.Instance.SceneEnvironment.LightDir = lightCoord.GetAxisDir(E_AXIS.ESA_Z); } else { if (IsGameMode) { Client.Instance.OnMouseMove(deltaY * 0.3f, deltaX * 0.3f); } else { switch (CameraMode) { case CameraModes.Maya: { if (LCapture) { MainCamera.PitchYawMaya(deltaY * 0.3f, deltaX * 0.3f); } else { MainCamera.MoveOffsetMaya(deltaX * 0.02f, deltaY * 0.02f); } } break; case CameraModes.FPS: { MainCamera.PitchYawFPS(deltaY * 0.2f, deltaX * 0.2f); } break; } } } lastX += deltaX; lastY += deltaY; } } break; case MouseMessage.MouseWheel: { if (ShellService.Instance.MainWindow.IsKeyFocus && WheelSpeed > 0.0f) { float fDelta = zDelta / 120.0f; if (IsGameMode) { Client.Instance.OnMouseWheel(fDelta); } else { Camera.SKeyControl keycontrol = new Camera.SKeyControl() { front = fDelta > 0, back = fDelta < 0, left = false, right = false, up = false, down = false }; MainCamera.OnKeyMove(WheelSpeed * Math.Abs(fDelta), keycontrol); } } } break; } }