-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAndMatrixFilterElement.cs
85 lines (70 loc) · 2.53 KB
/
AndMatrixFilterElement.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
using System;
using System.Collections.Generic;
using System.Text;
using MetaphysicsIndustries.Solus;
using MetaphysicsIndustries.Epiphany;
using MetaphysicsIndustries.Collections;
using MetaphysicsIndustries.Acuity;
namespace MetaphysicsIndustries.Amethyst
{
[Serializable]
public class AndMatrixFilterElement : MatrixFilterElement
{
public AndMatrixFilterElement()
: base(new AndMatrixFilterNode())
{
}
public new AndMatrixFilterNode Node
{
get { return (AndMatrixFilterNode)base.Node; }
}
protected override void InitTerminals()
{
base.InitTerminals();
//TerminalsByConnection[Node.Input].Position = Height / 2;
TerminalsByConnection[Node.Input].DisplayText = "A";
//TerminalsByConnection[Node.Input2].Side = BoxOrientation.Up;
TerminalsByConnection[Node.Input2].DisplayText = "B";
//TerminalsByConnection[Node.Input2].Position = Width / 2;
}
[Serializable]
public class AndMatrixFilterNode : MatrixFilterNode
{
public AndMatrixFilterNode()
: base(new AndBiModulatorMatrixFilter(), "And")
{
}
private InputConnection<Matrix> _input2 = new InputConnection<Matrix>("Input2");
public InputConnection<Matrix> Input2
{
get { return _input2; }
}
public new AndBiModulatorMatrixFilter Filter
{
get { return (AndBiModulatorMatrixFilter)base.Filter; }
}
protected override void InitConnections()
{
base.InitConnections();
InputConnectionBases.Add(Input2);
}
public override void Execute(Dictionary<InputConnectionBase, object> inputs, Dictionary<OutputConnectionBase, object> outputs)
{
Matrix a = (Matrix)inputs[Input];
Matrix b = (Matrix)inputs[Input2];
outputs[Output] = Filter.Apply2(new Pair<Matrix>(a, b));
}
}
public class AndBiModulatorMatrixFilter : BiModulatorMatrixFilter
{
public AndBiModulatorMatrixFilter()
: base(AndBiModulator)
{
}
public static float AndBiModulator(float x, float y)
{
return x * y;
}
}
}
}