diff --git a/Nodes/VVVV.DX11.Nodes/Nodes/Textures/Array/TextureArraySetSliceNode.cs b/Nodes/VVVV.DX11.Nodes/Nodes/Textures/Array/TextureArraySetSliceNode.cs index 5da8a4bc..8ac1615a 100644 --- a/Nodes/VVVV.DX11.Nodes/Nodes/Textures/Array/TextureArraySetSliceNode.cs +++ b/Nodes/VVVV.DX11.Nodes/Nodes/Textures/Array/TextureArraySetSliceNode.cs @@ -49,6 +49,9 @@ public class TextureArraySetSliceNode : IPluginEvaluate, IDX11ResourceHost, IDis [Output("Texture Array", IsSingle = true)] protected ISpread> FOutTB; + [Output("Texture Slices Out", Order = 3)] + protected ISpread> FOutSliceTextures; + private DX11Resource generators = new DX11Resource(); public void Evaluate(int SpreadMax) @@ -57,6 +60,15 @@ public void Evaluate(int SpreadMax) { this.FOutTB[0] = new DX11Resource(); } + + if (this.Depth.IsChanged) + { + this.FOutSliceTextures.SliceCount = this.Depth[0]; + for (int i = 0; i < this.Depth[0]; i++) + { + this.FOutSliceTextures[i] = new DX11Resource(); + } + } } public void Destroy(DX11RenderContext context, bool force) @@ -80,16 +92,28 @@ public void Update(DX11RenderContext context) if (this.FReset[0]) { generator.Reset(this.FTexIn[0][context], this.Width[0], this.Height[0], this.Depth[0], this.Format[0]); - this.FOutTB[0][context] = generator.Result; + this.WriteResult(generator, context); } else if (this.FWrite[0]) { generator.Apply(this.FTexIn[0][context], this.Width[0], this.Height[0], this.Depth[0], this.Format[0], this.FSliceIndex[0]); - this.FOutTB[0][context] = generator.Result; + this.WriteResult(generator, context); } } } + private void WriteResult(TextureArraySetSlice generator, DX11RenderContext context) + { + DX11RenderTextureArray result = generator.Result; + this.FOutTB[0][context] = generator.Result; + + for (int i = 0; i < this.FOutSliceTextures.SliceCount; i++) + { + DX11Texture2D slice = DX11Texture2D.FromTextureAndSRV(context, result.Resource, result.SliceRTV[i].SRV); + this.FOutSliceTextures[i][context] = slice; + } + } + public void Dispose() { if (this.generators != null)