8 vector< pair<int,culooks::window*> > culooks::Windows;
9 pthread_t culooks::glThreadId;
10 culooks::comarg culooks::comArg;
12 int culooks::windowid = 0;
16 culooks::culooks (const char* name, const int& xcubes, const int& ycubes, const int& l, int *argc, char **argv)
18 window *Win = new window;
23 Win->layout[0] = xcubes;
24 Win->layout[1] = ycubes;
25 Win->aspect = (double)xcubes/ycubes;
26 for (int icube=0; icube<xcubes*ycubes; icube++) {
28 Win->cubes.push_back(newCube);
31 if( Win->layout[0] >= Win->layout[1] ) {
33 winsize[1] = (640.0/Win->layout[0])*Win->layout[1];
37 winsize[0] = (640.0/Win->layout[1])*Win->layout[0];
45 Win->initialized = false;
49 Windows.push_back( pair<int,culooks::window*>(0, Win) );
54 pthread_create(&glThreadId, 0, &drawing::glutThread, &comArg);
60 void culooks::setLink (const int& cubeid, const int& posdir,
61 const float& red, const float& green, const float& blue, const float& alpha)
63 Windows[mywid].second->cubes[cubeid].setLink(posdir, red, green, blue, alpha);
66 void culooks::setPlaq (const int& cubeid, const int& posdir,
67 const float& red, const float& green, const float& blue, const float& alpha)
69 Windows[mywid].second->cubes[cubeid].setPlaq(posdir, red, green, blue, alpha);
72 void culooks::swapBuffers () {
73 for (int icube=0; icube<Windows[mywid].second->cubes.size(); icube++) {
74 Windows[mywid].second->cubes[icube].swapLinkBuffer();
75 Windows[mywid].second->cubes[icube].swapPlaqBuffer();
77 Windows[mywid].second->redisplay = true;
80 void culooks::hidePlaqs (const int& cubeid) {
81 Windows[mywid].second->cubes[cubeid].hidePlaqs();
84 void culooks::hidePlaqs () {
85 for (int icube=0; icube<Windows[mywid].second->cubes.size(); icube++)
86 Windows[mywid].second->cubes[icube].hidePlaqs();
89 void culooks::hideLinks (const int& cubeid) {
90 Windows[mywid].second->cubes[cubeid].hideLinks();
93 void culooks::hideLinks () {
94 for (int icube=0; icube<Windows[mywid].second->cubes.size(); icube++)
95 Windows[mywid].second->cubes[icube].hideLinks();
98 void culooks::setBgColor(const float& red, const float& green, const float& blue, const float& alpha)
100 Windows[mywid].second->bgcolor[0] = red;
101 Windows[mywid].second->bgcolor[1] = green;
102 Windows[mywid].second->bgcolor[2] = blue;
103 Windows[mywid].second->bgcolor[3] = alpha;
106 void culooks::setWireColor(const float& r, const float& g, const float& b, const float& a)
108 for (int icube=0; icube<Windows[mywid].second->cubes.size(); icube++)
109 Windows[mywid].second->cubes[icube].setWireColor(r, g, b, a);
112 void culooks::setFrameWidth(float width)
114 for (int icube=0; icube<Windows[mywid].second->cubes.size(); icube++)
115 Windows[mywid].second->cubes[icube].setFrameWidth(width);
118 void culooks::setLinkWidth(float width)
120 for (int icube=0; icube<Windows[mywid].second->cubes.size(); icube++)
121 Windows[mywid].second->cubes[icube].setLinkWidth(width);