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
86
87
88
89
90
91
92
93
94
95
96
97
98
|
#include "rotor.h"
#include "nodes_audio_analysis.h"
#include "nodes_maths.h"
#include "nodes_drawing.h"
#include "nodes_filters.h"
#include "nodes_transform.h"
using namespace Rotor;
using Poco::Logger;
Node_factory::Node_factory(){
//for now, statically load prototype map in constructor
//how to deal with categories
//have an associative array of arrays of pointers to nodes, "categories"
//this can be hard coded also
//
categories["signals"]=vector<Rotor::Node*>();
add_type("time",new Time(),categories["signals"]);
add_type("track_time",new Track_time(),categories["signals"]);
add_type("at_track_time",new At_track_time(),categories["signals"]);
//
add_type("signal_output",new Signal_output());
add_type("testcard",new Testcard());
//
categories["channels"]=vector<Rotor::Node*>();
add_type("invert",new Invert(),categories["channels"]);
add_type("monochrome",new Monochrome(),categories["channels"]);
add_type("blend",new Blend(),categories["channels"]);
add_type("image_arithmetic",new Image_arithmetic(),categories["channels"]);
add_type("alpha_merge",new Alpha_merge(),categories["channels"]);
add_type("difference_matte",new Difference_matte(),categories["channels"]);
add_type("rgb_levels",new RGB_levels(),categories["channels"]);
add_type("luma_levels",new Luma_levels(),categories["channels"]);
categories["source"]=vector<Rotor::Node*>();
add_type("signal_colour",new Signal_colour(),categories["source"]);
add_type("signal_greyscale",new Signal_greyscale(),categories["source"]);
add_type("shape",new Shape(),categories["source"]);
add_type("text",new Text(),categories["source"]);
add_type("waves",new Waves(),categories["source"]);
add_type("still_image",new Still_image(),categories["source"]);
add_type("video_loader",new Video_loader(),categories["source"]);
categories["distort"]=vector<Rotor::Node*>();
add_type("mirror",new Mirror(),categories["distort"]);
add_type("transform",new Transform(),categories["distort"]);
categories["editing"]=vector<Rotor::Node*>();
add_type("video_cycler",new Video_cycler(),categories["editing"]);
add_type("video_output",new Video_output(),categories["editing"]);
add_type("act_segmenter",new Act_segmenter(),categories["editing"]);
categories["audio"]=vector<Rotor::Node*>();
add_type("audio_analysis",new Audio_analysis(),categories["audio"]);
categories["maths"]=vector<Rotor::Node*>();
add_type("comparison",new Comparison(),categories["maths"]); //TODO: alias to symbols
add_type("arithmetic",new Arithmetic(),categories["maths"]); //TODO: alias to symbols
add_type("bang",new Is_new_integer(),categories["maths"]);
add_type("on_off",new On_off(),categories["maths"]);
add_type("random",new Random(),categories["maths"]);
categories["fx"]=vector<Rotor::Node*>();
add_type("blur",new Blur(),categories["fx"]);
add_type("vhs",new VHS(),categories["fx"]);
add_type("echo_trails",new Echo_trails(),categories["fx"]);
add_type("video_feedback",new Video_feedback(),categories["fx"]);
}
bool Signal_input::connect(Node* source) {
connection=dynamic_cast<Signal_node*>(source);
if (connection) return true;
else return false;
}
float Signal_input::get(const Time_spec& time){ //gets input and updates variable
if (connection){
return (((Signal_node*)connection)->get_output(time));
}
else return 0.0f;
}
bool Image_input::connect(Node* source) {
connection=dynamic_cast<Image_node*>(source);
if (connection) return true;
else return false;
}
Image* Image_input::get(const Frame_spec& time){ //gets input and updates variable
if (connection){
return (((Image_node*)connection)->get_image_output(time));
}
else return nullptr;
}
float Parameter::get(const Time_spec& time){ //gets input and updates variable
if (connection){
value = ((Signal_node*)connection)->get_output(time);
}
return value;
}
|