using System.Collections; using System.Collections.Generic; using UnityEngine; namespace cylvester { public class TextureMapper : MonoBehaviour { [SerializeField] private Waveform waveform; [SerializeField] private Spectrogram spectrogram; [SerializeField] private GameObject waveformPanel; [SerializeField] private GameObject spectrogramPanel; [SerializeField] private GameObject chikashiPanel; private Renderer waveFormRenderer_; private Renderer spectroGramRenderer_; private Renderer chikashiRenderer_; private static readonly int baseColorMap_ = Shader.PropertyToID("_BaseColorMap"); private static readonly int spectrogramIndex_ = Shader.PropertyToID("_Index"); private static readonly int myTexture_ = Shader.PropertyToID("_MyTexture"); void Start() { waveFormRenderer_ = waveformPanel.GetComponent(); spectroGramRenderer_ = spectrogramPanel.GetComponent(); chikashiRenderer_ = chikashiPanel.GetComponent(); } void Update() { waveFormRenderer_.material.SetTexture(baseColorMap_, waveform.Texture); spectroGramRenderer_.material.SetTexture(baseColorMap_, spectrogram.Texture); spectroGramRenderer_.material.SetInt(spectrogramIndex_, spectrogram.Index); chikashiRenderer_.material.SetTexture(myTexture_, waveform.Texture); } } }