/*
* Created by keefor on 6/13/2017.
*/
using UnityEngine;
using System.Collections;
using Vuforia;
public class FixProjectionMatrix : MonoBehaviour, IVideoBackgroundEventHandler
{
private Camera[] mCameras;
void Start()
{
mCameras = VuforiaBehaviour.Instance.GetComponentsInChildren<Camera>();
VuforiaBehaviour.Instance.RegisterVideoBgEventHandler(this);
}
public void OnVideoBackgroundConfigChanged()
{
foreach (var cam in mCameras)
{
var projMatrix = cam.projectionMatrix;
for (int i = 0; i < 16; i++)
{
if (System.Math.Abs(projMatrix[i]) < 1e-6)
{
projMatrix[i] = 0.0f;
}
}
cam.projectionMatrix = projMatrix;
}
}
}