program My_3D; uses graph,crt; const max=100; procedure calc(var x,y,z,xt,yt,zt,xan,yan,zan:real); begin Yt:= Y * COS(Xan) - Z * SIN(Xan); Zt:= Y * SIN(Xan) + Z * COS(Xan); Y:= Yt; Z:= Zt; Xt:= X * COS(Yan) - Z * SIN(Xan); Zt:= X * SIN(Yan) + Z * COS(Xan); X:= Xt; Z:= Zt; Xt:= X * COS(Zan) - Y * SIN(Zan); Yt:= X * SIN(Zan) + Y * COS(Zan); X:= Xt; Y:= Yt; end; var gd,gm,i,i1,i2:integer; modelx4,modely4,modelz4,modelx1,modely1,modelz1,modelx2,modely2,modelz2,modelx3, modely3,modelz3:array[1..max] of real; xan,yan,zan:real; yt,xt,zt:real; sx1,sx2,sx3,sx4,sy1,sy2,sy3,sy4,sz1,sz2,sz3,sz4:integer; arr: array[1 .. 8] of integer; modelfile:text; path:string; zoom:integer; colorbuf:integer; color:array[1..max] of integer; buf1,buf2,buf3,buf4:real; sum1,sum2:real; j1,j2,j3,j4,j1a,j2a,j3a,j4a:real; page:integer; begin writeln('Hello I am 3d engine =)'); writeln('Select model:'); readln(path); writeln('Let the party begin!'); readln; gd := EGA; gm := EGAHi; { gd:=detect; } initgraph(gd,gm,''); xan:=0.02; yan:=0.02; zan:=0.02; zoom:=15; {path:='cube.dat';} assign(modelfile,path); reset(modelfile); readln(modelfile,i); for i1:=1 to i do begin readln(modelfile,color[i1],modelx1[i1],modely1[i1],modelz1[i1],modelx2[i1],modely2[i1],modelz2[i1], modelx3[i1],modely3[i1],modelz3[i1],modelx4[i1],modely4[i1],modelz4[i1]); end; (* page:=0; setactivepage(1 - page); setvisualpage(page); *) page := 0; setactivepage(1 - page); setvisualpage(page); repeat cleardevice; setcolor(white); for i1:=1 to i do begin calc(modelx1[i1],modely1[i1],modelz1[i1],xt,yt,zt,xan,yan,zan); calc(modelx2[i1],modely2[i1],modelz2[i1],xt,yt,zt,xan,yan,zan); calc(modelx3[i1],modely3[i1],modelz3[i1],xt,yt,zt,xan,yan,zan); calc(modelx4[i1],modely4[i1],modelz4[i1],xt,yt,zt,xan,yan,zan); end; for i1:=1 to i-1 do for i2:=1 to i-1 do begin sum1:=modelz1[i1]+modelz2[i1]+modelz3[i1]+modelz4[i1]; sum2:=modelz1[i1+1]+modelz2[i1+1]+modelz3[i1+1]+modelz4[i1+1]; if sum1