浏览代码

Code cleanup

/4.1
Tim Mowrer 4 年前
当前提交
2d02ac62
共有 1 个文件被更改,包括 10 次插入12 次删除
  1. 22
      Assets/Scenes/CameraGrain/CameraGrain.cs

22
Assets/Scenes/CameraGrain/CameraGrain.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR.ARFoundation;
using UnityEngine;
public class CameraGrain: MonoBehaviour
public class CameraGrain : MonoBehaviour
get { return m_CameraManager; }
set { m_CameraManager = value; }
get => m_CameraManager;
set => m_CameraManager = value;
}
Renderer m_Renderer;

if(m_CameraManager == null)
if (m_CameraManager == null)
m_CameraManager = FindObjectOfType (typeof(ARCameraManager)) as ARCameraManager;
m_CameraManager = FindObjectOfType<ARCameraManager>();
}
m_Renderer = GetComponent<Renderer>();

m_CameraManager.frameReceived -= OnReceivedFrame;
}
void OnReceivedFrame(ARCameraFrameEventArgs eventArgs){
if(m_Renderer != null && eventArgs.cameraGrainTexture != null)
void OnReceivedFrame(ARCameraFrameEventArgs eventArgs)
{
if (m_Renderer && eventArgs.cameraGrainTexture)
{
m_Renderer.material.SetTexture("_NoiseTex", eventArgs.cameraGrainTexture);
m_Renderer.material.SetFloat("_NoiseIntensity", eventArgs.noiseIntensity);

}
}
正在加载...
取消
保存