-
Notifications
You must be signed in to change notification settings - Fork 2
/
of.node.pd
90 lines (90 loc) · 3.92 KB
/
of.node.pd
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
#N canvas 299 -877 919 855 12;
#X obj 11 4 inlet;
#X obj 70 2 inlet;
#X obj 140 2 inlet;
#X obj 220 2 inlet;
#X obj 300 2 inlet;
#X text 794 755 RI;
#X msg 70 28 tx \$1;
#X msg 140 28 ty \$1;
#X msg 220 28 tz \$1;
#X msg 300 28 ox \$1;
#X obj 370 2 inlet;
#X obj 440 2 inlet;
#X msg 370 28 oy \$1;
#X msg 440 28 oz \$1;
#X obj 502 2 inlet;
#X obj 572 2 inlet;
#X obj 642 2 inlet;
#X msg 502 28 sx \$1;
#X msg 572 28 sy \$1;
#X msg 642 28 sz \$1;
#X obj 11 816 outlet;
#X obj 11 770 list trim;
#X obj 62 816 outlet;
#X obj 11 793 route bang;
#X text 356 747 Todo \; get more useful data...;
#X obj 11 55 ofelia d myNode-\$0 \; local c = ofCanvas(this) \; local
args = c:getArgs() \; local outlet = ofOutlet(this) \; local position
\, orientation \, scale \, lookat \, debug = ofVec3f() \, ofVec3f()
\, ofVec3f(1 \, 1 \, 1) \, ofVec3f() \, 0 \; \; function M.new() \;
ofWindow.addListener("setup" \, this) \; if args[1] == nil then position.x
= 0 else position.x = args[1] end \; if args[2] == nil then position.y
= 0 else position.y = args[2] end \; if args[3] == nil then position.z
= 0 else position.z = args[3] end \; if args[4] == nil then orientation.x
= 0 else orientation.x = args[4] end \; if args[5] == nil then orientation.y
= 0 else orientation.y = args[5] end \; if args[6] == nil then orientation.z
= 0 else orientation.z = args[6] end \; if args[7] == nil then scale.x
= 1 else scale.x = args[7] end \; if args[8] == nil then scale.y =
1 else scale.y = args[8] end \; if args[9] == nil then scale.z = 1
else scale.z = args[9] end \; M.setup() \; end \; function M.free()
\; ofWindow.removeListener("setup" \, this) end \; function M.setup()
\; node\$0 = ofNode() \; node\$0:setPosition(position:vec3()) node\$0:setOrientation(orientation:vec3())
node\$0:setScale(scale:vec3()) \; end \; \; function M.list(l) M.tx(l[1])
M.ty(l[2]) M.tz(l[3]) M.ox(l[4]) M.oy(l[5]) M.oz(l[6]) M.sx(l[7]) M.sy(l[8])
M.sz(l[9]) end \; function M.tx(f) position.x = f node\$0:setPosition(position:vec3())
end \; function M.ty(f) position.y = f node\$0:setPosition(position:vec3())
end \; function M.tz(f) position.z = f node\$0:setPosition(position:vec3())
end \; function M.ox(f) orientation.x = f node\$0:setOrientation(orientation:vec3())
end \; function M.oy(f) orientation.y = f node\$0:setOrientation(orientation:vec3())
end \; function M.oz(f) orientation.z = f node\$0:setOrientation(orientation:vec3())
end \; function M.sx(f) scale.x = f node\$0:setScale(scale:vec3())
end \; function M.sy(f) scale.y = f node\$0:setScale(scale:vec3())
end \; function M.sz(f) scale.z = f node\$0:setScale(scale:vec3())
end \; function M.move(l) node\$0:move(l[1] \, l[2] \, l[3]) end \;
function M.debug(f) debug = f end \; function M.position(l) position.x=l[1]
position.y=l[2] position.z=l[3] node\$0:setPosition(position:vec3())
end \; function M.orientation(l) orientation.x=l[1] orientation.y=l[2]
orientation.z=l[3] node\$0:setOrientation(orientation:vec3()) end \;
function M.scale(l) scale.x=l[1] scale.y=l[2] scale.z=l[3] node\$0:setScale(scale:vec3())
end \; function M.lookat(l) lookat.x=l[1] lookat.y=l[2] lookat.z=l[3]
node\$0:lookAt(lookat:vec3()) end \; function M.get() return ofTable
(node\$0:getX() \, node\$0:getY() \, node\$0:getZ() \, node\$0:getPitchDeg()
\, node\$0:getRollDeg())end \; \; function M.bang() \; if debug ==
1 then ofDisableLighting() node\$0:draw() end if _lighting == 1 then
ofEnableLighting() end \; node\$0:transformGL() \; outlet:outletBang(0)
\; node\$0:restoreTransformGL() \; end \;;
#X f 136;
#X connect 0 0 25 0;
#X connect 1 0 6 0;
#X connect 2 0 7 0;
#X connect 3 0 8 0;
#X connect 4 0 9 0;
#X connect 6 0 25 0;
#X connect 7 0 25 0;
#X connect 8 0 25 0;
#X connect 9 0 25 0;
#X connect 10 0 12 0;
#X connect 11 0 13 0;
#X connect 12 0 25 0;
#X connect 13 0 25 0;
#X connect 14 0 17 0;
#X connect 15 0 18 0;
#X connect 16 0 19 0;
#X connect 17 0 25 0;
#X connect 18 0 25 0;
#X connect 19 0 25 0;
#X connect 21 0 23 0;
#X connect 23 0 20 0;
#X connect 23 1 22 0;
#X connect 25 0 21 0;