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

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;;;;;;;                                             ;;;;;;;;
  3. ;;;;;;;;  Example Shape #10 - problems with SCALING  ;;;;;;;;
  4. ;;;;;;;;                                             ;;;;;;;;
  5. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  6.  
  7.     SHAPE 10000
  8.  
  9. ;;;;;;;;;;vertex list;;;;;;;;;;;;;;;;;;;;;;;
  10.  
  11.     VERTEX 1,-50,-50,-50    ;These 8 vertices define the centre 
  12.     VERTEX 2,+50,-50,-50    ;cube: 100x100x100. There are no 
  13.     VERTEX 3,+50,+50,-50    ;transformation commands used on 
  14.     VERTEX 4,-50,+50,-50    ;these vertices. The vertex coords 
  15.     VERTEX 5,-50,-50,+50    ;below have been adjusted so that
  16.     VERTEX 6,+50,-50,+50    ;both cubes are the same size as
  17.     VERTEX 7,+50,+50,+50    ;this one when SCALED up / down.
  18.     VERTEX 8,-50,+50,+50
  19.  
  20.     OFFSET 20,0,0        ;This line OFFSETs the following 8 vertices by +20 
  21.                 ;UNITS along the X axis (so the 2nd cube doesn't 
  22.                 ;appear on top of the 1st). The vertices are then 
  23.                 ;SCALED-UP by a factor of 10 resulting in the 2nd cube 
  24.                 ;appearing 200 UNITS away. (20x10 = 200)
  25.  
  26.     SCALEUP 10        ;This scales the following vertices up to the same 
  27.                 ;apparent size as the 1st cube (100x100x100).
  28.  
  29.     VERTEX 11,-5,-5,-5        ;These 8 vertices define the
  30.     VERTEX 12,+5,-5,-5        ;right-hand, lighter cube.
  31.     VERTEX 13,+5,+5,-5        ;As SCALEUP has been used the
  32.     VERTEX 14,-5,+5,-5        ;vertices CLIP off screen
  33.     VERTEX 15,-5,-5,+5        ;well before any of the other
  34.     VERTEX 16,+5,-5,+5        ;vertices in the other two 
  35.     VERTEX 17,+5,+5,+5        ;cubes. It also trembles sligtly
  36.     VERTEX 18,-5,+5,+5        ;due to its small (10x10) size.
  37.  
  38.     OFFSET -2000,0,0        ;This line OFFSETs the following 8 vertices by -2000 
  39.                 ;UNITS along the X axis (so the 3rd cube doesn't 
  40.                 ;appear on top of the 1st). The vertices are then 
  41.                 ;SCALED-DOWN by a factor of 10 resulting in the 3rd 
  42.                 ;cube appearing -200 UNITS away. (-2000/10 = -200)
  43.  
  44.     SCALEDOWN 10        ;This line scales the following vertices down to the 
  45.                 ;same size as the first cube (100x100x100).
  46.  
  47.     VERTEX 21,-500,-500,-500    ;These 8 vertices define the left-hand, 
  48.     VERTEX 22,+500,-500,-500    ;darker cube. As SCALEDOWN has been
  49.     VERTEX 23,+500,+500,-500    ;used, these vertices CLIP off screen 
  50.     VERTEX 24,-500,+500,-500    ;well after they have passed through
  51.     VERTEX 25,-500,-500,+500    ;the viewing plane. This results in a 
  52.     VERTEX 26,+500,-500,+500    ;mathematical overflow and consequently 
  53.     VERTEX 27,+500,+500,+500    ;a distorted perspective when the 
  54.     VERTEX 28,-500,+500,+500    ;vertices reach this point.
  55.  
  56. ;;;;;;;;;;facet list;;;;;;;;;;;;;;;;;;;;;;;;
  57.  
  58.     DRWPOLY 28,15,11,14,18    ;The rest of these lines are simply the 3 cube's
  59.     DRWPOLY 33,05,01,04,08    ;facets. As can quite clarly be seen, the sorting 
  60.     DRWPOLY 38,25,21,24,28    ;has been achieved by facet ordering alone.
  61.     DRWPOLY 39,26,27,23,22    ;
  62.     DRWPOLY 34,06,07,03,02    ;
  63.     DRWPOLY 29,16,17,13,12    ;
  64.  
  65.     DRWPOLY 31,01,02,03,04    ;
  66.     DRWPOLY 32,06,05,08,07    ;
  67.     DRWPOLY 35,02,01,05,06    ;
  68.     DRWPOLY 36,04,03,07,08    ;
  69.  
  70.     DRWPOLY 26,11,12,13,14    ;
  71.     DRWPOLY 27,16,15,18,17    ;
  72.     DRWPOLY 30,12,11,15,16    ;
  73.     DRWPOLY 31,14,13,17,18    ;
  74.  
  75.     DRWPOLY 36,21,22,23,24    ;
  76.     DRWPOLY 37,26,25,28,27    ;
  77.     DRWPOLY 40,22,21,25,26    ;
  78.     DRWPOLY 41,24,23,27,28    ;
  79.  
  80.     RETURN
  81.     END
  82.