示例#1
0
    // -------------------------------------------------------------------------------

    public virtual void OnDisable()
    {
        if (m_capturePlane != null)
        {
            m_capturePlane.ReleaseVideoCapturePlane();
            m_capturePlane = null;
        }
#if (!UNITY_EDITOR && UNITY_ANDROID) || (!UNITY_EDITOR && UNITY_IOS)
        if (m_videoParameters.useNativeCapture)
        {
            xmgAugmentedVisionBridge.xzimgCamera_delete();
        }
#endif
    }
示例#2
0
    // -------------------------------------------------------------------------------

    public virtual void Start()
    {
        CheckParameters();
        if (!m_videoParameters.useNativeCapture)
        {
            // -- Unity webcam capture
            if (m_capturePlane == null)
            {
                m_capturePlane  = (xmgVideoCapturePlane)gameObject.AddComponent(typeof(xmgVideoCapturePlane));
                m_webcamTexture = m_capturePlane.OpenVideoCapture(ref m_videoParameters);
                m_capturePlane.CreateVideoCapturePlane(
                    m_videoParameters.VideoPlaneScale,
                    m_videoParameters);
            }
            if (m_webcamTexture == null)
            {
                Debug.Log("Error - No camera detected!");
                return;
            }
        }
        else
        {
            // -- Native camera capture using xzimgCamera
            xmgAugmentedVisionBridge.PrepareNativeVideoCaptureDefault(
                ref m_xmgVideoParams,
                m_videoParameters.videoCaptureMode,
                m_videoParameters.UseFrontal ? 1 : 0);

            m_capturePlane = (xmgVideoCapturePlane)gameObject.AddComponent(typeof(xmgVideoCapturePlane));
            m_capturePlane.CreateVideoCapturePlane(
                m_videoParameters.VideoPlaneScale,
                m_videoParameters);

#if (!UNITY_EDITOR && UNITY_ANDROID) || (!UNITY_EDITOR && UNITY_IOS)
            xmgAugmentedVisionBridge.xzimgCamera_create(ref m_xmgVideoParams);
#endif
        }
    }