/// <summary> /// Builds an array of active passes from the current pass graph. /// </summary> private void UpdateActivePasses() { activePasses.Clear(); rootPass.GetActivePasses(activePasses); IPostEffect lastPostEffect = null; for (int i = activePasses.Count - 1; i >= 0; i--) { var pass = activePasses[i]; var postEffect = pass as IPostEffect; pass.PassOperation = PassOperation.None; pass.PassFormat = null; if (lastPostEffect != null) { if (postEffect != null || i == 0) { pass.PassOperation |= PassOperation.BeginRenderTarget; pass.PassFormat = lastPostEffect.InputFormat; } } if (postEffect != null) { pass.PassOperation |= PassOperation.EndRenderTarget; lastPostEffect = postEffect; } } }
/// <summary> /// Removes one post effect. /// </summary> /// <param name="postEffect">The post effect.</param> public virtual void RemovePostEffect(IPostEffect postEffect) { System.Diagnostics.Debug.Assert(postEffect != null); if ((postEffect.PostEffectType & PostEffectType) != PostEffectType) { ActiveLogger.LogMessage("Trying to remove a wrong post effect type for this Render Technich, pls check if the PostEffectType of the IPostEffect is All or " + PostEffectType + ", The engine is ignoring this operation", LogLevel.RecoverableError); } PostEffects.RemoveLocation(postEffect); postEffect.tech = null; }
/// <summary> /// Determines whether [contains post effect] [the specified post effect]. /// </summary> /// <param name="postEffect">The post effect.</param> /// <returns> /// <c>true</c> if [contains post effect] [the specified post effect]; otherwise, <c>false</c>. /// </returns> public bool ContainsPostEffect(IPostEffect postEffect) { System.Diagnostics.Debug.Assert(postEffect != null); for (int i = 0; i < PostEffects.Count; i++) { if (PostEffects[i] == postEffect) { return(true); } } return(false); }
// 生成と終了 public ポストエフェクトパス(Device d3dDevice, IPostEffect postEffect) { this._PostEffect = postEffect; #region " グローバルパラメータ定数バッファを作成する。" //---------------- this._GlobalParameters定数バッファ = new SharpDX.Direct3D11.Buffer( d3dDevice, new BufferDescription { SizeInBytes = GlobalParameters.SizeInBytes, BindFlags = BindFlags.ConstantBuffer, }); //---------------- #endregion }
/// <summary> /// Adds one post effect. /// </summary> /// <param name="postEffect">The post effect.</param> public virtual void AddPostEffect(IPostEffect postEffect) { System.Diagnostics.Debug.Assert(postEffect != null); if ((postEffect.PostEffectType & PostEffectType) != PostEffectType) { ActiveLogger.LogMessage("Trying to add a wrong post effect for this Render Technich, pls check if the PostEffectType of the IPostEffect is All or " + PostEffectType + ", The engine is ignoring this operation", LogLevel.RecoverableError); } else { if (ginfo != null && factory != null) postEffect.Init(ginfo, factory); PostEffects.Push(postEffect); postEffect.tech = this; } }
/// <summary> /// Adds one post effect. /// </summary> /// <param name="postEffect">The post effect.</param> public virtual void AddPostEffect(IPostEffect postEffect) { System.Diagnostics.Debug.Assert(postEffect != null); if ((postEffect.PostEffectType & PostEffectType) != PostEffectType) { ActiveLogger.LogMessage("Trying to add a wrong post effect for this Render Technich, pls check if the PostEffectType of the IPostEffect is All or " + PostEffectType + ", The engine is ignoring this operation", LogLevel.RecoverableError); } else { if (ginfo != null && factory != null) { postEffect.Init(ginfo, factory); } PostEffects.Push(postEffect); postEffect.tech = this; } }
public void ActivateEffect(string Name) { if (_activatedEffect != null && _activatedEffect.Name == Name) { return; } if (_activatedEffect != null) { _activatedEffect.Deactivate(); } if (!_registeredEffects.TryGetValue(Name, out _activatedEffect)) { _activatedEffect = null; } else { _activatedEffect.Activate(_renderTextureView, this); } }
public IPostEffect GetOrCreateEffect(EPostEffectType type) { var idx = (int)type; if (idx < 0 || idx >= MAX_EFFECT_COUNT) { Debug.LogError("EPostEffectType out of range" + type.ToString()); return(null); } IPostEffect comp = null; if (_allEffects[idx] == null) { switch (type) { case EPostEffectType.RadialBlur: comp = _mainCamera.GetOrAddComponent <PostEffectRadialBlur>(); break; default: break; } comp.OnInstance(); if (comp.shader == null) { Debug.LogError("Can not find PostEffect shader " + type.ToString()); return(null); } _allEffects[idx] = comp; } return(_allEffects[idx]); }
protected void AddPostEffect(IPostEffect posteffect) { renderTechnic.AddPostEffect(posteffect); }
/// <summary> /// Determines whether [contains post effect] [the specified post effect]. /// </summary> /// <param name="postEffect">The post effect.</param> /// <returns> /// <c>true</c> if [contains post effect] [the specified post effect]; otherwise, <c>false</c>. /// </returns> public bool ContainsPostEffect(IPostEffect postEffect) { System.Diagnostics.Debug.Assert(postEffect != null); for (int i = 0; i < PostEffects.Count; i++) { if (PostEffects[i] == postEffect) return true; } return false; }