예제 #1
0
        void OnEnable()
        {
#if UNITY_ANDROID && !UNITY_EDITOR
            IntPtr tempPtr = Marshal.StringToHGlobalAnsi(PROPERTY_ISVR9);
            bVR9 = Composer.DpnuGetIntValue(tempPtr, 0) == 0? false: true;
            IntPtr tempPtrQcom = Marshal.StringToHGlobalAnsi(PROPERTY_ISQCOM);
            bQCOM = Composer.DpnuGetIntValue(tempPtrQcom, 0) == 0? false: true;
            Debug.Log("DpnDevice Init bVR9 " + bVR9 + " bQCOM " + bQCOM);
#endif
            ConfigEngine.Init();
            if (!bVR9)
            {
                _buffers.Init
                    (DpnManager.eyeTextureDepth
                    , DpnManager.eyeTextureFormat
                    , DpnManager.DeviceInfo.resolution_x
                    , DpnManager.DeviceInfo.resolution_y);
#if UNITY_ANDROID && !UNITY_EDITOR
#else
                IntPtr[] buf_ptr = new IntPtr[(int)dpncEYE.NUM]
                {
                    _buffers.GetEyeTexturePtr(dpncEYE.LEFT)
                    , _buffers.GetEyeTexturePtr(dpncEYE.RIGHT)
                };
                Composer.SetTextures(buf_ptr[0], dpncEYE.LEFT);
                Composer.SetTextures(buf_ptr[1], dpncEYE.RIGHT);
#endif
            }
            //
#if !UNITY_ANDROID
            string pcScreenOutput = "pcScreenOutput";
#if UNITY_EDITOR
            IntPtr OutputPtr = Marshal.StringToHGlobalAnsi(pcScreenOutput);
            Composer.DpnuSetIntValue(OutputPtr, (int)dpncOutputMode.NONE);
            Marshal.FreeHGlobal(OutputPtr);
#else
            IntPtr OutputPtr = Marshal.StringToHGlobalAnsi(pcScreenOutput);
            Composer.DpnuSetIntValue(OutputPtr, (int)DpnManager.pcScreenOutputMode);
            Marshal.FreeHGlobal(OutputPtr);
#endif
#endif

            Camera.onPreRender += CameraPreRender;
            Camera.onPreCull   += CameraPreCull;

            if (DpnManager.DPVRPointer)
            {
                gameObject.AddComponent <DpnPointerManager>();
            }

            //cameras
            StartCoroutine(CallbackCoroutine());
        }