public void UploadData() { _renderer = gameObject.GetComponent <Renderer>(); if (_renderer != null && _renderer.sharedMaterial != null) { _renderer.sharedMaterial.SetMatrix("_ColorMatrix", colorMatrix.GetMatrix()); _renderer.sharedMaterial.SetVector("_ColorOffset", colorMatrix.GetOffset()); } }
protected void OnRenderImage(RenderTexture sourceTexture, RenderTexture destTexture) { if (material != null) { material.SetMatrix("_Matrix", color.GetMatrix()); material.SetVector("_Offset", color.GetOffset()); Graphics.Blit(sourceTexture, destTexture, material); } else { Graphics.Blit(sourceTexture, destTexture); } }
private void ApplyColorMatrix() { ColorMatrix c = new ColorMatrix(); for (int i = 0; i < 5; i++) { Vector4 v = _material.GetVector("_ColorT_" + i); c.hue = v.x; c.saturation = v.y; c.brightness = v.z; c.contrast = v.w; _material.SetMatrix("_ColorMatrix" + i, c.GetMatrix()); _material.SetVector("_ColorOffset" + i, c.GetOffset()); } }
public ColorMatrixViewModel(ColorMatrix colorMatrix) : this(colorMatrix?.GetMatrix() ?? throw new ArgumentNullException(nameof(colorMatrix))) { }