From bb6498e5ff6a8a8af8c06300dac051659a37e89b Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Thu, 22 May 2014 08:36:24 +0100 Subject: NT figuring out type system --- NT/src/nodes.h | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) (limited to 'NT/src/nodes.h') 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 { - public: - Double_node(){}; - }; - class Time: public Double_node { + typedef Node_type Number_node; + typedef Node_type String_node; + typedef Node_type Image_node; + + typedef Variable_type Number_inlet; + typedef Variable_type String_inlet; + typedef Variable_type Image_inlet; + + typedef Variable_array_type Number_array; + typedef Variable_array_type String_array; + typedef Variable_array_type 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 *factors; - double result; - }; - class String_node: public Node_type { - 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 *inlet; - std::string result; + Double_inlet *inlet; }; } -- cgit v1.2.3