private void SetImagEffectParam <T>(string paramName, float Val) where T : ImageEffectNode { ImageEffectNodeList list = null; Type t = typeof(T); if (NormalTypeEffectTable.TryGetValue(t, out list)) { if (list.list.Count > 0) { foreach (ImageEffectNode nod in list.list) { nod.SetParam(paramName, Val); } } } if (OpaqueTypeEffectTable.TryGetValue(t, out list)) { if (list.list.Count > 0) { foreach (ImageEffectNode nod in list.list) { nod.SetParam(paramName, Val); } } } }
/// <summary> /// 禁用特效 /// </summary> /// <param name="cam"></param> private void DisableImageEffect(Type t) { if (NormalTypeEffectTable.ContainsKey(t)) { ImageEffectNodeList effectnodelist = NormalTypeEffectTable[t]; AllEffectEnabledTable[t] = false; effectnodelist.enable = false; foreach (ImageEffectNode nod in effectnodelist.list) { nod.OnDeActive(); } UpdateEnabled(); } else if (OpaqueTypeEffectTable.ContainsKey(t)) { ImageEffectNodeList effectnodelist = OpaqueTypeEffectTable[t]; AllEffectEnabledTable[t] = false; effectnodelist.enable = false; foreach (ImageEffectNode nod in effectnodelist.list) { nod.OnDeActive(); } UpdateEnabled(); } else { Debug.LogWarning("在Table中找不到特效类型:" + t.ToString() + ",是否忘记在Init中添加进去?"); } }
private T Add <T>() where T : ImageEffectNode { T node = null; Type t = typeof(T); if (NormalTypeEffectTable.ContainsKey(t)) { node = HostCam.gameObject.GetComponent <T>(); if (node == null) { node = HostCam.gameObject.AddComponent <T>(); ImageEffectNodeList effectnodelist = NormalTypeEffectTable[t]; effectnodelist.list.Add(node); effectnodelist.enable = false; AllEffectEnabledTable[t] = false; } } else if (OpaqueTypeEffectTable.ContainsKey(t)) { node = HostCam.gameObject.GetComponent <T>(); if (node == null) { node = HostCam.gameObject.AddComponent <T>(); ImageEffectNodeList effectnodelist = OpaqueTypeEffectTable[t]; effectnodelist.list.Add(node); effectnodelist.enable = false; AllEffectEnabledTable[t] = false; } } return(node); }
private Dictionary <Type, ImageEffectNodeList> BuildOpaqueQueueTable() { Dictionary <Type, ImageEffectNodeList> table = new Dictionary <Type, ImageEffectNodeList>(); table.Clear(); table[typeof(EdgeDetectEffectNormals)] = new ImageEffectNodeList(); table[typeof(SSAOPro)] = new ImageEffectNodeList(); //table[typeof(ScreenSpaceAmbientOcclusion)] = new ImageEffectNodeList(); //table[typeof(CandelaSSRREx)] = new ImageEffectNodeList(); table[typeof(CandelaSSRR)] = new ImageEffectNodeList(); table[typeof(GlobalFog)] = new ImageEffectNodeList(); foreach (Type t in table.Keys) { if (AllEffectEnabledTable.ContainsKey(t)) { AllEffectEnabledTable[t] = false; } else { AllEffectEnabledTable.Add(t, false); } } return(table); }
private Dictionary <Type, ImageEffectNodeList> BuildNormalQueueTable() { Dictionary <Type, ImageEffectNodeList> table = new Dictionary <Type, ImageEffectNodeList>(); table.Clear(); table[typeof(DepthOfFieldScatter)] = new ImageEffectNodeList(); table[typeof(FXAA)] = new ImageEffectNodeList(); table[typeof(Tonemapping)] = new ImageEffectNodeList(); table[typeof(ColorCorrectionCurves)] = new ImageEffectNodeList(); table[typeof(VignetteAndChromaticAberration)] = new ImageEffectNodeList(); table[typeof(VolumetricLightScattering)] = new ImageEffectNodeList(); table[typeof(SunShafts)] = new ImageEffectNodeList(); table[typeof(BloomAndFlares)] = new ImageEffectNodeList(); table[typeof(GlowManager)] = new ImageEffectNodeList(); table[typeof(DissolveGlowManager)] = new ImageEffectNodeList(); table[typeof(GlowOutLineManager)] = new ImageEffectNodeList(); //table[typeof(GlowOutLineManagerEx)] = new ImageEffectNodeList(); //table[typeof(DynamicRayScattering)] = new ImageEffectNodeList(); table[typeof(RadialBlur)] = new ImageEffectNodeList(); table[typeof(FullScreenSaturation)] = new ImageEffectNodeList(); table[typeof(BlurAndDownScreen)] = new ImageEffectNodeList(); table[typeof(WarFog)] = new ImageEffectNodeList(); table[typeof(ModifyGameBrightness)] = new ImageEffectNodeList(); foreach (Type t in table.Keys) { if (AllEffectEnabledTable.ContainsKey(t)) { AllEffectEnabledTable[t] = false; } else { AllEffectEnabledTable.Add(t, false); } } return(table); }
private void Remove <T>() where T : ImageEffectNode { T node = HostCam.gameObject.GetComponent <T>(); if (node != null) { Type t = typeof(T); if (NormalTypeEffectTable.ContainsKey(t)) { ImageEffectNodeList effectnodelist = NormalTypeEffectTable[t]; effectnodelist.list.Remove(node); effectnodelist.enable = effectnodelist.CorrectEnabled(); AllEffectEnabledTable[t] = effectnodelist.enable; } else if (OpaqueTypeEffectTable.ContainsKey(t)) { ImageEffectNodeList effectnodelist = NormalTypeEffectTable[t]; effectnodelist.list.Remove(node); effectnodelist.enable = effectnodelist.CorrectEnabled(); AllEffectEnabledTable[t] = effectnodelist.enable; } } }
/// <summary> /// 启用特效 /// </summary> /// <param name="cam"></param> private void EnableImageEffect(Type t) { if (NormalTypeEffectTable.ContainsKey(t)) { ImageEffectNodeList effectnodelist = NormalTypeEffectTable[t]; if (effectnodelist.CorrectEnabled()) { effectnodelist.enable = true; if (effectnodelist.list[0].IsOnValidLOD()) { foreach (ImageEffectNode nod in effectnodelist.list) { nod.OnActive(); } AllEffectEnabledTable[t] = true; UpdateEnabled(); } else { AllEffectEnabledTable[t] = false; UpdateEnabled(); } } else { AllEffectEnabledTable[t] = false; UpdateEnabled(); } } else if (OpaqueTypeEffectTable.ContainsKey(t)) { ImageEffectNodeList effectnodelist = OpaqueTypeEffectTable[t]; if (effectnodelist.CorrectEnabled()) { effectnodelist.enable = true; if (effectnodelist.list[0].IsOnValidLOD()) { foreach (ImageEffectNode nod in effectnodelist.list) { nod.OnActive(); } AllEffectEnabledTable[t] = true; UpdateEnabled(); } else { AllEffectEnabledTable[t] = false; UpdateEnabled(); } } else { AllEffectEnabledTable[t] = false; UpdateEnabled(); } } else { Debug.LogWarning("在Table中找不到特效类型:" + t.ToString() + ",是否忘记在Init中添加进去?"); } }
private void Refresh() { m_AllImageEffeNodeList.Clear(); foreach (ImageEffectNodeList effectnodelist in NormalTypeEffectTable.Values) { foreach (ImageEffectNode nod in effectnodelist.list) { nod.OnDeActive(); } effectnodelist.Clear(); } foreach (ImageEffectNodeList effectnodelist in OpaqueTypeEffectTable.Values) { foreach (ImageEffectNode nod in effectnodelist.list) { nod.OnDeActive(); } effectnodelist.Clear(); } ResetEffectEnabledTable(); ImageEffectNode[] effts = HostCam.GetComponents <ImageEffectNode>(); m_AllImageEffeNodeList.AddRange(effts); foreach (ImageEffectNode effectnode in effts) { Type t = effectnode.GetType(); if (NormalTypeEffectTable.ContainsKey(t)) { ImageEffectNodeList lis = NormalTypeEffectTable[t]; lis.list.Add(effectnode); } else if (OpaqueTypeEffectTable.ContainsKey(t)) { ImageEffectNodeList lis = OpaqueTypeEffectTable[t]; lis.list.Add(effectnode); } } foreach (ImageEffectNodeList effectnodelist in NormalTypeEffectTable.Values) { if (effectnodelist.CorrectEnabled() && effectnodelist.enable) { if (effectnodelist.list[0].IsOnValidLOD()) { AllEffectEnabledTable[effectnodelist.list[0].GetType()] = true; foreach (ImageEffectNode nod in effectnodelist.list) { nod.OnActive(); } } } } foreach (ImageEffectNodeList effectnodelist in OpaqueTypeEffectTable.Values) { if (effectnodelist.CorrectEnabled() && effectnodelist.enable) { if (effectnodelist.list[0].IsOnValidLOD()) { AllEffectEnabledTable[effectnodelist.list[0].GetType()] = true; foreach (ImageEffectNode nod in effectnodelist.list) { nod.OnActive(); } } } } UpdateEnabled(); }