forked from mrvux/dx11-vvvv
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
94 additions
and
83 deletions.
There are no files selected for viewing
166 changes: 83 additions & 83 deletions
166
Nodes/VVVV.DX11.Nodes/Nodes/Geometry/GeometryTopologyNode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,83 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.ComponentModel.Composition; | ||
|
||
using SlimDX; | ||
using SlimDX.Direct3D11; | ||
|
||
using VVVV.PluginInterfaces.V2; | ||
using VVVV.PluginInterfaces.V1; | ||
|
||
using FeralTic.DX11; | ||
using FeralTic.DX11.Resources; | ||
|
||
namespace VVVV.DX11.Nodes | ||
{ | ||
[PluginInfo(Name = "Topology", Category = "DX11.Geometry", Version = "", Author = "vux")] | ||
public class GeometryTopologyNode : IPluginEvaluate, IDX11ResourceProvider | ||
{ | ||
[Input("Geometry In",CheckIfChanged=true)] | ||
protected Pin<DX11Resource<IDX11Geometry>> FInGeom; | ||
|
||
[Input("Topology")] | ||
protected IDiffSpread<PrimitiveTopology> FInTopology; | ||
|
||
[Input("Enabled")] | ||
protected IDiffSpread<bool> FInEnabled; | ||
|
||
[Output("Geometry Out")] | ||
protected ISpread<DX11Resource<IDX11Geometry>> FOutGeom; | ||
|
||
bool invalidate = false; | ||
|
||
public void Evaluate(int SpreadMax) | ||
{ | ||
invalidate = false; | ||
|
||
if (this.FInGeom.PluginIO.IsConnected) | ||
{ | ||
this.FOutGeom.SliceCount = SpreadMax; | ||
|
||
for (int i = 0; i < SpreadMax; i++) { if (this.FOutGeom[i] == null) { this.FOutGeom[i] = new DX11Resource<IDX11Geometry>(); } } | ||
|
||
invalidate = this.FInGeom.IsChanged || this.FInEnabled.IsChanged || this.FInTopology.IsChanged; | ||
|
||
if (invalidate) { this.FOutGeom.Stream.IsChanged = true; } | ||
} | ||
else | ||
{ | ||
this.FOutGeom.SliceCount = 0; | ||
} | ||
} | ||
|
||
public void Update(IPluginIO pin, DX11RenderContext context) | ||
{ | ||
Device device = context.Device; | ||
|
||
if (this.invalidate) | ||
{ | ||
for (int i = 0; i < this.FOutGeom.SliceCount; i++) | ||
{ | ||
if (this.FInEnabled[i] && this.FInTopology[i] != PrimitiveTopology.Undefined) | ||
{ | ||
|
||
IDX11Geometry geom = this.FInGeom[i][context].ShallowCopy(); | ||
geom.Topology = this.FInTopology[i]; | ||
this.FOutGeom[i][context] = geom; | ||
} | ||
else | ||
{ | ||
this.FOutGeom[i][context] = this.FInGeom[i][context]; | ||
} | ||
} | ||
} | ||
} | ||
|
||
public void Destroy(IPluginIO pin, DX11RenderContext context, bool force) | ||
{ | ||
//Not ownding resource eg: do nothing | ||
} | ||
} | ||
} | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.ComponentModel.Composition; | ||
|
||
using SlimDX; | ||
using SlimDX.Direct3D11; | ||
|
||
using VVVV.PluginInterfaces.V2; | ||
using VVVV.PluginInterfaces.V1; | ||
|
||
using FeralTic.DX11; | ||
using FeralTic.DX11.Resources; | ||
|
||
namespace VVVV.DX11.Nodes | ||
{ | ||
[PluginInfo(Name = "Topology", Category = "DX11.Geometry", Version = "", Author = "vux")] | ||
public class GeometryTopologyNode : IPluginEvaluate, IDX11ResourceProvider | ||
{ | ||
[Input("Geometry In",CheckIfChanged=true)] | ||
protected Pin<DX11Resource<IDX11Geometry>> FInGeom; | ||
|
||
[Input("Topology")] | ||
protected IDiffSpread<PrimitiveTopology> FInTopology; | ||
|
||
[Input("Enabled")] | ||
protected IDiffSpread<bool> FInEnabled; | ||
|
||
[Output("Geometry Out")] | ||
protected ISpread<DX11Resource<IDX11Geometry>> FOutGeom; | ||
|
||
bool invalidate = false; | ||
|
||
public void Evaluate(int SpreadMax) | ||
{ | ||
invalidate = false; | ||
|
||
if (this.FInGeom.PluginIO.IsConnected) | ||
{ | ||
this.FOutGeom.SliceCount = SpreadMax; | ||
|
||
for (int i = 0; i < SpreadMax; i++) { if (this.FOutGeom[i] == null) { this.FOutGeom[i] = new DX11Resource<IDX11Geometry>(); } } | ||
|
||
invalidate = this.FInGeom.IsChanged || this.FInEnabled.IsChanged || this.FInTopology.IsChanged; | ||
|
||
if (invalidate) { this.FOutGeom.Stream.IsChanged = true; } | ||
} | ||
else | ||
{ | ||
this.FOutGeom.SliceCount = 0; | ||
} | ||
} | ||
|
||
public void Update(IPluginIO pin, DX11RenderContext context) | ||
{ | ||
Device device = context.Device; | ||
|
||
if (this.invalidate) | ||
{ | ||
for (int i = 0; i < this.FOutGeom.SliceCount; i++) | ||
{ | ||
if (this.FInEnabled[i] && this.FInTopology[i] != PrimitiveTopology.Undefined) | ||
{ | ||
|
||
IDX11Geometry geom = this.FInGeom[i][context].ShallowCopy(); | ||
geom.Topology = this.FInTopology[i]; | ||
this.FOutGeom[i][context] = geom; | ||
} | ||
else | ||
{ | ||
this.FOutGeom[i][context] = this.FInGeom[i][context]; | ||
} | ||
} | ||
} | ||
} | ||
|
||
public void Destroy(IPluginIO pin, DX11RenderContext context, bool force) | ||
{ | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters