public static PrimitiveTopology Topology(this EffectPass var) { if (var.GetAnnotationByName("topology") != null) { if (var.GetAnnotationByName("topology").AsString() != null) { try { return((PrimitiveTopology)Enum.Parse(typeof(PrimitiveTopology), var.GetAnnotationByName("topology").AsString().GetString(), true)); } catch { return(PrimitiveTopology.Undefined); } } } return(PrimitiveTopology.Undefined); }
public ImageShaderPass(EffectPass pd) { this.Mips = false; this.CustomFormat = false; this.Scale = 1.0f; this.DoScale = false; this.Reference = eImageScaleReference.Previous; this.ComputeData = new ImageComputeData(pd); EffectVariable var = pd.GetAnnotationByName("format"); if (var.IsValid) { string fmt = var.AsString().GetString(); this.CustomFormat = true; this.Format = (SlimDX.DXGI.Format)Enum.Parse(typeof(SlimDX.DXGI.Format), fmt, true); } var = pd.GetAnnotationByName("mips"); if (var.IsValid) { bool b = var.AsScalar().GetFloat() > 0.5f; this.Mips = b; } var = pd.GetAnnotationByName("scale"); if (var.IsValid) { this.Scale = var.AsScalar().GetFloat(); this.DoScale = true; } var = pd.GetAnnotationByName("initial"); if (var.IsValid) { bool b = var.AsScalar().GetFloat() > 0.5f; this.Reference = b ? eImageScaleReference.Initial : eImageScaleReference.Previous; } }
public static int GetIntAnnotation(this EffectPass ext, string name, int defaultvalue) { EffectVariable var = ext.GetAnnotationByName(name); if (var.IsValid) { return(var.AsScalar().GetInt()); } else { return(defaultvalue); } }
public static bool GetBoolPassAnnotationByName(this EffectPass pass, string annotationName, bool defaultValue) { EffectVariable v = pass.GetAnnotationByName(annotationName); return(v.GetBoolFromFloatVVVV(defaultValue)); }
public ImageShaderPass(EffectPass pd) { this.Mips = false; this.CustomFormat = false; this.ScaleVector = new Vector2(1, 1); this.DoScale = false; this.Reference = eImageScaleReference.Previous; this.BlendPreset = ""; this.DepthPreset = ""; this.UseDepth = false; this.HasState = false; this.KeepTarget = false; this.Absolute = false; this.ComputeData = new ImageComputeData(pd); EffectVariable var = pd.GetAnnotationByName("format"); if (var.IsValid) { string fmt = var.AsString().GetString(); this.CustomFormat = true; this.Format = (SlimDX.DXGI.Format)Enum.Parse(typeof(SlimDX.DXGI.Format), fmt, true); } var = pd.GetAnnotationByName("mips"); if (var.IsValid) { bool b = var.AsScalar().GetFloat() > 0.5f; this.Mips = b; } var = pd.GetAnnotationByName("scale"); if (var.IsValid) { if (var.GetVariableType().Description.Class == ShaderVariableClass.Scalar) { float s = var.AsScalar().GetFloat(); this.ScaleVector = new Vector2(s, s); this.DoScale = true; } if (var.GetVariableType().Description.Class == ShaderVariableClass.Vector) { Vector4 s = var.AsVector().GetVector(); this.ScaleVector = new Vector2(s.X, s.Y); this.DoScale = true; } var = pd.GetAnnotationByName("absolute"); if (var.IsValid && var.GetVariableType().Description.Class == ShaderVariableClass.Scalar) { this.Absolute = var.AsScalar().GetFloat() > 0.5f; } } var = pd.GetAnnotationByName("initial"); if (var.IsValid) { bool b = var.AsScalar().GetFloat() > 0.5f; this.Reference = b ? eImageScaleReference.Initial : eImageScaleReference.Previous; } var = pd.GetAnnotationByName("clear"); if (var.IsValid) { bool b = var.AsScalar().GetFloat() > 0.5f; this.Clear = b; } var = pd.GetAnnotationByName("usedepth"); if (var.IsValid) { bool b = var.AsScalar().GetFloat() > 0.5f; this.UseDepth = b; } var = pd.GetAnnotationByName("keeptarget"); if (var.IsValid) { bool b = var.AsScalar().GetFloat() > 0.5f; this.KeepTarget = b; } var = pd.GetAnnotationByName("hasstate"); if (var.IsValid) { bool b = var.AsScalar().GetFloat() > 0.5f; this.HasState = b; } var = pd.GetAnnotationByName("blendpreset"); if (var.IsValid) { string blend = var.AsString().GetString(); this.BlendPreset = blend; } var = pd.GetAnnotationByName("depthpreset"); if (var.IsValid) { string depth = var.AsString().GetString(); this.DepthPreset = depth; } }
public ImageShaderPass(EffectPass pd) { this.Mips = false; this.CustomFormat = false; this.Scale = 1.0f; this.DoScale = false; this.Reference = eImageScaleReference.Previous; this.ComputeData = new ImageComputeData(pd); EffectVariable var = pd.GetAnnotationByName("format"); if (var.IsValid) { string fmt = var.AsString().GetString(); this.CustomFormat = true; this.Format = (SlimDX.DXGI.Format)Enum.Parse(typeof(SlimDX.DXGI.Format), fmt, true); } var = pd.GetAnnotationByName("mips"); if (var.IsValid) { bool b = var.AsScalar().GetFloat() > 0.5f; this.Mips = b; } var = pd.GetAnnotationByName("scale"); if (var.IsValid) { this.Scale = var.AsScalar().GetFloat(); this.DoScale = true; } var = pd.GetAnnotationByName("initial"); if (var.IsValid) { bool b = var.AsScalar().GetFloat() > 0.5f; this.Reference = b ? eImageScaleReference.Initial : eImageScaleReference.Previous; } }
public ImageShaderPass(EffectPass pd) { this.Mips = false; this.CustomFormat = false; this.ScaleVector = new Vector2(1, 1); this.DoScale = false; this.Reference = eImageScaleReference.Previous; this.BlendPreset = ""; this.DepthPreset = ""; this.UseDepth = false; this.HasState = false; this.KeepTarget = false; this.Absolute = false; this.IterationCount = 1; this.ComputeData = new ImageComputeData(pd); EffectVariable var = pd.GetAnnotationByName("format"); if (var.IsValid) { string fmt = var.AsString().GetString(); this.CustomFormat = true; this.Format = (SlimDX.DXGI.Format)Enum.Parse(typeof(SlimDX.DXGI.Format), fmt, true); } var = pd.GetAnnotationByName("mips"); if (var.IsValid) { bool b = var.AsScalar().GetFloat() > 0.5f; this.Mips = b; } var = pd.GetAnnotationByName("scale"); if (var.IsValid) { if (var.GetVariableType().Description.Class == ShaderVariableClass.Scalar) { float s = var.AsScalar().GetFloat(); this.ScaleVector = new Vector2(s, s); this.DoScale = true; } if (var.GetVariableType().Description.Class == ShaderVariableClass.Vector) { Vector4 s = var.AsVector().GetVector(); this.ScaleVector = new Vector2(s.X, s.Y); this.DoScale = true; } var = pd.GetAnnotationByName("absolute"); if (var.IsValid && var.GetVariableType().Description.Class == ShaderVariableClass.Scalar) { this.Absolute = var.AsScalar().GetFloat() > 0.5f; } } var = pd.GetAnnotationByName("initial"); if (var.IsValid) { bool b = var.AsScalar().GetFloat() > 0.5f; this.Reference = b ? eImageScaleReference.Initial : eImageScaleReference.Previous; } var = pd.GetAnnotationByName("iterations"); if (var.IsValid) { try { int i = var.AsScalar().GetInt(); this.IterationCount = Math.Max(1, i); } catch { } } var = pd.GetAnnotationByName("clear"); if (var.IsValid) { bool b = var.AsScalar().GetFloat() > 0.5f; this.Clear = b; } var = pd.GetAnnotationByName("usedepth"); if (var.IsValid) { bool b = var.AsScalar().GetFloat() > 0.5f; this.UseDepth = b; } var = pd.GetAnnotationByName("keeptarget"); if (var.IsValid) { bool b = var.AsScalar().GetFloat() > 0.5f; this.KeepTarget = b; } var = pd.GetAnnotationByName("hasstate"); if (var.IsValid) { bool b = var.AsScalar().GetFloat() > 0.5f; this.HasState = b; } var = pd.GetAnnotationByName("blendpreset"); if (var.IsValid) { string blend = var.AsString().GetString(); this.BlendPreset = blend; } var = pd.GetAnnotationByName("depthpreset"); if (var.IsValid) { string depth = var.AsString().GetString(); this.DepthPreset = depth; } }
public ImageShaderPass(EffectPass pd) { this.Mips = false; this.CustomFormat = false; this.Scale = 1.0f; this.DoScale = false; this.Reference = eImageScaleReference.Previous; this.BlendPreset = ""; this.DepthPreset = ""; this.UseDepth = false; this.HasState = false; this.KeepTarget = false; this.ComputeData = new ImageComputeData(pd); EffectVariable var = pd.GetAnnotationByName("format"); if (var.IsValid) { string fmt = var.AsString().GetString(); this.CustomFormat = true; this.Format = (SlimDX.DXGI.Format)Enum.Parse(typeof(SlimDX.DXGI.Format), fmt, true); } var = pd.GetAnnotationByName("mips"); if (var.IsValid) { bool b = var.AsScalar().GetFloat() > 0.5f; this.Mips = b; } var = pd.GetAnnotationByName("scale"); if (var.IsValid) { this.Scale = var.AsScalar().GetFloat(); this.DoScale = true; } var = pd.GetAnnotationByName("initial"); if (var.IsValid) { bool b = var.AsScalar().GetFloat() > 0.5f; this.Reference = b ? eImageScaleReference.Initial : eImageScaleReference.Previous; } var = pd.GetAnnotationByName("clear"); if (var.IsValid) { bool b = var.AsScalar().GetFloat() > 0.5f; this.Clear = b; } var = pd.GetAnnotationByName("usedepth"); if (var.IsValid) { bool b = var.AsScalar().GetFloat() > 0.5f; this.UseDepth = b; } var = pd.GetAnnotationByName("keeptarget"); if (var.IsValid) { bool b = var.AsScalar().GetFloat() > 0.5f; this.KeepTarget = b; } var = pd.GetAnnotationByName("hasstate"); if (var.IsValid) { bool b = var.AsScalar().GetFloat() > 0.5f; this.HasState = b; } var = pd.GetAnnotationByName("blendpreset"); if (var.IsValid) { string blend = var.AsString().GetString(); this.BlendPreset = blend; } var = pd.GetAnnotationByName("depthpreset"); if (var.IsValid) { string depth = var.AsString().GetString(); this.DepthPreset = depth; } }