Sunday, April 26, 2020

TEST3D.P

[Table of Contents]

TEST3D.P is a sample program on the Kyan Pascal 2.x Advanced Graphics Toolkit disk.

It can be run by booting the Kyan Pascal 2.x Advanced Graphics Toolkit and choosing Test3D from the menu.

To compile this example program, the following include files need to be available to the compiler:

  • graph3.con
  • graph3.gbl
  • HiRes.i
  • plotter.i
  • graph3.i

Source Code


#A
_ORIGIN EQU $4000
#
program threedimdemo(input,output);
    const
        max = 6;
#i d1:graph3.con
    var
        x,y,z,t,step:real;
        i,color     :integer;
        rep         :char;
#i d1:graph3.gbl
#i d1:HiRes.i
#i d1:plotter.i
#i d1:graph3.i
    begin
    writeln(chr(125));
    writeln('This program demos a simultaneous zoom');
    writeln('and roll of an object.');
    writeln;
    writeln('Press [RETURN] to start the demo');
    readln;
    writeln;
    writeln('Output to plotter?(Y/N)');
    readln(rep);
#A
    LDA #$40
    STA $6A
#
    graphics(8+16);
    if (rep='y') or (rep='Y') then
        plotter:=true
    else
        plotter:=false;
    if plotter then begin
       set_plotter_port(40,440,0,290);
       set_plotter_window(-5,5,-5,0);
       init_plotter;
       advance;
       frame;
       plotter_color(2);
    end;
    for i:= 1 to 10 do begin
        color:=1;
        setviewreferencepoint(i/12,i/12,-i/6);
        setviewplanenormal(0,0,-1);
        setviewdistance(2);
        setviewup(i/10-0.1,1,0);
        setprojection(perspective,i/12,i/12,3-i/6);
        makeviewplanexfm;
        clearscreen;
        SetWindow(-5,5,-5,5);
        display(move_abs,0,0,0);
        display(draw_abs,0,0,1);
        display(draw_abs,0,1,1);
        display(draw_abs,1,1,1);
        display(draw_abs,1,0,1);
        display(draw_abs,1,0,0);
        display(draw_abs,1,1,0);
        display(draw_abs,0,1,0);
        display(draw_abs,0,0,0);
        display(move_abs,1,1,1);
        display(draw_abs,1,1,0);
        display(move_abs,0,1,1);
        display(draw_abs,0,1,0);
        display(move_abs,1,0.4,0.4);
        display(draw_rel,0,0,0.2);
        display(draw_rel,0,0.2,0);
        display(draw_rel,0,0,-0.2);
        display(draw_rel,0,-0.2,0);
   end;
#A
   LDA #$C0
   STA $6A
#
   GRAPHICS(0);
end.


Sample Run




No comments:

Post a Comment