[BACK]Return to icosahedron.rr CVS log [TXT][DIR] Up to [local] / OpenXM / src / cfep / Samples

Annotation of OpenXM/src/cfep/Samples/icosahedron.rr, Revision 1.1.1.1

1.1       takayama    1: def test3() {
                      2:   glib_init_send("0;[glib3_std_scene0]");
                      3:   glib_init_send("0;[glib_flush]");
                      4:   glib_send("0;[glib3_icosahedron]");
                      5:   glib_send("0;[glib_flush]");
                      6: }
                      7: def test1() {
                      8:   for (I= 0; I<1.0; I += 0.05) {
                      9:      myline(0,0,0.6,I, [random()%256,random()%256,random()%256]);
                     10:  }  /* bug なぜか線の色が黒になる.  color が全部0. 2006.02.22*/
                     11:  glib_send("1;[glib_flush]");
                     12: }
                     13: def myline(X,Y,X2,Y2,C) {
                     14:   X = rtostr(deval(X)); Y = rtostr(deval(Y));
                     15:   X2 = rtostr(deval(X2)); Y2=rtostr(deval(Y2));
                     16:   CC = C[0]*(256*256)+C[1]*256+C[0];
                     17:   CC=rtostr(CC); print(C,0); print(CC);
                     18:   glib_send("1; [glib_line,"+X+","+Y+","+X2+","+Y2+","+CC+"]");
                     19: }
                     20: def t_encode1(X) {
                     21:   return [
                     22:      ior(0xf8,iand(0x3,ishift(X,6))),
                     23:      ior(0xf0,iand(0x7,ishift(X,3))),
                     24:      ior(0xf0,iand(0x7,X))];
                     25: }
                     26: def t_encode_str(S) {
                     27:   Ans = [ ];
                     28:   Codes = strtoascii(S);
                     29:   N = length(Codes);
                     30:   for (I=0; I<N; I++) {
                     31:      T = t_encode1(Codes[I]);
                     32:      Ans = cons(T[0],Ans);
                     33:      Ans = cons(T[1],Ans);
                     34:      Ans = cons(T[2],Ans);
                     35:   }
                     36:   return reverse(Ans);
                     37: }
                     38: def t_encode(S) {
                     39:   return asciitostr(t_encode_str(S));
                     40: }
                     41: def glib_send(S) {
                     42:    S=S+"\n";
                     43:    N=length(strtoascii(S))+1;
                     44:    C=t_encode("{1<"+rtostr(N)+" "+S+" >}");
                     45:    ctrl("hex",1);
                     46:    output(); ctrl("hex",0);
                     47:    print(C); output(); /* channel 1 にコマンドを送る */
                     48: }
                     49: def glib_init_send(S) {
                     50:    S=S+"\n";
                     51:    N=length(strtoascii(S))+1;
                     52:    C=t_encode("{2<"+rtostr(N)+" "+S+" >}");
                     53:    ctrl("hex",1);
                     54:    output(); ctrl("hex",0);
                     55:    print(C); output(); /* channel 2 にコマンドを送る. OpenGL 初期化 */
                     56: }
                     57: test3();
                     58:
                     59:
                     60:

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>