home *** CD-ROM | disk | FTP | other *** search
/ Mega Top 1 / os2_top1.zip / os2_top1 / APPS / RAYTRACE / RT / FLATE.RT < prev    next >
Text File  |  1993-12-15  |  2KB  |  51 lines

  1. ;
  2. ; Draw the flat-earthers 'globe', ie: a cube with a world map texture mapped
  3. ; around it.
  4. ;
  5. ; map.gif is a bitmap of size 360x180 where each pixel corresponds to a
  6. ; degree of longitude and latitude. 0 deg lon., 0 deg lat. is at pixel (180,90).
  7. ;
  8. ; Since we may be rendering a big picture, one pixel in the map may expand to
  9. ; cover several pixels in the final picture. To reduce the visibility of this,
  10. ; we use linear interpolation over the map bitmap.
  11. ;
  12. ; We use col_remap to ensure that when a ray strikes the globe the intersection
  13. ; coordinates are computed relative to the centre of the colour =(0,0,0).
  14. ; This corresponds to the centre of the globe and if the globe is translated
  15. ; or rotated, the colour mapping will move with it.
  16. ;
  17.  
  18. set_col col_white col(rgb(1,1,1))
  19.  
  20. set_col col_globe col_remap(xyz(0,0,0),xyz(0,0,1),xyz(1,0,0),xyz(0,1,0),
  21.                     col_sph(rad(1),rad(1),1,
  22.                       col_interp0(
  23.                         col_interp1(
  24.                           col_field2d(180,90,"map.gif")))))
  25.  
  26. set_surf surf_globe surf(0.4,0.9,0.1,0,col_globe,col_white,200,1)
  27.  
  28. set_shape shape_globe isect(x_gt(-0.6,surf_globe),x_lt(0.6,surf_globe),
  29.                             y_gt(-0.6,surf_globe),y_lt(0.6,surf_globe),
  30.                             z_gt(-0.6,surf_globe),z_lt(0.6,surf_globe))
  31.  
  32. set_attenuation 1 0.98
  33. set_ambient rgb(0.2,0.2,0.2)
  34. add_light xyz(25,10,25) rgb(2,2,2)
  35.  
  36. set_shape r shape_globe
  37. set_xyz e xyz( 0, 1, 3)
  38. set_xyz f xyz( 0,-1,-3)
  39. set_xyz u xyz( 0, 3,-1)
  40. set_value ax rad(20)
  41. set_value ay rad(20)
  42. set_value cx 200
  43. set_value cy 200
  44.  
  45. render rot_y(r,rad(  0)) e f u ax ay cx cy 0 0 "flate000.bmp"
  46. ;
  47. ; Note: clearly we can add extra render statements for other rotation values.
  48. ; If we do this we can trace an entire animation of the earth spinning.
  49. ; Just step the rad(0) to rad(350) in steps of 10 for example.
  50. ;
  51.