soundvision/UnityProject/Assets/Scripts/Visualizer/TexturePanelBehaviour.cs

24 lines
532 B
C#
Raw Normal View History

2019-07-07 15:56:52 +00:00
using UnityEngine;
2019-10-31 09:43:47 +00:00
namespace cylvester
2019-07-07 15:56:52 +00:00
{
class TexturePanelBehaviour : MonoBehaviour
2019-07-07 15:56:52 +00:00
{
2019-10-04 19:58:32 +00:00
[SerializeField] private GameObject panel = null;
2019-07-07 15:56:52 +00:00
private Renderer renderer_;
2019-10-08 21:01:21 +00:00
private static readonly int KinectTexture = Shader.PropertyToID("_kinectTexture");
2019-10-04 19:52:26 +00:00
2019-07-07 15:56:52 +00:00
void Start()
{
renderer_ = panel.GetComponent<Renderer>();
2019-10-04 19:52:26 +00:00
}
public void OnTextureReceived(Texture texture)
2019-10-04 19:52:26 +00:00
{
renderer_.material.SetTexture(KinectTexture, texture);
2019-07-07 15:56:52 +00:00
}
}
2019-10-05 14:49:30 +00:00
}