home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1995 September / PCPRO2_995.ISO / virtek / dos / shapes / examples / exam#04.sh < prev    next >
Encoding:
Text File  |  1995-07-16  |  4.1 KB  |  130 lines

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;;;;;;;                                             ;;;;;;;;
  3. ;;;;;;;;  Example Shape #4-Shape broken down into 3  ;;;;;;;;
  4. ;;;;;;;;  seperate 'units' and sorted using IFVIS-   ;;;;;;;;
  5. ;;;;;;;;  GOTO to establish Left and Right views.    ;;;;;;;;
  6. ;;;;;;;;                                             ;;;;;;;;
  7. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  8.  
  9.     SHAPE 10000
  10.  
  11. ;;;;;;;;;vertex list;;;;;;;;;;;;;;;;;;;;;;
  12.  
  13.     VERTEX 01,30,-15,+90
  14.     VERTEX 02,30,+15,+90
  15.     VERTEX 03,30,+10,-70
  16.     VERTEX 04,30,-15,-90
  17.  
  18.     VERTEX 05,030,-5,+40
  19.     VERTEX 06,130,+5,+10
  20.     VERTEX 07,150,+5,-30
  21.     VERTEX 08,030,-5,-20
  22.     VERTEX 09,030,+5,+40
  23.     VERTEX 10,030,+5,-20
  24.  
  25.     VERTEX 101,-30,-15,+90
  26.     VERTEX 102,-30,+15,+90
  27.     VERTEX 103,-30,+10,-70
  28.     VERTEX 104,-30,-15,-90
  29.  
  30.     VERTEX 105,-030,-5,+40
  31.     VERTEX 106,-130,+5,+10
  32.     VERTEX 107,-150,+5,-30
  33.     VERTEX 108,-030,-5,-20
  34.     VERTEX 109,-030,+5,+40
  35.     VERTEX 110,-030,+5,-20
  36.  
  37.     VERTEX 100,0,5,120
  38.  
  39.     VERTEX 200,00,-15,-50
  40.     VERTEX 201,+5,-15,-90
  41.     VERTEX 202,00,-50,-110
  42.     VERTEX 203,-5,-15,-90
  43.  
  44. ;;;;;;;;;condition list;;;;;;;;;;;;;;;;;;;
  45.  
  46.     IFVIS 4,1,2 GOTO right_view    ;This command checks if the right side of the
  47.                 ;plane's body is visible. If it is visible, 
  48.                 ;then the viewer is obviously looking at the
  49.                 ;object from its right-hand side; consequently
  50.                 ;the label "right_view" below is jumped to.
  51.                 ;If the facet is not visible and the condition
  52.                 ;is therefore unsatisfied, the GOTO is 
  53.                 ;ignored and the program continues processing
  54.                 ;with the next line.
  55.  
  56.     IFVIS 102,101,104 GOTO left_view    ;This command checks if the left side of the
  57.                 ;plane's body is visible. If it is visible, 
  58.                 ;then the viewer is obviously looking at the
  59.                 ;object from its left-hand side; consequently
  60.                 ;the label "left_view" below is jumped to.
  61.                 ;If the facet is not visible and the condition
  62.                 ;is therefore unsatisfied, then the viewer must
  63.                 ;be looking directly down the middle of the
  64.                 ;object:- this line is only ever reached when
  65.                 ;the right side is not visible, so the only way
  66.                 ;for both sides to be non-visible is when looking
  67.                 ;down the centre.
  68.  
  69.     GOSUB left_wing        ;When neither of the above IFVIS commands are
  70.     GOSUB right_wing        ;satisfied (ie:-centre view) the compiler ignores
  71.     GOTO body            ;both and carries on processing. These three call
  72.                 ;commands reference the three modules in the 
  73.                 ;correct order for a centre view.
  74. right_view:
  75.     GOSUB left_wing        ;These three call commands reference the three
  76.     GOSUB body        ;modules in the correct order for a right viewing
  77.     GOTO right_wing        ;direction; ie:-left side first, then center and
  78.                 ;lastly the right side of the object.
  79. left_view:
  80.     GOSUB right_wing        ;These three call commands reference the three
  81.     GOSUB body        ;modules in the correct order for a left viewing
  82.     GOTO left_wing        ;direction; ie:-right side first, then center and
  83.                 ;lastly the left side of the object.
  84.  
  85.                 ;Note how the last call command in each of the 
  86.                 ;above is a GOTO and not a GOSUB like the previous
  87.                 ;two. This is for the simple reason that if GOSUB
  88.                 ;were used instead, then a RETURN command would
  89.                 ;need to be added to stop the program continuing
  90.                 ;processing into the next sequence of calls. With
  91.                 ;a GOTO, control is returned to the PARENT PROGRAM
  92.                 ;by the RETURN at the end of the last module called.
  93.  
  94. ;;;;;;;;;modules;;;;;;;;;;;;;;;;;;;;;;;;;;
  95.  
  96. body:
  97.     DRWPOLY 31,1,4,104,101    ;this facet is the roof, it must go on before the
  98.                 ;tail-fin
  99.  
  100.     DRWPOLY 30,200,201,202    ;this is the tail-fin
  101.     DRWPOLY 29,202,203,200    ;
  102.     DRWPOLY 33,202,201,203    ;
  103.  
  104.     DRWPOLY 33,1,2,3,4        ;this is the rest of the main body
  105.     DRWPOLY 33,103,102,101,104    ;
  106.     DRWPOLY 35,104,4,3,103    ;
  107.     DRWPOLY 36,103,3,2,102    ;
  108.  
  109.     DRWPOLY 30,100,1,101    ;this is the nose
  110.     DRWPOLY 32,100,2,1        ;
  111.     DRWPOLY 32,100,101,102    ;
  112.     DRWPOLY 34,100,102,2    ;
  113.     RETURN
  114.  
  115. left_wing:
  116.     DRWPOLY 34,106,109,105
  117.     DRWPOLY 36,108,110,107
  118.     DRWPOLY 32,108,107,106,105
  119.     DRWPOLY 37,106,107,110,109
  120.     RETURN
  121.  
  122. right_wing:
  123.     DRWPOLY 34,05,09,06
  124.     DRWPOLY 36,07,10,08
  125.     DRWPOLY 32,06,07,08,05
  126.     DRWPOLY 37,10,07,06,09
  127.     RETURN
  128.  
  129.     END
  130.