浏览代码

changed update to OnReceivedFrame

/4.0
Alexandra Serralta 5 年前
当前提交
8bb35f4d
共有 1 个文件被更改,包括 21 次插入6 次删除
  1. 27
      Assets/Scenes/CameraGrain/CameraGrain.cs

27
Assets/Scenes/CameraGrain/CameraGrain.cs


public class CameraGrain: MonoBehaviour
{
[SerializeField]
public ARCameraManager cameraManager
{
get { return m_CameraManager; }
set { m_CameraManager = value; }
}
m_CameraManager = FindObjectOfType (typeof(ARCameraManager)) as ARCameraManager;
if(m_CameraManager == null)
{
m_CameraManager = FindObjectOfType (typeof(ARCameraManager)) as ARCameraManager;
}
m_CameraManager.frameReceived += OnReceivedFrame;
void Update()
void OnDisable()
if(m_Renderer != null && m_CameraManager.cameraGrainTexture != null)
m_CameraManager.frameReceived -= OnReceivedFrame;
}
void OnReceivedFrame(ARCameraFrameEventArgs eventArgs){
if(m_Renderer != null && eventArgs.cameraGrainTexture != null)
m_Renderer.material.SetTexture("_NoiseTex", m_CameraManager.cameraGrainTexture);
m_Renderer.material.SetFloat("_NoiseIntensity", m_CameraManager.noiseIntensity);
m_Renderer.material.SetTexture("_NoiseTex", eventArgs.cameraGrainTexture);
m_Renderer.material.SetFloat("_NoiseIntensity", eventArgs.noiseIntensity);
}
正在加载...
取消
保存