Пример #1
0
 // Use this for initialization
 void OnEnable()
 {
     if (firstActivation)
     {
         firstActivation = false;
     }
     else
     {
         // assign command buffer
         Camera camera = transform.GetComponent <Camera>();
         buf = VideoOverlayProvider.CreateARScreenCommandBuffer();
         camera.AddCommandBuffer(CameraEvent.BeforeForwardOpaque, buf);
         camera.AddCommandBuffer(CameraEvent.BeforeGBuffer, buf);
     }
 }
Пример #2
0
    /// <summary>
    /// This is called when successfully connected to the Tango service.
    /// </summary>
    public void OnTangoServiceConnected()
    {
        // Disable
        if (!m_tangoApplication.EnableVideoOverlay)
        {
            IsRendering = false;
            return;
        }

        CommandBuffer buf = VideoOverlayProvider.CreateARScreenCommandBuffer();

        m_camera.AddCommandBuffer(CameraEvent.BeforeForwardOpaque, buf);
        m_camera.AddCommandBuffer(CameraEvent.BeforeGBuffer, buf);
        _SetRenderAndCamera(AndroidHelper.GetDisplayRotation(), AndroidHelper.GetColorCameraRotation());
        IsRendering = true;
    }
Пример #3
0
    /// @cond
    /// <summary>
    /// Initialize the AR Screen.
    /// </summary>
    public void Start()
    {
        m_camera = GetComponent <Camera>();

        TangoApplication tangoApplication = FindObjectOfType <TangoApplication>();

        tangoApplication.OnDisplayChanged += _OnDisplayChanged;
        m_arCameraPostProcess              = gameObject.GetComponent <ARCameraPostProcess>();
        if (tangoApplication != null)
        {
            tangoApplication.Register(this);

            // If already connected to a service, then do initialization now.
            if (tangoApplication.IsServiceConnected)
            {
                OnTangoServiceConnected();
            }

            CommandBuffer buf = VideoOverlayProvider.CreateARScreenCommandBuffer();
            m_camera.AddCommandBuffer(CameraEvent.BeforeForwardOpaque, buf);
            m_camera.AddCommandBuffer(CameraEvent.BeforeGBuffer, buf);
        }

        if (m_enableOcclusion)
        {
            TangoPointCloud pointCloud = FindObjectOfType <TangoPointCloud>();
            if (pointCloud != null)
            {
                Renderer renderer = pointCloud.GetComponent <Renderer>();
                renderer.enabled              = true;
                renderer.material.shader      = m_occlusionShader;
                pointCloud.m_updatePointsMesh = true;
            }
            else
            {
                Debug.Log("Point Cloud data is not available, occlusion is not possible.");
            }
        }
    }