public Game() { _engine = new EngineWindow(); _stateHandler = new StateHandler(_engine.KeyboardInput); _engine.OnFrameRender += OnFrameRender; _engine.OnFrameUpdate += OnFrameUpdate; }
/// <summary> /// Initializes a new instance of Simulation class with a default window and a viewport /// </summary> public Simulation(EngineWindow window) { Path contentRoot = Path.CreateDirectory(@"..\..\..\Content\drones").GetAbsolute(); _viewport = window.AddViewport("Default", 1, 1, 0, 0, false); _cameras = new Dictionary<string, PerspectiveCamera>(); _player = new PlayerInteraction(3030); SimplyEnvironment env = SimplyEnvironment.Load(contentRoot + new Path("scene.env")); SimplySim.Xna.Engine.Construction engineConstruction = new SimplySim.Xna.Engine.Construction(this); SimplySim.Simulation.Engine.Construction simulationConstruction = new SimplySim.Simulation.Engine.Construction(engineConstruction); WorldDesc worldDesc = simulationConstruction.GenerateWorldDesc(env); worldDesc.FPS = 600; worldDesc.MaxIter = 12; WorldHandle world = AddWorld("DroneWorld", new NewtonWorld(worldDesc)); _scene = CreateSceneManager("Drone Simulation"); simulationConstruction.LoadEnvironment(env, world, _scene); _actualCameraName = GlobalCameraName; PerspectiveCamera globalCamera = (PerspectiveCamera)_scene[GlobalCameraName].Entities[0]; _viewport.Camera = globalCamera; _cameras.Add(GlobalCameraName, globalCamera); engineConstruction.AddControllers(env, _scene, _viewport); _scene.PostProcessingManager.ComponentAddedFiltered.Subscribe(new RegexFilter<PostProcessingComponent>("Screen Space Ambient Occlusion"), BindSSAO); #region Drones // Box drone _boxDrone = new Drone(world, BoxDroneName, _player); _boxDroneHUD = new DroneSensorsHUD(_boxDrone, window.HUDManager); FourHelixBoxDroneCommand _droneBoxController = new FourHelixBoxDroneCommand(_boxDrone.Rotors); Parameter altParam = new Parameter(ParameterType.Altitude, new Coefficients(1, 0.1f, 0)); Parameter yawParam = new Parameter(ParameterType.Yaw, new Coefficients(0.5f, 0.1f, 0)); Parameter pitchParam = new Parameter(ParameterType.Pitch, new Coefficients(0.3f, 0.05f, 0.05f)); Parameter rollParam = new Parameter(ParameterType.Roll, new Coefficients(0.3f, 0.05f, 0.05f)); Parameter[] parameters = new Parameter[] { altParam, yawParam, pitchParam, rollParam }; //_fourHelixBoxDroneController = new KeyBoardPIDController(_boxDrone, 1, worldDesc.Gravity.Length(), _droneBoxController, parameters); _fourHelixBoxDroneController = new PlayerController(_player, _boxDrone, 1, worldDesc.Gravity.Length(), _droneBoxController, parameters); #endregion world.World.ActorAddedFiltered.Subscribe(new RegexFilter<IActor> ("[.]ComplexObject[.]Body"), BindCameras); _scene.Enabled = true; world.Enabled = true; }
public static void Start(Game gameInstance) { Console.ForegroundColor = ConsoleColor.Gray; Logger.AddStickyInfo("voxaInfo", new LoggerMessage("V O X A - Lite 3D Engine v" + VERSION_MAJOR + "." + VERSION_MINOR, ConsoleColor.Cyan)); Logger.Info("Starting Voxa Engine v" + VERSION_MAJOR + "." + VERSION_MINOR); game = gameInstance; engineWindow = new EngineWindow(gameInstance.WINDOW_WIDTH, gameInstance.WINDOW_HEIGHT); renderingPool = new RenderingPool(); uniformManager = new UniformManager(); engineWindow.Run(gameInstance.TARGET_UPDATE_RATE, 0); }
public static void Start(Game gameInstance) { Console.ForegroundColor = ConsoleColor.Gray; Logger.AddStickyInfo("voxaInfo", new LoggerMessage("V O X A - Lite 3D Engine v" + VERSION_MAJOR + "." + VERSION_MINOR, ConsoleColor.Cyan)); Logger.Info("Starting Voxa Engine v" + VERSION_MAJOR + "." + VERSION_MINOR); Game = gameInstance; EngineWindow = new EngineWindow(gameInstance.Config.WindowWidth, gameInstance.Config.WindowHeight, gameInstance.Config.Fullscreen, gameInstance.Config.WindowTitle, gameInstance.Config.LockMouse); RenderingPool = new RenderingPool(); UniformManager = new UniformManager(); TaskQueue = new TaskQueue(); FontLibrary = new Library(); EngineWindow.Run(gameInstance.Config.TargetUpdateRate, 0); }
public void Dispose() { EngineWindow.ReleaseOnMainThread(this); GC.SuppressFinalize(this); }