public void OnVideoBackgroundConfigChanged() { VuforiaRenderer.VideoBGCfgData videoBGCfgData = VuforiaRenderer.Instance.GetVideoBackgroundConfig(); Debug.Log("OnVideoBackgroundConfigChanged() called with:" + "\nBackground Size: " + videoBGCfgData.size.x + "x" + videoBGCfgData.size.y); // If the video background config is changed, recalculate and pass new values to shader SetViewportParameters(); }
void Update() { if (!m_VideoBackgroundReady) { m_VideoBGCfgData = VuforiaRenderer.Instance.GetVideoBackgroundConfig(); m_VideoTextureInfo = VuforiaRenderer.Instance.GetVideoTextureInfo(); if (m_EnableLogging) { Debug.Log( "\nBkgdInfoAvail: " + VuforiaRenderer.Instance.IsVideoBackgroundInfoAvailable() + "\nBkgdInfoSize: " + m_VideoBGCfgData.size.x + "x" + m_VideoBGCfgData.size.y + "\nImageSize: " + m_VideoTextureInfo.imageSize.x + "x" + m_VideoTextureInfo.imageSize.y + "\nTextureSize: " + m_VideoTextureInfo.textureSize.x + "x" + m_VideoTextureInfo.textureSize.y); } } if (!m_ShaderHasBeenSetup) { // Before setting up the shader, code will verify that background info is available // and that sizes in VideoBGCfgData and VideoTextureInfo are not zero. // The asynchonous init order may differ between PlayMode and Device. if (VuforiaRenderer.Instance.IsVideoBackgroundInfoAvailable() && m_VideoBGCfgData.size.x > 0 && m_VideoTextureInfo.imageSize.x > 0 && m_VideoTextureInfo.textureSize.x > 0) { m_VideoBackgroundReady = true; m_OcclusionMaterial.mainTexture = VuforiaRenderer.Instance.VideoBackgroundTexture; SetViewportParameters(); m_ShaderHasBeenSetup = true; } } }