Beispiel #1
0
        void IScene.Attach(ISceneHost host)
        {
            this.Host      = host;
            keyboardInput  = new InputDevices.KeyboardInputDevice();
            gamepadInput   = new InputDevices.GamepadInputDevice();
            navigatorInput = new InputDevices.NavigatorInputDevice();

            _device = host.Device;

            if (_device == null)
            {
                throw new Exception("Scene host device is null");
            }

            graphicsDevice = SharpDX.Toolkit.Graphics.GraphicsDevice.New(_device);
            customEffect   = Headset.GetCustomEffect(graphicsDevice);

            MediaDecoder.Instance.OnContentChanged += ContentChanged;

            projectionMatrix = Matrix.PerspectiveFovRH((float)(72f * Math.PI / 180f), (float)16f / 9f, 0.0001f, 50.0f);
            worldMatrix      = Matrix.Identity;

            //primitive = GraphicTools.CreateGeometry(projectionMode, graphicsDevice);

            _device.ImmediateContext.Flush();
            ResetRotation();


            var devices = SharpDX.RawInput.Device.GetDevices();

            devices.ForEach(dev =>
            {
                if (dev.DeviceType == SharpDX.RawInput.DeviceType.Mouse)
                {
                    SharpDX.RawInput.Device.RegisterDevice(SharpDX.Multimedia.UsagePage.Generic, SharpDX.Multimedia.UsageId.GenericMouse, SharpDX.RawInput.DeviceFlags.None, dev.Handle);
                }
                Console.WriteLine($"Scene::Attach DX device: {dev.DeviceName} :: {dev.DeviceType}");
            });
        }
Beispiel #2
0
 /// <summary>
 /// Draw the prepared geometry
 /// </summary>
 public void Draw(SharpDX.Toolkit.Graphics.Effect effect = null)
 {
     _terrainGeometry.Draw(effect ?? _terrainRendererEffect);
 }