PositionTexture.bb 930 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. ; PositionTexture 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
  13. EntityTexture cube,tex
  14. ; Set initial uv position values
  15. u_position#=1
  16. v_position#=1
  17. While Not KeyDown( 1 )
  18. ; Change uv position values depending on key pressed
  19. If KeyDown( 208 )=True Then u_position#=u_position#-0.01
  20. If KeyDown( 200 )=True Then u_position#=u_position#+0.01
  21. If KeyDown( 203 )=True Then v_position#=v_position#-0.01
  22. If KeyDown( 205 )=True Then v_position#=v_position#+0.01
  23. ; Position texture
  24. PositionTexture tex,u_position#,v_position#
  25. TurnEntity cube,0.1,0.1,0.1
  26. RenderWorld
  27. Text 0,0,"Use cursor keys to change uv position values"
  28. Text 0,20,"u_position#="+u_position#
  29. Text 0,40,"v_position#="+v_position#
  30. Flip
  31. Wend
  32. End