|
楼主 |
发表于 2011-11-11 17:15:23
|
显示全部楼层
本帖最后由 GWHBOB 于 2011-11-11 17:20 编辑
- //CONST CALCULATING
- dX=(X2-X1)/W/Repeat;dY=(Y2-Y1)/H;dZ=(Z2-Z1)/W/Repeat;
- A=-Z1*Xs+64*Z1+63*X1;
- B=dZ*Xs-64*dZ-63*dX;
- C=63*(Z2*X1-Z1*X2)/W/Repeat;
- D=Deg-63*Y1*(dZ*Xs-64*dZ-63*dX)/C;
- D2=Deg-63*Y2*(dZ*Xs-64*dZ-63*dX)/C;
- E=-63*Y1*dZ/C;
- E2=-63*Y2*dZ/C;
- F=-1048576*C/(65*dY);
- G=-1048576*(Y1/dY);
- tW=H<<20;
- //END
- //MAIN LOOP
- for(Xrr=Xs;Xrr<=Xe;Xrr++){
- X=(int)(A/B)%W;
- pB=X>>3;pb=X%8;mark=128>>pb;
- p1=picStart1+pB;p2=picStart2+pB;p3=picStart3+pB;
- Yrr=(int)(D);Ye=(int)(D2);
- if(Yrr<1)Yrr=1;
- N=(long)(P=F/B);
- M=(long)(P*(Yrr-Deg+0.5)+G);
- while((Yrr<=Ye)&&(M<=tW)){
- Y=M>>20<<w;
- if(picturebuffer[p3+Y]&mark){
- PlotPixel(Xrr, Yrr, &buffer1,(picturebuffer[p1+Y]&mark)!=0);
- PlotPixel(Xrr, Yrr, &buffer2,(picturebuffer[p2+Y]&mark)!=0);
- }
- Yrr+=1;M+=N;
- //Bdisp_SetPoint_VRAM(Xrr,Yrr,wall[Y][X]);
- }
- A-=Z1;B+=dZ;D+=E;D2+=E2;
- }
- //END
- //****************************************************************************
- // AddIn_main (Sample program main function)
- //
- // param : isAppli : 1 = This application is launched by MAIN MENU.
- // : 0 = This application is launched by a strip in eACT application.
- //
- // OptionNum : Strip number (0~3)
- // (This parameter is only used when isAppli parameter is 0.)
- //
- // retval : 1 = No error / 0 = Error
- //
- //****************************************************************************
- int AddIn_main(int isAppli, unsigned short OptionNum)
- {
- unsigned int key;
- float d;int i;int c;
- d=-0.1;c=0;
- //GrayLinkBuffers(&bufferdd1, &bufferdd2); // Link them together
- //GrayInit(6987, 3269); // Load the timers with 3661
- while(1){
- Deg=32;
- memset(&buffer1, 0, 1024);
- memset(&buffer2, 0, 1024);
- RenderWall(-0.5,d-1,0.5,d-1,0.5,-0.5,1,1,129,257,2,32);
- RenderWall(-0.5,d-1,-0.5,d,0.5,-0.5,1,1,1,1,2,32);
- RenderWall(-0.5,d+1,-0.5,d+2,0.5,-0.5,1,1,1,1,2,32);
- RenderWall(-0.5,d,-0.5,d+1,0.5,-0.5,1,1,129,257,2,32);
- RenderWall(0.5,d-1,0.5,d,0.5,-0.5,1,1,1,1,2,32);
- RenderWall(0.5,d+1,2.5,d+1,0.5,-0.5,2,1,1,1,2,32);
- RenderWall(0.5,d,0.5,d+1,0.5,-0.5,1,1,129,257,2,32);
- for(i=1;i<=256;i++){
- bufferdd1=buffer1;bufferdd2=buffer2;
- }
- PlotPixel(c++%128, 1, &bufferdd2, BLACK);
- DrawAll(bufferdd2);
- //GetKey(&key);
- d-=0.005;
- /*locate(1,4);
- Print((unsigned char*)"This application is");
- locate(1,5);
- Print((unsigned char*)" sample Add-In.");*/
- }
- while(1){
- GetKey(&key);
- }
- //GrayEnd();
- return 1;
- }
复制代码
|
|