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

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;;;;;;;                                             ;;;;;;;;
  3. ;;;;;;;;  Example Shape #5-Shape broken down into 3  ;;;;;;;;
  4. ;;;;;;;;  seperate 'units' and sorted using IFVIS-   ;;;;;;;;
  5. ;;;;;;;;  GOSUB to call the left and right sides.    ;;;;;;;;
  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. ;;;;;;;;;;facet list;;;;;;;;;;;;;;;;;;;;;;;
  45.  
  46.     IFVIS 2,1,4 GOSUB right_wing        ;This line checks the INNER right side
  47.                     ;of the plane's body and calls the 
  48.                     ;right_wing module straight away if the
  49.                     ;condition is satisfied. Either way,
  50.                     ;the program continues processing with
  51.                     ;the next line down.
  52.  
  53.     IFVIS 104,101,102 GOSUB left_wing    ;This line checks the INNER left side
  54.                     ;of the plane's body and calls the 
  55.                     ;left_wing module straight away if the
  56.                     ;condition is satisfied. Either way,
  57.                     ;the program continues processing with
  58.                     ;the next line down.
  59.  
  60.     DRWPOLY 31,1,4,104,101        ;this facet is the roof, it must go on 
  61.                     ;before the tail-fin
  62.  
  63.     DRWPOLY 30,200,201,202        ;this is the tail-fin
  64.     DRWPOLY 29,202,203,200        ;
  65.     DRWPOLY 33,202,201,203        ;
  66.  
  67.     DRWPOLY 33,1,2,3,4            ;this is the rest of the main body
  68.     DRWPOLY 33,103,102,101,104        ;
  69.     DRWPOLY 35,104,4,3,103        ;
  70.     DRWPOLY 36,103,3,2,102        ;
  71.  
  72.     DRWPOLY 30,100,1,101        ;this is the nose
  73.     DRWPOLY 32,100,2,1            ;
  74.     DRWPOLY 32,100,101,102        ;
  75.     DRWPOLY 34,100,102,2        ;
  76.  
  77.     IFVIS 102,101,104 GOSUB left_wing    ;This line now checks the left side
  78.                     ;of the plane's body and calls the 
  79.                     ;left_wing module straight away if the
  80.                     ;condition is satisfied. Either way,
  81.                     ;the program continues processing with
  82.                     ;the next line down.
  83.  
  84.     IFVIS 4,1,2 GOSUB right_wing        ;This line now checks the right side
  85.                     ;of the plane's body and calls the 
  86.                     ;right_wing module straight away if the
  87.                     ;condition is satisfied. Either way,
  88.                     ;the program continues processing with
  89.                     ;the next line down.
  90.     RETURN
  91.  
  92. ;The last two IFVIS...GOSUB lines above could actually be IFVIS...GOTO commands in this example,
  93. ;resulting in fractionally faster render time for the shape (the RETURN could also be removed).
  94. ;If however the body was tapered at one end, IFVIS...GOSUB would be essential because certain
  95. ;views would require both wings to appear over the body.
  96.  
  97. ;Using this method, no lists of calls defining different views is necessary as in EXAMPLE#04.
  98. ;This is because the IFVIS...GOSUB commands determine the view direction and correct call order
  99. ;as they go along.
  100.  
  101. ;In this example the BODY is not a module as in EXAMPLE#04. Because this method would only 
  102. ;require it to be called once, it would be a waste of both SHAPE FILE space and render time (for
  103. ;the GOSUB+RETURN) if it were a module outside the main program loop.
  104.  
  105. ;;;;;;;;;;modules;;;;;;;;;;;;;;;;;;;;;;;;;;
  106.  
  107. left_wing:
  108.     DRWPOLY 34,106,109,105
  109.     DRWPOLY 36,108,110,107
  110.     DRWPOLY 32,108,107,106,105
  111.     DRWPOLY 37,106,107,110,109
  112.     RETURN
  113.  
  114. right_wing:
  115.     DRWPOLY 34,05,09,06
  116.     DRWPOLY 36,07,10,08
  117.     DRWPOLY 32,06,07,08,05
  118.     DRWPOLY 37,10,07,06,09
  119.     RETURN
  120.  
  121.     END
  122.