summaryrefslogtreecommitdiff
path: root/NT/src/nodes.h
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2014-05-22 08:36:24 +0100
committerTim Redfern <tim@eclectronics.org>2014-05-22 08:36:24 +0100
commitbb6498e5ff6a8a8af8c06300dac051659a37e89b (patch)
tree873cd3f3eba85e38c12995b077ce0db9ee82afab /NT/src/nodes.h
parentebc874413991fbc3d07493ece55f88f23e437af6 (diff)
NT figuring out type system
Diffstat (limited to 'NT/src/nodes.h')
-rw-r--r--NT/src/nodes.h41
1 files changed, 25 insertions, 16 deletions
diff --git a/NT/src/nodes.h b/NT/src/nodes.h
index 6bfb6f5..f6a8a0d 100644
--- a/NT/src/nodes.h
+++ b/NT/src/nodes.h
@@ -7,11 +7,27 @@
using namespace std;
namespace Rotor{
- class Double_node: public Node_type<double> {
- public:
- Double_node(){};
- };
- class Time: public Double_node {
+ typedef Node_type<double> Number_node;
+ typedef Node_type<string> String_node;
+ typedef Node_type<Image> Image_node;
+
+ typedef Variable_type<double> Number_inlet;
+ typedef Variable_type<string> String_inlet;
+ typedef Variable_type<Image> Image_inlet;
+
+ typedef Variable_array_type<double> Number_array;
+ typedef Variable_array_type<string> String_array;
+ typedef Variable_array_type<Image> Image_array;
+
+
+ //colour node could be an alias of vec3f node and they could be interchangeable?
+ //image node
+ //vector_image node: supporting scalable images
+ //image cache types?
+ //timeline type could get around the big problem with needing to find keyframes
+
+ //basic test nodes
+ class Time: public Number_node {
public:
Time(){
type="time";
@@ -24,12 +40,11 @@ namespace Rotor{
init(settings);
};
const double &get_output(const Frame_parameters &frame){
- value=frame.time;
- return value;
+ result=frame.time;
+ return result;
}
Time* clone(Json::Value &_settings) { return new Time(_settings);};
private:
- double value;
};
class Multiply: public Double_node {
public:
@@ -58,12 +73,7 @@ namespace Rotor{
}
Multiply* clone(Json::Value &_settings) { return new Multiply(_settings);};
private:
- Variable_array_type<double> *factors;
- double result;
- };
- class String_node: public Node_type<string> {
- public:
- String_node(){};
+ Double_array *factors;
};
class Print: public String_node {
public:
@@ -86,8 +96,7 @@ namespace Rotor{
}
Print* clone(Json::Value &_settings) { return new Print(_settings);};
private:
- Variable_type<double> *inlet;
- std::string result;
+ Double_inlet *inlet;
};
}