Exemplo n.º 1
0
    void Start()
    {
        if (Instance == null)
        {
            Instance = this;
            Debug.Log("CustomMessage: Start CameraImageAccess");
        }
        else
        {
            Debug.Log("CustomMessage: Destroy CameraImageAccess");
            Destroy(gameObject);

            return;
        }

        #if UNITY_EDITOR
        mPixelFormat = Vuforia.PIXEL_FORMAT.GRAYSCALE; // Need Grayscale for Editor
        texture      = new Texture2D(Screen.width, Screen.height, TextureFormat.Alpha8, false);
        #else
        mPixelFormat = Vuforia.PIXEL_FORMAT.RGB888; // Use RGB888 for mobile
        texture      = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false);
        #endif

        // Register Vuforia life-cycle callbacks:
        VuforiaARController.Instance.RegisterVuforiaStartedCallback(OnVuforiaStarted);
        VuforiaARController.Instance.RegisterTrackablesUpdatedCallback(OnTrackablesUpdated);
        VuforiaARController.Instance.RegisterOnPauseCallback(OnPause);

        // Remove the pixel format (in case it was previously set);
        // note that we are passing "false" here.
        // OnPause(true);
        // OnPause(false);
    }
Exemplo n.º 2
0
    void Start()
    {
        rend = GetComponent <Renderer> ();

#if UNITY_EDITOR
        mPixelFormat = Vuforia.PIXEL_FORMAT.RGBA8888;
#else
        mPixelFormat = Vuforia.PIXEL_FORMAT.RGB888; // Use RGB888 for mobile
#endif

        // Register Vuforia life-cycle callbacks:
        VuforiaARController.Instance.RegisterVuforiaStartedCallback(OnVuforiaStarted);
        VuforiaARController.Instance.RegisterTrackablesUpdatedCallback(OnTrackablesUpdated);
        VuforiaARController.Instance.RegisterOnPauseCallback(OnPause);
    }
Exemplo n.º 3
0
 // Start is called before the first frame update
 void Start()
 {
     if (S != null)
     {
         Debug.LogError("Vuforia Camera Capture Singleton attempted to make duplicate (Static reference not null)");
         return;
     }
     else
     {
         S               = this;
         mPixelFormat    = Vuforia.PIXEL_FORMAT.RGB888;
         lastCaptureTime = Time.realtimeSinceStartup;
         Vuforia.VuforiaARController.Instance.RegisterVuforiaStartedCallback(OnVuforiaStarted);
         Vuforia.VuforiaARController.Instance.RegisterOnPauseCallback(OnPause);
     }
 }