示例#1
0
 protected VRGame()
 {
     // Creates a graphics manager. This is mandatory.
     Graphics = new GraphicsDeviceManager(this);
     OVR.Initialize();
     hmd = OVR.HmdCreate(0) ?? OVR.HmdCreateDebug(HMDType.DK2);
     ToDispose(hmd);
     Graphics.PreferredBackBufferWidth       = hmd.Resolution.Width;
     Graphics.PreferredBackBufferHeight      = hmd.Resolution.Height;
     Graphics.PreferredFullScreenOutputIndex = 1;
     Graphics.DeviceCreationFlags           |= DeviceCreationFlags.Debug;
 }
示例#2
0
        public Renderer(GraphicsDeviceManager graphicsDeviceManager)
        {
            // Initialize the SharpOVR library
            OVR.Initialize();

            // Create our HMD or if not present, a dummy one
            HMD = OVR.HmdCreate(0) ?? OVR.HmdCreateDebug(HMDType.DK2);

            // Match back buffer size with HMD resolution
            graphicsDeviceManager.PreferredBackBufferWidth  = HMD.Resolution.Width;
            graphicsDeviceManager.PreferredBackBufferHeight = HMD.Resolution.Height;
            EyePose     = new PoseF[2];
            EyeOffset   = new Vector3[2];
            EyeViewport = new Rect[2];
            FPS         = new FPS();
        }
示例#3
0
        //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

        //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


        /// <summary>
        /// Initializes a new instance of the <see cref="TelepresenceSystem" /> class.
        /// </summary>
        public TelepresenceSystem(TelepresenceSystemConfiguration _configuration)
        {
            // configuration
            config = _configuration;
            Constructor_BaslerCamera();

            // Creates a graphics manager. This is mandatory.
            graphicsDeviceManager = new GraphicsDeviceManager(this);

            // Force no vsync and use real timestep to print actual FPS
            graphicsDeviceManager.SynchronizeWithVerticalRetrace = false;
            IsFixedTimeStep = false;


            Constructor_FPS();
            fpsClock = new Stopwatch(); // readonly


            // Input Constructor
            // all initial components should be created in game constructor
            keyboardManager = new KeyboardManager(this); // readonly
            mouseManager    = new MouseManager(this);
            Constructor_Input();

            Constructor_Sound();

            // Setup the relative directory to the executable directory
            // for loading contents with the ContentManager
            Content.RootDirectory = @"Content\Demo";

            // Initialize OVR Library
            OVR.Initialize();

            // Create our HMD
            hmd = OVR.HmdCreate(0) ?? OVR.HmdCreateDebug(HMDType.DK1);

            // Match back buffer size with HMD resolution
            graphicsDeviceManager.PreferredBackBufferWidth  = hmd.Resolution.Width;
            graphicsDeviceManager.PreferredBackBufferHeight = hmd.Resolution.Height;
        }
示例#4
0
        public CsEx()
        {
            graphicsDeviceManager = new GraphicsDeviceManager(this);

            //Content.RootDirectory = "Content";
            OVR.Initialize();
            hmd = OVR.HmdCreate(0) ?? OVR.HmdCreateDebug(HMDType.DK2);
            hmd.ConfigureTracking(TrackingCapabilities.Orientation | TrackingCapabilities.Position | TrackingCapabilities.MagYawCorrection, TrackingCapabilities.None);
            hmd.EnabledCaps = HMDCapabilities.LowPersistence | HMDCapabilities.DynamicPrediction;

            hmdToEyeViewOffset[0] = hmd.GetRenderDesc(EyeType.Left, hmd.DefaultEyeFov[0]).HmdToEyeViewOffset;
            hmdToEyeViewOffset[1] = hmd.GetRenderDesc(EyeType.Right, hmd.DefaultEyeFov[1]).HmdToEyeViewOffset;

            // Match back buffer size with HMD resolution
            graphicsDeviceManager.PreferredBackBufferWidth       = hmd.Resolution.Width;
            graphicsDeviceManager.PreferredBackBufferHeight      = hmd.Resolution.Height;
            graphicsDeviceManager.PreferredFullScreenOutputIndex = 1;

            bool res = ovrcam.Open();

            Console.WriteLine("OVR OPEN:" + res.ToString());
            ovrcam.useProcessingQuality = 2;
        }