-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Vector node, considerably increase performance, fix bugs, improve…
… IntegerUpDown again
- Loading branch information
Showing
20 changed files
with
451 additions
and
94 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Nodex.Resources.Windows; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Nodex.Classes | ||
{ | ||
public static class Debugger | ||
{ | ||
public static void AddValue(object obj) | ||
{ | ||
DebugWindow debugWindow = ((MainWindow)App.Current.MainWindow).debugWindow; | ||
debugWindow.listboxInfo.Items.Add(obj); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Nodex.Classes | ||
{ | ||
public static class ExtraMath | ||
{ | ||
public static int Step(double value, int factor) | ||
{ | ||
int nearestMultiple = (int)Math.Round( | ||
value / factor, | ||
MidpointRounding.AwayFromZero | ||
) * factor; | ||
return nearestMultiple; | ||
} | ||
|
||
public static int FloorStep(double value, int factor) | ||
{ | ||
int nearestMultiple = (int)Math.Floor( | ||
value / factor | ||
) * factor; | ||
return nearestMultiple; | ||
} | ||
|
||
public static int CeilingStep(double value, int factor) | ||
{ | ||
int nearestMultiple = (int)Math.Ceiling( | ||
value / factor | ||
) * factor; | ||
return nearestMultiple; | ||
} | ||
} | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Nodex.Resources.Controls; | ||
using System; | ||
using System.Drawing; | ||
using System.Numerics; | ||
|
||
namespace Nodex.Classes.Nodes.Inputs | ||
{ | ||
public class VectorNode : INode | ||
{ | ||
public NodeControl nodeControl { get; set; } | ||
|
||
public VectorNode() | ||
{ | ||
INode node = this; | ||
nodeControl = new NodeControl(new Node( | ||
Node.NodeCategory.Texture, | ||
"Vector", | ||
new NodeIO[0] , | ||
new NodeIO[] { new NodeIO(NodeIO.NodeIOCategory.Vector, "Vector", NodeIO.NodeIOType.Output) }, | ||
new NodeProperty[] { new NodeProperty(new Vector4Control() { Height = 96 }, "Vector") }, | ||
node.Calculate | ||
), this.GetType()) | ||
{ Width = 80, Height = 70 }; | ||
} | ||
|
||
object[] INode.Calculate(NodeIO[] inputs, NodeProperty[] properties) | ||
{ | ||
Vector4 vector = ((Vector4Control)properties[0].propertyElement).Vector; | ||
Debugger.AddValue("vector node: " + vector); | ||
return new object[] { vector }; | ||
} | ||
} | ||
} |
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
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
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
Oops, something went wrong.