public void SyncLight(Light l, ref LightInfo li) { if (l != null) { li.lightDir = l.transform.rotation * -Vector3.forward; li.lightColor = l.color; li.lightDir.w = (l.enabled && l.gameObject.activeInHierarchy) ? l.intensity : 0; } }
private void SetLightInfo(ref LightInfo li, int dirKey, int colorKey) { Shader.SetGlobalVector(dirKey, li.lightDir); Vector4 lightColorIntensity; lightColorIntensity = new Vector4( Mathf.Pow(li.lightColor.r * li.lightDir.w, 2.2f), Mathf.Pow(li.lightColor.g * li.lightDir.w, 2.2f), Mathf.Pow(li.lightColor.b * li.lightDir.w, 2.2f), shadowIntensity); Shader.SetGlobalVector(colorKey, lightColorIntensity); }