YOMIKO.C   

<

^

>


                                                                    #ifndef/*2002/03*/J
                                                              #define J(x,y,z,X)/**/X##x##y##z
                                                          #include J(FI,LE,__,__)/*,__,__,__,__,*/
                                                       float B,C,c,v,x[2],Y,o,M,I,K,O,_,R,E,a,D,m,A,N,
                                                    w,h,f[11][4]={{.8,.8,.8,1},{.8,.8,1,1},{.8,1,.8,1},{1
                                                  ,.8,.8,1},{1,1,.8,1},{1,.8,1,1},{.8,1,1,1},{1,1,1,1},{0,1,
                                                1,0},{0,-1,-1,0},{0,0,0,0}},F[4][3]={{-5,0,-5},{-5,0,5},{5,0,5
                                               },{5.,0.,-5}};int G,g,l,P,Q,L,n,t,T,e,i,j,k;struct timeb z;typedef
                                             struct{float x,y,z,i,j,k,u,v,w;int p,q,d,b;}pp;struct{float v[4][3],n[       3];}s[128]
                                            [128],*r;pp d[2048],b[2048],*p,*q;typedef void U;U(*S)(U);U _r(U){ftime(&z);g=G;G=1000*
                     (z.time-l)+z.millitm  ;glDrawBuffer(GL_BACK);glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);glViewport(k=0
               ,0,P,Q);glMatrixMode(GL_PROJECTION);glLoadIdentity();glFrustum(-w,w,-h,h,10,2000);glMatrixMode(GL_MODELVIEW);J(L,
             oad,Identity,gl)();glLightfv(GL_LIGHT0,GL_POSITION,f[5]);glLightfv(GL_LIGHT0,GL_SPOT_DIRECTION,f[06]);gluLookAt(
                     640*sin(C),320*c,640*cos(C),0,0,0,0,1,0);for(;k<8;k++){glLightfv(GL_LIGHT0,GL_AMBIENT,f[k]);glBegin(J(
                          Q,U,ADS,GL_));p=&d[k];for(i=k;i<n;i+=8){glNormal3fv(s[p->p][p->q].n);for(j=0;j<4;j++)glVertex3f(s[p->p]
                         [p->q].v[j][0]+p->x,s[p->p][p->q].v[j][1]+p->y,s[p->p][p->q].v[j][2]+p->z);p+=8;}glEnd();}if(L){J(Dis,abl,e,
                    gl)(GL_LIGHTING);p=d;for(i=0;i<n;i++){glBegin(GL_LINE_LOOP);for(j=0;j<4;j++)glVertex3f(s[p->p][p->q].v[j][0]+p->x,s[p
                         ->p][p->q].v[j][1]+p->y,s[p->p][p->q].v[j][2]+p->z);;glEnd      ();;p++;}glEnable(GL_LIGHTING);;}glutSwapBuffers();
                       glFlush();}U H(U);U W(U){for(;p->x<-320;p->x+=640);for(;p->z      <-320;p->z+=640);for(;p->x>320;p->x-=640);for(;
                     p->z>320;p->z-=640);}U Z(int U){x[1]=1000*s[32][e].v[0][2];for       (x[0]=1000*s[32][e].v[0][i=0];i<U;i++){p->x=p->
                   i+x[0]*A;p->z=p->k+x[1]*A;W();p++;}}U X(int U){x[1]=sin(B*A*17);       for(x[0]=sin(B*A*10);i<U;i++){p->x=p->i+p->u*A*3
                 ;p->y=p->j+p->v*A*3;p->z=p->k+p->w*A*3;W();if(p->y<-320){p->j+=640        ;p->i=y(-320,320);p->k=y(-320,320);p->u=y(   -96
                ,96);p->w=y(-96,96);p->v=y(-640,-320);}N=(i&2)?(p->x+=s[0][p->q].v[        0][0]*x[i&1]*2.5)+(p->z+=s[0][p->q].v[0][2]     *
               x[i&1]*2.5)+(p->p=((int)(10*x[i&1])+128)&127):(p->x-=s[0][  p->q].v[        0][0]*x[i&1]*2.5)+(p->z-=s[0][p->q].v[0][2]*
              2.5*x[i&    1])+(p->p=((int)(-10.*x[i&1])+128)&127);p++;}}U  V(U){p=d        ;for(i=0;i <2048; i++){p->i=p->x;;p->j=p->y;p
             ->k=       p->z;p->d=p->p;p->b=p->q;p++;}}U _0(U){i=G-g-31;   if(i>4||         i<-4) {;n  -=i/4 ;if(n<128)n=128;;if(n> 2048
                     )n=2048;}L=(i<16&&n==2048);C=B*(((float)(G%50000))/   25000.);         c=sin (B*   ((((  float)(G%20000)))/(10 *1000
                        )));A=(G-t)/(float)(T-t);p=d;i=0; S(/*The_Paper    !*/ );J(         dis,  p,     lay  ,glutPostRe)();}U _1(U ){if
                      (G>T){X(2048);V();e=_X&127;T=(t=G)+  768+(_X&127)   ;S=  H;}          else  {X     (n)  ;}}U _2(U){if(G>T){X(8  <<8
                   );V();T=(t=G)+21000+(_X&4095);S=_1;;}   else {X(n);N   =A;  A=1          -.5           *   A*A+A;p=b;Z(n);p=d;q=b  ;;
                  for(i =0;i<n;i++){p->x=u(q->x,p->x,N)     ;;p  ->y=u(   (q   ->           y),           p   ->y,N);p->z=u(q->z,p->   z
                       ,N);p->p=(int)((i&1)?u(q->d,0,N)      :u   (q->    d     ,           0+                128,N))&127;p->q=(int)(
                      (i&2)?u(q->b,p->b,N):u(q->b,128+             p->                            b,N))&127;p++;q++;}}}U _3(U)  {if (
                     G>   T){Z(2048);V();memcpy(b,d,(               16                        <<7)*sizeof(pp  ));p=d;for(i=0;i  <1*
                          2048;i++){p->u=y(-160,160)    ;p->w=y(-160,160);p->v=y            (-640,  -320  );p ->d=0;p->b
                           =_X&127;p++;}T=(t=G)+9000  +(_X     %(8      <<9    ));         ;S=       _2;}  else{Z(n);}}U
                           _4(U){if(G>T){T=9000+(_X  &(       00+   4095  )      )+(t=G);S=_3    ;  }}U/*   */H(U){for(i
                           =0;i<n;i++){p->p=(int)((i&1       )?u     (p->        d,+32,A):u(p    ->d,160,A    ))&127;p->
                           q=(int)((i&2)?u(p->b,e,A):u       ((  p  ->b),        e+        00    +128,A))&    127;p++;;}
                           if(G>T){p=d;for(i=0;i<2048       ;++  i){;p->p        =p        ->     d=040;p     ->q=p->b=e
                           ;p++;}T=(t   =G)+1000;S=_4       ;}   }U/**/_R        /*        */       (int      W,int/**/
                           H){P=W;Q=    H;N=W>H?(w=W/       ((    float)         H)        )+      (h=1):(    w=1)+(h=H
                           /(float)W   );J(tPostRedisp                    ,     la,         y,                glu)();;}
                          int main(   int X,char**Z){J(             tI,ni,      t,          glu              )(&X,Z);B=
                         atan2(0,-1)   ;J(itDisplayM ,od                       ,e             ,glutIn)(GLUT_DOUBLE|J(R,
                        GB,A,GLUT_));  glutSetWindow  (J(                    tC,                reateWin,     dow,glu)(
                      "yomiko"));J(tD,  ispla,yFunc,   glu)              (_r);J        (utI                   ,dleF,unc
                  ,gl)(_0);J(utReshape, Fu,nc,gl)(_R     );J(lutKey,boardF,            unc                    ,g)(exit)
             ;glLightfv(GL_LIGHT0,GL_SPECULAR,f[07])                                                          ;GE(_TEST
           ,DEPTH);  glColor4fv(f[10]  );glShadeModel                                                         (GL_FLAT)
        ;GE(HT0    ,LIG);glLightfv(     GL_LIGHT0,J(L_                                                       ,DIFF,USE,
      G),f[      7]);GE(ORMALIZE,       N);GE(ING,LIGHT                                                     );for(r=&s[
    0][i       =0x0];i<128;i++)         for(j=0;j<128;j++                      ){memcpy(r->v,F,           sizeof(float)
  *12        );A=B/64.;R=(I=E=          cos(N=i*A))*( Y=D=                     cos(v=j*A));o=(           K=-(a=sin(N)))
           *(m=sin(v));M=E*m             ;O=0-m;_=a*D;  for(                   k=0;k<4;k++){           v=O* r->v[k][0]+
         _*r->v[k][1]+r->v               [k][2]*R;r->v    [k][                   0]=Y*r->v[          k][0   ]+o*r->v[k]
      [1]+M*r->v[k][2];r                  ->v[k][1]=I*      r->v                  [k][1]+           r->v    [k][2]*K;r
    ->v[k] [2]=v;}r->n                    [0]=o;r->n[1        ]=I;r                               ->n[      2]=_;r++;}
  p=d;i    =0;for(L=i                      ;i<2048;i++          ){p->                           i=y(-       320,320);p
          ->u=y(-96                        ,96);p->j=y(            -320,                       320)        ;p->w=y(-96
         ,96);p->                           d=p->p=127&               _X;p->v                =y(-          640,-320);p
        ->k=y((-                             320),320);                   J(lClear        ,Col             ,or,g)(0.f
       ,0.f,0.                                ,(float)0.                        );/*=*/p->b                =p->q=127&
      _X;p++                                  ;}ftime(&z)                                                  ;n=512;l=z.
      time;                                    srand(l);G                                                  =z.millitm
     ;g=G                                       -31;C=0;T                                                 =(_X&4095)+
    (t=                                         G)+9000;S=                                                _1;J(utMai,
   n,                                           Loop,gl)()                                                ;return+0;}
                                                 #else/*^_^                                               ReadOrDie*/
                                                  #define/*                                              /*/_X rand()
                                                  # include                                             <sys/timeb.h>
                                                   # include                                            <GL/glut.h>
                                                    #include/*                                         */<stdio.h>
                                                     # include                                        <string.h>
                                                     #include/*                                      */<math.h>
                                                     #define GE(X                                    ,Xx)/**/\
                                                      glEnable(GL_                                   ##Xx##X)
                                                       #define u(x                                   ,X,t)(\
                                                        ((X)-(x))*(                                 t)+(x))
                                                         #define/*\                                 ^_^*/\
                                                          /**/y(A,x)                                u(A\
                                                           ,x,(4095&                               _X)\
                                                            /4095./*                               */)
                                                            #endif/*                              J(a
                                                            ,rColo,                               r,
                                                            glCle)(
                                                             1.,1.
                                                             ,1.0,
                                                             1.0)
                                                             ;*/

  NFO RAR ZIP DETAILS SAMPLE /
2016-11-24