diff --git a/Bonsai.Shaders/BindTexture.cs b/Bonsai.Shaders/BindTexture.cs index 7892a9d6c..74a60ef82 100644 --- a/Bonsai.Shaders/BindTexture.cs +++ b/Bonsai.Shaders/BindTexture.cs @@ -58,7 +58,23 @@ public bool IndexSpecified get { return Index.HasValue; } } - IObservable Process(IObservable source, Action update) + /// + /// Binds the specified texture buffer to the specified texture unit for + /// each notification in an observable sequence. + /// + /// + /// The type of the elements in the sequence. + /// + /// + /// The sequence containing the notifications indicating when to bind + /// the texture buffer to the specified texture unit. + /// + /// + /// An observable sequence that is identical to the source sequence but where + /// there is an additional side effect of binding the texture buffer to the + /// specified texture unit. + /// + public IObservable Process(IObservable source) { return Observable.Defer(() => { @@ -76,43 +92,25 @@ IObservable Process(IObservable source, Action { GL.ActiveTexture(TextureSlot); GL.BindTexture(TextureTarget, textureId); }); } - else if (update != null) shader.Update(() => update(input)); + return input; }); }); } - /// - /// Binds the specified texture buffer to the specified texture unit for - /// each notification in an observable sequence. - /// - /// - /// The type of the elements in the sequence. - /// - /// - /// The sequence containing the notifications indicating when to bind - /// the texture buffer to the specified texture unit. - /// - /// - /// An observable sequence that is identical to the source sequence but where - /// there is an additional side effect of binding the texture buffer to the - /// specified texture unit. - /// - public IObservable Process(IObservable source) - { - return Process(source, update: null); - } - /// /// Binds each texture buffer in an observable sequence to the specified /// texture unit for each notification in an observable sequence. @@ -132,12 +130,7 @@ public IObservable Process(IObservable source) /// in the sequence to the specified texture unit. /// public IObservable Process(IObservable source) - { - return Process(source, input => - { - GL.ActiveTexture(TextureSlot); - GL.BindTexture(TextureTarget, input != null ? input.Id : 0); - }); - } + // This overload only exists for documentation reasons + => Process(source); } }