soundvision/UnityProject/Assets/KinectPointCloud.cs

34 lines
837 B
C#
Raw Normal View History

2019-11-03 22:37:01 +00:00
using UnityEngine;
using UnityEngine.Experimental.VFX;
namespace cylvester
{
public class KinectPointCloud : MonoBehaviour
{
[SerializeField] private VisualEffect visualEffect;
private Texture2D cachedTexture_;
private Texture2D data_;
public void Start()
{
cachedTexture_ = new Texture2D(512, 424, TextureFormat.R16, false);
data_ = new Texture2D(512, 424, TextureFormat.R16, false);
}
public void Update()
{
//Graphics.CopyTexture(data_, cachedTexture_);
}
public void OnInfraredFrameReceived( Texture2D data)
{
data_ = data;
visualEffect.SetTexture("DepthImage", data_);
visualEffect.SetTexture("CachedTexture", cachedTexture_);
}
}
}