2020-01-02 12:17:22 +00:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
2020-01-13 15:20:47 +00:00
|
|
|
|
public class LookupTextureSGBinder : MonoBehaviour
|
2020-01-02 12:17:22 +00:00
|
|
|
|
{
|
|
|
|
|
[SerializeField] private LookupTexture lookupTexture;
|
|
|
|
|
[SerializeField] private GameObject TextureOutput;
|
|
|
|
|
|
|
|
|
|
private Renderer lookupTextureRenderer_;
|
|
|
|
|
|
|
|
|
|
private static readonly int lookupTexture_ = Shader.PropertyToID("_BaseColorMap");
|
|
|
|
|
private static readonly int lookupTextureIndex_ = Shader.PropertyToID("_LookupTextureIndex");
|
2020-01-03 15:17:07 +00:00
|
|
|
|
private static readonly int lookupTextureLength_ = Shader.PropertyToID("_LookupTextureLength");
|
2020-01-02 12:17:22 +00:00
|
|
|
|
|
|
|
|
|
private void Start()
|
|
|
|
|
{
|
|
|
|
|
lookupTextureRenderer_ = TextureOutput.GetComponent<Renderer>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void Update()
|
|
|
|
|
{
|
|
|
|
|
lookupTextureRenderer_.material.SetTexture(lookupTexture_, lookupTexture.Texture);
|
|
|
|
|
lookupTextureRenderer_.material.SetInt(lookupTextureIndex_, lookupTexture.Index);
|
2020-01-03 15:17:07 +00:00
|
|
|
|
lookupTextureRenderer_.material.SetInt(lookupTextureLength_, lookupTexture.Length);
|
2020-01-02 12:17:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|