SUGAR.C   

<

^

>


                                                                                           /**/
                                                                                    #include/*^
                                                                              */<sys/timeb.h>
                                                                         #include<stdlib.h>
                                                                      #include <GL/glut.h>
                                                                  #include/*!*/<stdio.h>
                                                                #include/*^_^*/<math.h>
                                                             #include/*6110/f74f5ed7'                                  2003/12*/<time.h>
                                                           #define s(n,o,w)/*flower                             -koge*donbo->*/o##w##n
                                                         typedef double e;e p,d,b                          ,r[8],a[8];struct{e x,y,z
                                                       ,u,v,w,i,j,k,p,q,r,a,b,c                       ,d;int o;}_[128],*f;struct/*
                                                     */timeb t;int g=256,i,j,        k;e/**/q(){   return(rand()&4095)/4095.;{;}
                                                    }void D(){glDrawBuffer(      GL_BACK)   ;glClear(GL_COLOR_BUFFER_BIT);s(t
                                        ,gl,Viewpor)(0,0,i=glutGet(s(DTH      ,GLUT         ,_WINDOW_WI)),j=glutGet(s(EIGHT
                                  ,GLUT_         ,WINDOW_H)));s(xMode       ,glM          ,atri)(GL_PROJECTION);s(entity
                              ,glL             ,oadId)();if(i>j){    b=i/ (e)j         ;d=1;}else{b=1;d=j/(e)i;}s(tum
                           ,gl                ,Frus)(-b,b,-d,           d,10         ,2000);glMatrixMode(s(ELVIEW
                        ,GL                  ,_MOD));f=_;              s(4f ,g     ,lColor)(.8,.9,1,.5);s(ity
                     ,gl                    ,LoadIdent                )();    gluLookAt(0,0,-1000,0,0,0,
                   0,1                     ,0);for                   ( i=     0;i<g/2;i++){s(Matrix
                  ,g                      /*9g                      / */     ,lPush)();/*nB*/
                /*                        */          #define      S( b    ,a) gl##a##b
               d                                   =(f       ->   z) ;               b=
             ((                                f->y            )  )  ;    /*          */
            S(                           nslated   ,Tra)(f->x, b,d) ;d =f-> u;         S(
           ted                       ,Rota )(  d,1,         0,0);b  =f->      v;        S(
          tated                   ,Ro)   (b  ,0,               1,0  *0);d=f    ->        w;
         glRotated              (d,   0,0  ,1                       );j=f->o     ;        ++
        f;glCallList(j        );    {;}  S(                             opMatrix  ,        P)
        ();}S(tSwapBuffers  ,u     )(  );                                       /*8o       */
       glFlush();}void C(){f     ->  x=          f        ->                        i=q     ()
      *g*4-g*2;f->y=f->j=g     ;f  ->           z=       f->k                          =q(  )*
      g*4-g*2;f->p=q()*g*    4-   g*           2;      f->q=-g                           -q  ()
     *g*4;f->r=q()*g*4-     g*   2           ;(f     )->u=q()*g                       ;f   ->a=
     q()*10;glNewList      (   (f      ->   o),0    +GL_COMPILE)           ;           glBegin(
     GL_LINE_LOOP);      r[   0]      =8   ;f->    v=q()*g;f->b=q          ()   *        10;f->
    w=q()*g;f->d=d      ;f   ->      c=   q()*10;a[0]=0;for(j=1;j           <   7    ;    ++ j){
    r[j]=q()*5+3      ;a[   j]     =q()*p/2;}r   [j]=3;a[j]=p/2;s(          r,  f,   o)     (k =j
    =0;k<6;k++)     {for   (;j    <7;++ j)s(3d  ,glV  ,ertex)(cos(          k*p  +     a     [  j]
    )*r[j],r[     j]*1*   sin    (k*p+  a[j] ),0) ;   for(;j>0;j-=         01)S  (      d     ,
    Vertex3)    (r[j]*    cos    ((k+1 )*p    -a       [j]),sin((k        +1)*p  -      a[    j]
     )*r[j]   ,0);}S(    nd,E    )() ;S(   ndList,     E) ();;}void     R(int w,s(  t    ,i   ,n
     )h){s   (isplay    ,glut    ,/*  */ PostRed )()    ;  }void A(    ){ftime(&t)  ;f    =    _;
      d=   t.millitm   /1000.    +t.   time;for(i=   0      ;i<g/2;   ++i,  ++ f){  f->   y=   f
     ->  j+(-f->j+f    ->q)*(    b=   (d-f->d)/16);          if(f->  y>-    g){f->  x=f   ->  i+
    (f  ->p-f->i)*b   ;f->z=(f   ->  r-f->k)*b+f->k;            f->u+=f     ->a;f    ->v  +=  f
   -> b;f->w+=f->c   ;}else{C(    )  ;}}R(0,0);}Q(){              glFlush   (  );    exit (0  )
  ;}int main(int/*   j*/u,char    **  v){srand(time(               NULL) )    ;s     (me, ft ,
  i)( &t);s(t,glu,   tIni)(&u,v )  ;   i=(GLUT_RGBA              )|s(BLE ,   GL      ,UT_DOU);
 s(   ode,glutIni   ,tDisplayM)(i) ;s   (teWindow,               glutCre ,  a)(  "   snow\40"
/*     7   */"fl"   "ower");s(yFunc ,     glutD                 ,ispla)(   D);  s(   dleFunc,
           glu  ,   tI)(A);s(apeFunc ,                          glutRes   ,h  )(R)  ;s(Func,
           gl   ,  utKeyboard)(Q);s (nc,                        glBlen    ,  dFu)( s(C_ALPHA
                ,  GL, _SR),GL_ONE); s(e,                        glE     , nabl)(GL_BLEND);f
                =  _    ;d=t.millitm*  .001        +00+t.              time;for(i=0;i   <g/2
                ;  i     ++)  {f->o=s(s   ,       g      ,            lGenList)(1);p=
                s( 2            ,a,   tan         )     (           0,-1)/3;C(  );((
                 f ++                   ))->       q-=2.         *g;}s(Color,
                 glC,                      lear               )(0,0,0,    +
                  0);                         s(oop     ,glutM ,ainL
                  )();                            return
                   /*X
                    XXX
                     X*/
                       0;
                         }

  NFO RAR ZIP DETAILS SAMPLE /
2023-03-07