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
|
#include "TangibleInterfaces/Input/TangibleConnection.h"
#include "TangibleInterfaces/Input/TangibleInterface.h"
TangibleConnection::TangibleConnection(SurfaceInterface * out,
SurfaceInterface * in)
: SurfaceConnection(out, in)
{
_out = (TangibleInterface*)out;
_in = (TangibleInterface*)in;
}
TangibleConnection::~TangibleConnection() {}
void TangibleConnection::__paint()
{
// if(_out->_muted)
// {
// glLineWidth(2);
// glColorWidgetActive();
//
// glBegin(GL_LINES);
// for(int i = 0; i < 10; i++)
// {
// glVertex3d(double(i)/10.0, 0.0, 0.0);
// glVertex3d(double(i)/10.0+0.05, 0.0, 0.0);
// }
// glEnd();
//
// return;
// }
TangibleInterface::ConnectionDescriptor::List outConns = _out->GetConnectedSinkInterfaces();
if(outConns.empty())
return;
Delay & delay = _out->_outPushedHistory;
int historySize = delay.size();
glPushMatrix();
glScaled(m_distance, 0.5, 1.0);
qreal deltaX = 1.0/historySize;
glTranslated(0.0, 0.0, -0.001);
glBegin(GL_QUADS);
for(int i = 0; i < historySize; i++)
{
qreal deltaY = delay[historySize-i];
glColor4d(1.0, 1.0, 1.0, 0.4);
glVertex3d(i*deltaX, -deltaY, 0.0);
glVertex3d(i*deltaX +deltaX -0.005, -deltaY, 0.0);
glVertex3d(i*deltaX +deltaX -0.005, deltaY, 0.0);
glVertex3d(i*deltaX, deltaY, 0.0);
}
glEnd();
glPopMatrix();
}
bool TangibleConnection::discardInput()
{
return false;
}
void TangibleConnection::__fingerOn(const FingerEvent & event)
{
if(!this->pointInObject(event.pos()))
return;
/* finerOn within connection always mutes temporarily */
// if(event.path().isFirstValid())
// _out->_muted = true;
}
void TangibleConnection::__fingerOff(const FingerEvent & event)
{
if(!this->pointInObject(event.pos()))
return;
// if(event.path().isFirstValid())
// _out->_muted = false;
}
void TangibleConnection::__fingerCrossed(const FingerEvent & event)
{
if(!this->pointInObject(event.pos()))
return;
// _out->_muted = true;
}
|