FreeTexture.bb 841 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. ; FreeTexture Example
  2. ; -------------------
  3. Graphics3D 640,480
  4. SetBuffer BackBuffer()
  5. camera=CreateCamera()
  6. light=CreateLight()
  7. RotateEntity light,90,0,0
  8. cube=CreateCube()
  9. PositionEntity cube,0,0,5
  10. ; Load texture
  11. tex=LoadTexture( "media/b3dlogo.jpg" )
  12. ; Texture cube with texture
  13. EntityTexture cube,tex
  14. While Not KeyDown( 1 )
  15. ; If spacebar pressed then free texture
  16. If KeyHit( 57 )=True Then FreeTexture tex
  17. pitch#=0
  18. yaw#=0
  19. roll#=0
  20. If KeyDown( 208 )=True Then pitch#=-1
  21. If KeyDown( 200 )=True Then pitch#=1
  22. If KeyDown( 203 )=True Then yaw#=-1
  23. If KeyDown( 205 )=True Then yaw#=1
  24. If KeyDown( 45 )=True Then roll#=-1
  25. If KeyDown( 44 )=True Then roll#=1
  26. TurnEntity cube,pitch#,yaw#,roll#
  27. RenderWorld
  28. Text 0,0,"Press spacebar to free texture"
  29. Text 0,20,"As you can see this will not affect already textured entities"
  30. Flip
  31. Wend
  32. End