示例#1
0
    // Initializes the camera.
    public override bool Init(CameraDirection cameraDirection)
    {
        // play mode emulates back facing camera mode only for now
        if (QCARRuntimeUtilities.IsPlayMode())
        {
            cameraDirection = CameraDirection.CAMERA_BACK;
        }

        if (InitCameraDevice((int)cameraDirection) == 0)
        {
            return(false);
        }

        mCameraReady = true;

        // in play mode, CameraReady does not only evaluate the above flag, but also the web cam state
        if (this.CameraReady)
        {
            QCARBehaviour qcarBehaviour = (QCARBehaviour)Object.FindObjectOfType(typeof(QCARBehaviour));
            if (qcarBehaviour)
            {
                // resets the number of frames for which the color buffer needs to be cleared
                // to avoid rendering artifacts while the camera is being initialized
                qcarBehaviour.ResetClearBuffers();

                // configure the videobackground, set initial reflection setting
                qcarBehaviour.ConfigureVideoBackground(true);
            }
        }

        return(true);
    }