home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 63 / CDACTUAL63.iso / Aplicaciones / DarkBasic / DemoDarkBasic.exe / help / examples / matrix3d / exam04.dba < prev    next >
Encoding:
Text File  |  1999-09-22  |  1.7 KB  |  74 lines

  1. Rem * Title  : Matrix Moulding
  2. Rem * Author : DBS-LB
  3. Rem * Date   : 1st Sept 99
  4. rem ===========================================
  5. rem DARK BASIC EXAMPLE PROGRAM 4
  6. rem ===========================================
  7. rem This program will mould a matrix landscape
  8. rem -------------------------------------------
  9.  
  10. load bitmap "floor1.bmp",1
  11. get image 1,0,0,256,256
  12. delete bitmap 1
  13.  
  14. rem Make a matrix
  15. make matrix 1,1000,1000,11,11
  16.  
  17. rem Prepare matrix with a texture cut into a 2x2 texture grid 
  18. prepare matrix texture 1,1,2,2
  19.  
  20. rem Fill matrix with first texture tile
  21. fill matrix 1,200.0,1
  22. for x=0 to 10
  23.     for y=0 to 10
  24.         set matrix height 1,x,5,0.0
  25.         set matrix height 1,x,6,0.0
  26.         set matrix height 1,x+1,5,0.0
  27.         set matrix height 1,x+1,6,0.0
  28.         set matrix height 1,5,y,0.0
  29.         set matrix height 1,6,y,0.0
  30.         set matrix height 1,5,y+1,0.0
  31.         set matrix height 1,6,y+1,0.0
  32.         set matrix tile 1,x,5,0
  33.         set matrix tile 1,5,y,0
  34.     next y
  35. next x
  36. update matrix 1
  37.  
  38. rem Make simple object to demonstrate ground height grabbing
  39. make object cone 1,100
  40. scale object 1,20,100,20
  41. xrotate object 1,180
  42.  
  43. rem Add fog for depth effect
  44. fog on
  45.  
  46. rem Activate manual sync
  47. sync on
  48.  
  49. rem Begin Loop
  50. while mouseclick()=0
  51.  
  52.     rem Place and point camera to see matrix properly
  53.     a#=wrapvalue(a#+1.0)
  54.     position camera newxvalue(500,a#,300),400,newzvalue(500,a#,300)
  55.     point camera 500,0,500
  56.  
  57.     rem Position object to show ground height
  58.     gx#=newxvalue(500,wrapvalue(a#+180),150)
  59.     gz#=newzvalue(500,wrapvalue(a#+180),150)
  60.     gy#=50+get ground height(1,gx#,gz#)
  61.     position object 1,gx#,gy#,gz#
  62.  
  63.     rem Update screen
  64.     sync
  65.  
  66. rem End loop
  67. endwhile
  68.  
  69. rem Delete the matrix
  70. delete matrix 1
  71.  
  72. rem End the program
  73. end
  74.