Example #1
0
        public override void Initialize()
        {
            DXRenderStates.CreateStates(Engine);

            S33M3DXEngine.Threading.SmartThread.SetOptimumNbrThread(2, true);

            //Create the camera, and the camera manager
            _camera      = ToDispose(new FirstPersonCamera(base.Engine, 0.5f, 1000.0f));
            _cameraMnger = ToDispose(new CameraManager <ICamera>(_camera));
            _cameraMnger.EnableComponent();

            _inputManager = new InputsManager(base.Engine, typeof(Actions));
            _inputManager.MouseManager.IsRunning = true;
            _inputManager.EnableComponent();

            _myCameraEntity = ToDispose(new Entity(this.Engine, _cameraMnger as CameraManager <ICamera>, _inputManager));
            _myCameraEntity.EnableComponent();

            _camera.CameraPlugin = (ICameraPlugin)_myCameraEntity;

            //Create the various components
            _sharedFrameComp = ToDispose(new SharedFrameCB(base.Engine, (CameraManager <ICamera>)_cameraMnger));
            _sharedFrameComp.EnableComponent();

            //Register Here all components here
            _gameComp = ToDispose(new NoiseRender(Engine, _noise, _sharedFrameComp as SharedFrameCB, _camera, _thresholdFrom, _thresholdTo, _withBelow));
            _gameComp.EnableComponent();

            this.GameComponents.Add(_inputManager);
            this.GameComponents.Add(_myCameraEntity);
            this.GameComponents.Add(_cameraMnger);
            this.GameComponents.Add(_sharedFrameComp);
            this.GameComponents.Add(_gameComp);
            this.Engine.GameWindow.KeyUp += new KeyEventHandler(GameWindow_KeyUp);
            base.Initialize();
        }
Example #2
0
        public LtreeRender(Size startingWindowsSize, string WindowsCaption, Size ResolutionSize = default(Size))
            : base(startingWindowsSize, WindowsCaption, new SharpDX.DXGI.SampleDescription(1, 0), ResolutionSize)
        {
            DXStates.CreateStates(Engine);

            _camera = new FirstPersonCamera(base.Engine, 0.5f, 100.0f);

            _inputManager = new InputsManager(base.Engine, typeof(Actions));
            _inputManager.MouseManager.IsRunning = true;
            _inputManager.EnableComponent();

            _inputManager.ActionsManager.AddActions(new MouseTriggeredAction()
            {
                ActionId    = Actions.Move_Forward,
                TriggerType = MouseTriggerMode.ScrollWheelForward,
                Binding     = MouseButton.ScrollWheel
            });

            _inputManager.ActionsManager.AddActions(new MouseTriggeredAction()
            {
                ActionId    = Actions.Move_Backward,
                TriggerType = MouseTriggerMode.ScrollWheelBackWard,
                Binding     = MouseButton.ScrollWheel
            });

            _inputManager.ActionsManager.AddActions(new KeyboardTriggeredAction()
            {
                ActionId    = Actions.Move_Up,
                TriggerType = KeyboardTriggerMode.KeyDown,
                Binding     = new KeyWithModifier()
                {
                    MainKey = Keys.Z
                }
            });

            _inputManager.ActionsManager.AddActions(new KeyboardTriggeredAction()
            {
                ActionId    = Actions.Move_Down,
                TriggerType = KeyboardTriggerMode.KeyDown,
                Binding     = new KeyWithModifier()
                {
                    MainKey = Keys.S
                }
            });

            _cameraMnger = ToDispose(new CameraManager <ICamera>(_inputManager, null));
            ((CameraManager <ICamera>)_cameraMnger).RegisterNewCamera(_camera);
            _cameraMnger.EnableComponent();

            _cameraEntity = ToDispose(new Entity(new S33M3Resources.Structs.Vector3D(0, 3, -20), Quaternion.RotationAxis(Vector3.UnitY, 0.0f)));
            _cameraEntity.EnableComponent();

            _camera.CameraPlugin = (ICameraPlugin)_cameraEntity;

            _gamecomp = new LTreeVisu(Engine, (CameraManager <ICamera>)_cameraMnger, _inputManager);
            _gamecomp.EnableComponent();

            //Register Here all components
            base.GameComponents.Add(_cameraMnger);
            base.GameComponents.Add(_gamecomp);
            base.GameComponents.Add(_inputManager);
            base.GameComponents.Add(_cameraEntity);
        }