void Start()
        {
            encodingStarted   = false;
            encodingStopped   = false;
            pauseAudioCapture = false;

            flippingTextureMaterial           = new Material(flippingTextureShader);
            flippingTextureMaterial.hideFlags = HideFlags.HideAndDontSave;

            terminateThread = false;

            // Since Spaces only support two HMD at the moment, we want to check only two devices now.
            string vrDeviceName = VRDevice.model.ToLower();

            if (vrDeviceName.Contains("rift"))
            {
                attachedHMD = VRDeviceType.OCULUS_RIFT;
            }
            else if (vrDeviceName.Contains("vive"))
            {
                attachedHMD = VRDeviceType.HTC_VIVE;
            }
            else
            {
                attachedHMD = VRDeviceType.UNKNOWN;
            }
        }
Esempio n. 2
0
        public static void SelectVR(VRDeviceType vrDeviceType)
        {
            string vrDeviceDefine = VR_DEFINE[vrDeviceType];

#if UNITY_STANDALONE
            UpdateDefineSymbols(vrDeviceDefine, BuildTargetGroup.Standalone);
#elif UNITY_ANDROID
            UpdateDefineSymbols(vrDeviceDefine, BuildTargetGroup.Android);
#elif UNITY_IOS
            UpdateDefineSymbols(vrDeviceDefine, BuildTargetGroup.iOS);
#elif UNITY_WEBGL
            UpdateDefineSymbols(vrDeviceDefine, BuildTargetGroup.WebGL);
#endif
        }
Esempio n. 3
0
    //
    static public void SetVRDeviceType(VRDeviceType vrDeviceType)
    {
        if (_vrDeviceType == vrDeviceType)
        {
            return;
        }

        _vrDeviceType           = vrDeviceType;
        VRSettings.loadedDevice = _vrDeviceType;
        bool vr = (_vrDeviceType != VRDeviceType.None);

        VRSettings.showDeviceView = vr;
        VRSettings.enabled        = vr;
    }
    //
    void Awake()
    {
        if (dropdown != null)
        {
            Array vrDeviceTypes = Enum.GetValues(typeof(VRDeviceType));

            List <Dropdown.OptionData> options = new List <Dropdown.OptionData>();
            for (int i = 0; i < vrDeviceTypes.Length; i++)
            {
                VRDeviceType        vrDeviceType = (VRDeviceType)vrDeviceTypes.GetValue(i);
                Dropdown.OptionData optionData   = new Dropdown.OptionData(vrDeviceType.ToString());
                options.Add(optionData);
                indexToVRDeviceType.Add(i, vrDeviceType);
                vrDeviceTypeToIndex.Add(vrDeviceType, i);
            }

            dropdown.options = options;
            dropdown.value   = vrDeviceTypeToIndex[VRSettings.loadedDevice];
        }
    }
        void Start()
        {
            // create cubemap render texture
            cubemapTex = new RenderTexture(cubemapSize, cubemapSize, 0);
#if UNITY_5_4_OR_NEWER
            cubemapTex.dimension = UnityEngine.Rendering.TextureDimension.Cube;
#else
            cubemapTex.isCubemap = true;
#endif
            cubemapTex.hideFlags = HideFlags.HideAndDontSave;

            // create render texture for equirectangular image
            SetOutputSize(captureWidth, captureHeight);

            // create materials
            convertMaterial       = CreateMaterial(convertShader, convertMaterial);
            downSampleMaterial    = CreateMaterial(downSampleShader, downSampleMaterial);
            outputCubemapMaterial = CreateMaterial(outputCubemapShader, outputCubemapMaterial);
            initialized           = true;

            encodingStarted   = false;
            encodingStopped   = false;
            pauseAudioCapture = false;
            terminateThread   = false;

            // Get vr device info for audio resource detection
            string vrDeviceName = UnityEngine.XR.XRDevice.model.ToLower();
            if (vrDeviceName.Contains("rift"))
            {
                attachedHMD = VRDeviceType.OCULUS_RIFT;
            }
            else if (vrDeviceName.Contains("vive"))
            {
                attachedHMD = VRDeviceType.HTC_VIVE;
            }
            else
            {
                attachedHMD = VRDeviceType.UNKNOWN;  // we will use default audio device
            }
        }
Esempio n. 6
0
    // Update is called once per frame
    void Update()
    {
        isPresent = VRDevice.isPresent;
        family = VRDevice.family;
        model = VRDevice.model;

        enabledDevice = VRSettings.enabled;
        loadedDevice = VRSettings.loadedDevice;
        renderScale = VRSettings.renderScale;
        showDeviceView = VRSettings.showDeviceView;

        VRSettings.enabled = forceEnabled;
        if (Input.GetKeyDown(KeyCode.H))
        {
            Vector3 pos = transform.position;
            Quaternion rot = transform.rotation;
            Destroy(GameObject.Find("Main Camera"));
            GameObject go = new GameObject("New camera", typeof(Camera));
            go.transform.position = pos;
            go.transform.rotation = rot;
        }
    }
Esempio n. 7
0
        //void OnRenderImage(RenderTexture src, RenderTexture dst)
        //{
        //  if (captureMode == CaptureMode.REGULAR &&
        //    outputTexture && captureSource == CaptureSource.CAMERA)
        //  {
        //    Graphics.Blit(src, dst);
        //    Graphics.Blit(null, outputTexture);
        //    StartCoroutine(BlitRegularTextures());
        //  }
        //}

        void Awake()
        {
            if (singleton != null)
            {
                return;
            }
            singleton    = this;
            instantiated = true;

            captureStarted    = false;
            screenshotStarted = false;

            // Retrieve attached VR devie for sound and microphone capture in VR
            // If expected VR device is not attached, it will capture default audio device
#if UNITY_2019_1_OR_NEWER
            UnityEngine.XR.InputDevice inputDevice = new UnityEngine.XR.InputDevice();
            string vrDeviceName = string.IsNullOrEmpty(inputDevice.name) ? "" : inputDevice.name.ToLower();
#elif UNITY_2017_2_OR_NEWER
            string vrDeviceName = UnityEngine.XR.XRDevice.model.ToLower();
#else
            string vrDeviceName = "";
#endif

            if (vrDeviceName.Contains("rift"))
            {
                attachedHMD = VRDeviceType.OCULUS_RIFT;
            }
            else if (vrDeviceName.Contains("vive"))
            {
                attachedHMD = VRDeviceType.HTC_VIVE;
            }
            else
            {
                attachedHMD = VRDeviceType.UNKNOWN;
            }
        }
Esempio n. 8
0
 private static extern EncoderStatus GPUEncoder_SetMicAndAudioRenderDeviceByVRDeviceType(VRDeviceType vrDevice);
 private static extern FBCAPTURE_STATUS audioEncoding(bool useVRAudioResources, bool silenceMode, VRDeviceType vrDevice, string useMicIMMDeviceId);
Esempio n. 10
0
        void Awake()
        {
            if (singleton != null)
            {
                return;
            }
            singleton    = this;
            instantiated = true;

            captureStarted    = false;
            screenshotStarted = false;
            //regularCamera = GetComponent<Camera>();
            if (regularCamera)
            {
                regularCamera.enabled = false;
            }
            if (cubemapCamera)
            {
                cubemapCamera.enabled = false;
            }

            OnError += EncoderErrorLog;

            // Resolution preset settings
            ResolutionPresetSettings();

            //// Preview video preset
            //if (previewVideoPreset == ResolutionPreset._720P)
            //{
            //  previewVideoWidth = 1280;
            //  previewVideoHeight = 720;
            //  previewVideoBitRate = 2000;
            //}
            //else if (previewVideoPreset == ResolutionPreset._1080P)
            //{
            //  previewVideoWidth = 1920;
            //  previewVideoHeight = 1080;
            //  previewVideoBitRate = 4000;
            //}
            //else if (previewVideoPreset == ResolutionPreset._4K)
            //{
            //  previewVideoWidth = 4096;
            //  previewVideoHeight = 2048;
            //  previewVideoBitRate = 10000;
            //}

            // Retrieve attached VR devie for sound and microphone capture in VR
            // If expected VR device is not attached, it will capture default audio device
            string vrDeviceName = UnityEngine.XR.XRDevice.model.ToLower();

            if (vrDeviceName.Contains("rift"))
            {
                attachedHMD = VRDeviceType.OCULUS_RIFT;
            }
            else if (vrDeviceName.Contains("vive"))
            {
                attachedHMD = VRDeviceType.HTC_VIVE;
            }
            else
            {
                attachedHMD = VRDeviceType.UNKNOWN;
            }
        }