/// <inheritdoc/> public bool TryExecute(IReadWriteNormalizedTexture2D <Float4> texture, TimeSpan time, object?parameter) { if (this.shaderFactory is Func <TimeSpan, T> shaderFactory) { texture.GraphicsDevice.ForEach(texture, this.shaderFactory(time)); } else { texture.GraphicsDevice.ForEach(texture, this.statefulShaderFactory !(time, parameter)); } return(true); }
public bool TryExecute(IReadWriteNormalizedTexture2D <Float4> texture, TimeSpan timespan, object?parameter) { if (this.texture is null || this.texture.GraphicsDevice != texture.GraphicsDevice) { string filename = Path.Combine(Package.Current.InstalledLocation.Path, "Assets", "Textures", "RustyMetal.png"); this.texture?.Dispose(); this.texture = texture.GraphicsDevice.LoadReadOnlyTexture2D <Rgba32, Float4>(filename); } texture.GraphicsDevice.ForEach(texture, new ContouredLayers((float)timespan.TotalSeconds, this.texture)); return(true); }