5 int culooks::cube::allid = 0;
7 void culooks::cube::draw()
9 glMatrixMode(GL_MODELVIEW);
12 glScalef(zoom, zoom, zoom);
13 glRotatef(az, 0, 1, 0);
14 glRotatef(alt, 1, 0, 0);
21 void culooks::cube::drawAll()
23 glMatrixMode(GL_MODELVIEW);
26 glTranslatef(-1,-1,-1);
28 for (int iz=0; iz<l; iz++) {
29 for (int iy=0; iy<l; iy++) {
30 for (int ix=0; ix<l; ix++) {
32 glTranslatef(2.0*ix/l,2.0*iy/l,2.0*iz/l);
33 glScalef(2.0/l,2.0/l,2.0/l);
37 glColor4f(link[iz*l*l*3*4 + iy*l*3*4 + ix*3*4 + 0*4 + 0],
38 link[iz*l*l*3*4 + iy*l*3*4 + ix*3*4 + 0*4 + 1],
39 link[iz*l*l*3*4 + iy*l*3*4 + ix*3*4 + 0*4 + 2],
40 link[iz*l*l*3*4 + iy*l*3*4 + ix*3*4 + 0*4 + 3]);
41 glVertex3f(0,0,0); glVertex3f(1,0,0);
42 glColor4f(link[iz*l*l*3*4 + iy*l*3*4 + ix*3*4 + 1*4 + 0],
43 link[iz*l*l*3*4 + iy*l*3*4 + ix*3*4 + 1*4 + 1],
44 link[iz*l*l*3*4 + iy*l*3*4 + ix*3*4 + 1*4 + 2],
45 link[iz*l*l*3*4 + iy*l*3*4 + ix*3*4 + 1*4 + 3]);
46 glVertex3f(0,0,0); glVertex3f(0,1,0);
47 glColor4f(link[iz*l*l*3*4 + iy*l*3*4 + ix*3*4 + 2*4 + 0],
48 link[iz*l*l*3*4 + iy*l*3*4 + ix*3*4 + 2*4 + 1],
49 link[iz*l*l*3*4 + iy*l*3*4 + ix*3*4 + 2*4 + 2],
50 link[iz*l*l*3*4 + iy*l*3*4 + ix*3*4 + 2*4 + 3]);
51 glVertex3f(0,0,0); glVertex3f(0,0,1);
57 glColor4f(plaq[iz*l*l*3*4 + iy*l*3*4 + ix*3*4 + 2*4 + 0],
58 plaq[iz*l*l*3*4 + iy*l*3*4 + ix*3*4 + 2*4 + 1],
59 plaq[iz*l*l*3*4 + iy*l*3*4 + ix*3*4 + 2*4 + 2],
60 plaq[iz*l*l*3*4 + iy*l*3*4 + ix*3*4 + 2*4 + 3]);
61 glVertex3f(0, 0, 0); glVertex3f(1, 0, 0); glVertex3f(1, 1, 0); glVertex3f(0, 1, 0);
62 glColor4f(plaq[iz*l*l*3*4 + iy*l*3*4 + ix*3*4 + 1*4 + 0],
63 plaq[iz*l*l*3*4 + iy*l*3*4 + ix*3*4 + 1*4 + 1],
64 plaq[iz*l*l*3*4 + iy*l*3*4 + ix*3*4 + 1*4 + 2],
65 plaq[iz*l*l*3*4 + iy*l*3*4 + ix*3*4 + 1*4 + 3]);
66 glVertex3f(0, 0, 0); glVertex3f(1, 0, 0); glVertex3f(1, 0, 1); glVertex3f(0, 0, 1);
67 glColor4f(plaq[iz*l*l*3*4 + iy*l*3*4 + ix*3*4 + 0*4 + 0],
68 plaq[iz*l*l*3*4 + iy*l*3*4 + ix*3*4 + 0*4 + 1],
69 plaq[iz*l*l*3*4 + iy*l*3*4 + ix*3*4 + 0*4 + 2],
70 plaq[iz*l*l*3*4 + iy*l*3*4 + ix*3*4 + 0*4 + 3]);
71 glVertex3f(0, 0, 0); glVertex3f(0, 1, 0); glVertex3f(0, 1, 1); glVertex3f(0, 0, 1);
82 culooks::cube::cube(int _l)
85 link = new float[l*l*l*3 * 4];
86 plaq = new float[l*l*l*3 * 4];
93 for (int i=0; i<l*l*l*3; i++) {
94 link[i*4+0]=1; link[i*4+3]=0.6;
95 plaq[i*4+1]=1; plaq[i*4+3]=0.2;