Skip to content

Commit

Permalink
[Nodes] Add GetSpread (DX11.Layer Order)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrvux committed Mar 28, 2017
1 parent 2b0e76d commit 7a54883
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using SlimDX;

using VVVV.PluginInterfaces.V2;

using FeralTic.Resources.Geometry;

using VVVV.DX11.Validators;

namespace VVVV.DX11.Nodes
{
[PluginInfo(Name = "GetSpread", Category = "DX11.Layer", Version = "Order", Author = "vux", Tags = "layer")]
public class LayerGetSpreadOrderNode : IPluginEvaluate
{
public class DX11LayerGetSpreadOrder : IDX11LayerOrder
{
private List<int> internalBuffer = new List<int>();

public bool Enabled
{
get;
set;
}

public ISpread<int> FInIndex { get; set; }
public ISpread<int> FInCount { get; set; }

public List<int> Reorder(DX11RenderSettings settings, List<DX11ObjectRenderSettings> objectSettings)
{
internalBuffer.Clear();
int spreadMax = SpreadUtils.SpreadMax(this.FInCount, this.FInIndex);
for (int i = 0; i < spreadMax; i++)
{
int start = this.FInIndex[i];
int count = this.FInCount[i];
for (int j = 0; j < count; j++)
{
internalBuffer.Add(start + j);
}
}
return this.internalBuffer;
}
}

[Input("Enabled", DefaultValue = 1)]
protected ISpread<bool> FInEnabled;

[Input("Index")]
protected ISpread<int> FInIndex;

[Input("Count", DefaultValue =1)]
protected ISpread<int> FInCount;

[Output("Output", IsSingle = true)]
protected ISpread<DX11LayerGetSpreadOrder> FOut;

public void Evaluate(int SpreadMax)
{
if (this.FOut[0] == null) { this.FOut[0] = new DX11LayerGetSpreadOrder(); }

this.FOut[0].Enabled = this.FInEnabled[0];
this.FOut[0].FInIndex = this.FInIndex;
this.FOut[0].FInCount = this.FInCount;
}
}


}
1 change: 1 addition & 0 deletions Nodes/VVVV.DX11.Nodes/VVVV.DX11.Nodes.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<Compile Include="Legacy\DX11LayerStencilRefNode.cs" />
<Compile Include="Nodes\Layers\DX11LayerOrderNode.cs" />
<Compile Include="Nodes\Layers\DX11ResetCounterNode.cs" />
<Compile Include="Nodes\Layers\Order\LayerGetSpreadOrderNode.cs" />
<Compile Include="Nodes\Layers\Order\LayerZSortOrderNode.cs" />
<Compile Include="Nodes\Layers\Order\LayerGetSliceOrderNode.cs" />
<Compile Include="Nodes\Layers\ReadonlyDepthStencilNode.cs" />
Expand Down
2 changes: 1 addition & 1 deletion girlpower

0 comments on commit 7a54883

Please sign in to comment.