KANATA.C   

<

^

>


                                         /*2008[  */#ifdef/**/j
                                   #include<GL/glut.h>/*]>++++[>>[*/
                               #include<sys/time.h>/*]<++++>>++<<[->[>+*/
                             #include<stdlib.h>/*<<amaneku_sora_no_hate_e>>*/
                           typedef double A;typedef void C;A H(A W){return+((rand
                         ()&32767)-16384)*W/16384.0;}struct{A/**/K,_,S,h,I,R,A,H,i,M,E;
                        }a[512],*b;A D,E,F,i[1024][3],  k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,KA,NA,TA,_,g,h[1024][+
                       3],G,L,M,N,O,P,Q,R,S,MN;typedef    int B;C xz(){glutPostRedisplay();}B
                     c,d,e,f;C yz(unsigned char T,B U,      B V){glFlush();exit(0);}A J(A T,A U,A
                   V,A(W)){x=n*n;y=1.-n;z=y*y; R=2*n*y;       return+ 3*(-z*T+(z-R)*U+(R-x)*V+x*W);}
                 GLfloat K[4][4]={{1,1,1,1},{0  ,1,-1,0        },{0,-1  ,1,0},{.9,.93,1,.8}};C yx(B W,B
               V){xz();}A I(A T,A U,A V,A W){x   =T+n*(U         -T  );  y=U+n*(V-U);z=V+n*(W-V);R=x+n*(y-
              x);S=y+n*(z-y);return R+n*(S-R);     }C xy          (A      X,A Y,A Z,A U,A V,A W){k=Y*W-V*Z;l=
            U*Z-X*W;m=(X*V)-U*Y;}C zx(){struct      timeval                T;gettimeofday(&T,NULL);g=T.tv_sec+T
           .tv_usec*(10e-7);}C zy(C){zx();if(g   >=D){_=D;D                 =g +0.5+(rand()&32767)/8192.;E=s;F=t;G
          =u;N =v;O=s+s-o;P=t+t-p;Q=u+u-q;MN=v  +v-r;for(e                     =0;e++<8;){s=H(128);t=H(128);u=H(128);k=s-E;l=t           -F;m=u-G;if(k*k+l*l+m*
         m>=  1820)break;}for(e=0;e++<8;){o=H( + 128)*0.4+               s;p  =t+0.4*H(128);q=u+0.4*H(128);k=o-s;l=p-t;m=q-u;if(k*k+l*l+m*m>1820)break;}v=
        H(L  );r=v+0.4*H(L);}for(n=(g-_)/(D-_);  d-c&&g-a[              (d)]. S>=20;d=(d+1)&511);if(g-a[c].S>=0.05){c=(c+1)&511;a[c].S=g;}b=
       &a    [c];b->M=I(E,O,o,s);b->E=I(F,P,p,   t);b->K=I             (G,Q,q ,u);b->h=J(E,O,o,s);b->I=J(F,P,p,t);b->R=J(G,Q,q,u);if(
      (w    =b->h*b->h+b->I*( b->I)+b->R*b->R)    >M){;w=              sqrt (w);b->h/=w;b->I/=w;b->R/=w;}xy(b->h,b->I,b->R,0,0,1);b->A=1;b
     ->     H=b->i=0.;if((w=k *k+l*l+m*m)>M){w=     sqrt               (w);  b->A=k/w;b->H=l/w;b->i=m/w;}k=b->h;l=b->I;m=b->   R;x=sin(b->_=I(N,
    MN      ,r,v));y=cos(b->_  );z=1-y;KA=k*l;NA                        =k   *m;TA=l*m;R=b->A;S=b->H;w=b->i;b->A=(z*k*k+y)*R+(      z*KA-m*x)*S+(z*NA
   +       l*x)*w;b->H=(z*KA+m  *x)*R+(z*l*l+y)*S+                           (z*TA-k*x)*w;b->i=(z*NA-l*x)*R+(z*TA+k*x)*S+(z*m*m            +y)*w;h[e=c*2][0]=a[
  c        ].M-16*a[c].A;h[e][1]=a[c].E-16*a[c].H;h                          [e][2]=a[c].K-16*a[c].i;h[f=e+1][0]=a[c].M+16*a[c].A                      ;h[f][1]=
          a[c].E+16*a[c].H;h[f][02]=a[c].K+16*a[c].i;                       xy(a[c].h,a[c].I,a[c].R,a[c].A,a[c].H,a[c].i);i[f][0]=
         i[e][0]=k;i[f][1]=i[e][1]=l;i[f] [2]=i[e][2]=m                     ;glDrawBuffer(GL_BACK);glClear(GL_COLOR_BUFFER_BIT);f=j(
       gl,ut,Get)(GLUT_WINDOW_WIDTH);k=l=1    ;e=glutGet(                   GLUT_WINDOW_HEIGHT);w=(f>e)?(k=f/(A)e):(l=e/(A)f);j(glVi,
      ew,port)(0,0,f,e);glMatrixMode(j(GL_PR,       OJECT,      ION        ));glLoadIdentity();glFrustum(-k,k,-l ,l,10,12800);gluLookAt
     (0,0,1280,0,0,0,0,1,0);glLightfv(GL_LIGHT0,                         GL_DIFFUSE,*K);glLightfv(GL_LIGHT0,j(GL_   ,SPEC,ULAR),*K);j(gl
    ,Ligh ,tfv)(GL_LIGHT0,GL_POSITION,K[1]);j(  glL                   ,ight,fv)(GL_LIGHT0,GL_SPOT_DIRECTION,K[ 2]);    glLightModeli(j(G,
    L_LI  ,GHT_MODEL_TWO_SIDE),GL_TRUE);j(glMa,     ter            ,ialfv)(GL_FRONT_AND_BACK,GL_SPECULAR,K[3]);j(gl,      Materia,lf)(j(GL_
   ,FRO   ,NT_AND_BACK),GL_SHININESS,4);j(glCol         ,orMa ,terial)(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE);j(gl,      En,able)(j(GL_CO
  ,LO,    R_MATERIAL));glMatrixMode(GL_MODELVIEW                );glLoadIdentity();glEnableClientState(GL_VERTEX_ARRAY);      j(glEnableClie,
 ntSta    ,te)(GL_NORMAL_ARRAY);glVertexPointer(                3,GL_DOUBLE,00,h);glNormalPointer(GL_DOUBLE,00,i);glBegin(      GL_QUAD_STRIP)
 ;j(g     ,lColor,4d)(m=0,0,0,0);for(e=d;e!=c;e=                (e+1)&511){glArrayElement(e*2);glArrayElement(e*2  +1);if(m       <.8)j(glColo,
r,4d       )(.4,.5,1,m+=.08);}glEnd();j(glutSwap,               Buff,ers)();glFlush();}B main(B X,char**Y){j(glutI   ,ni,t)(       &X,Y);L=atan2
(0,-       1);glutInitDisplayMode(GLUT_RGBA|j(G ,               LUT_,DOUBLE));glutSetWindow(glutCreateWindow("Kan"     "ata")        );X=GL_BLEND
;j(g       ,lutDispl ,ayFunc)(zy);glEnable(X);M =               1e-7;glShadeModel(GL_SMOOTH);glEnable((GL_NORMALIZE     ));;j(         glutKeybo,
 ard,      Func)(yz  );glutIdleFunc(xz);j (gl,                  ut,  ReshapeFunc)(yx);X=GL_ONE;glEnable(j(GL,_LIGH,       T0));          glEnable
 (j(G      ,L_LIGHT   ,ING));j(gl,BlendFu ,nc                         )(GL_SRC_ALPHA ,X);srand ((B)g);zx();D=a[0].S        =g-1;          o=H(128
  );p=      H(128.)    ;q=H(128);r=H(L);s  =                           t=u=N=c=d =0  ;j(gl,u,  tMainLoop)();j(ret,           ur,             n)0;}
   #/*      ]+++++[     >>+>+>>+>   +<<<<<                               <-]+++ +[    >>>>+<   <<<-]<]<-]>>>++>+++            */               else
    /*+      +>++*/      #include/*                                       >+++  +     +>->-    --[>  */<math.h>/*              <                  */
      #      include       /*<]<   [.                                                 <->      +]   [*/<stdio.h>
       #       define       j(X,                                                                   Y,Z)X##Y##Z
         #      include       /*                                                                  */__FILE__
                     /*]       */                                                                #endif

  NFO RAR ZIP DETAILS SAMPLE /
2016-11-24