home *** CD-ROM | disk | FTP | other *** search
/ DarkBasic Professional / DarkBasicPro.iso / data1.cab / Lang_Files_(English) / Help / examples / basic3d / basic3d4-example.dba < prev    next >
Encoding:
Text File  |  2004-09-22  |  1.9 KB  |  67 lines

  1. rem Primitive Texturing
  2.  
  3. rem Standard Setup Code for all examples
  4. `set window off
  5. sync on : sync rate 0 : color backdrop rgb(0,128,0)
  6. set text font "arial" : set text size 16
  7. set text to bold : set text transparent
  8.  
  9. rem Load images (textures)
  10. load image "a.bmp",1
  11. load image "b.bmp",2
  12. load image "c.bmp",3
  13. load image "d.bmp",4
  14. load image "e.bmp",5
  15. load image "sphere.bmp",6
  16. load image "bump.bmp",7
  17. load image "shade.bmp",8
  18. load image "edge.dds",9
  19.  
  20. rem Make object
  21. make object cube 1,10 : color object 1,rgb(255,0,0)
  22. make object box 2,10,2,10 : color object 2,rgb(0,255,0)
  23. make object sphere 3,10,6,6 : color object 3,rgb(0,0,255)
  24. make object triangle 5,0,0,0,10,0,0,10,10,0
  25. make object plain 6,10,10
  26. make object cylinder 7,10
  27. make object cone 8,10
  28. make object sphere 4,10
  29. for x=1 to 8
  30.  position object x,(x-4)*10,0,0
  31. next x
  32.  
  33. rem Set camera and light
  34. move camera -100
  35. set point light 0,0,0,0
  36.  
  37. rem Main loop
  38. desc$="Texturing Primitives (Press 1-6)"
  39. do
  40.  
  41. rem Affect object with textures
  42. for t=1 to 8
  43.  if inkey$()="1" then texture object t,1 : desc$="1. Normal Texture"
  44.  if inkey$()="2" then set light mapping on t,2 : desc$="2. Light Mapping"
  45.  if inkey$()="3" then set cube mapping on t,1,2,3,4,5,6 : desc$="3. Cube Mapping"
  46.  if inkey$()="4" then set sphere mapping on t,6 : desc$="4. Sphere Mapping"
  47.  if inkey$()="5" then set detail mapping on t,4 : desc$="5. Detail Mapping"
  48.  if inkey$()="6" then set blend mapping on t,5,10 : desc$="6. Custom Blend Mapping"
  49.  yrotate object t,wrapvalue(object angle y(t)+0.3)
  50. next t
  51.  
  52. rem New object creator
  53. if spacekey()=1 then delete object 4 : make object sphere 4,100
  54.  
  55. rem Move light using mouse
  56. position light 0,mousex()-320,240-mousey(),-50
  57.  
  58. rem Show Framerate
  59. text 20,screen height()-40,desc$
  60. text screen width()-170,screen height()-40,"DBPro Fps: "+str$(screen fps())
  61.  
  62. rem Update screen
  63. sync
  64.  
  65. rem End loop
  66. loop
  67.