PositionTexture.htm 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <html>
  2. <head>
  3. <title>Blitz3D Docs</title>
  4. <link rel=stylesheet href=../css/commands.css type=text/css>
  5. </head>
  6. <body>
  7. <h1>PositionTexture texture,u_position#,v_position#</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. texture - texture handle <br />
  13. u_position# - u position of texture <br />
  14. v_position# - v position of texture
  15. </td>
  16. </tr>
  17. </table>
  18. <h1>Description</h1>
  19. <table>
  20. <tr>
  21. <td>
  22. Positions a texture at an absolute position. <br />
  23. <br />
  24. This will have an immediate effect on all instances of the texture being used. <br />
  25. <br />
  26. Positioning a texture is useful for performing scrolling texture effects, such as for water etc.
  27. </td>
  28. </tr>
  29. </table>
  30. <h1><a href=../3d_examples/PositionTexture.bb>Example</a></h1>
  31. <table>
  32. <tr>
  33. <td>
  34. ; PositionTexture Example <br />
  35. ; ----------------------- <br />
  36. <br />
  37. Graphics3D 640,480 <br />
  38. SetBuffer BackBuffer() <br />
  39. <br />
  40. camera=CreateCamera() <br />
  41. <br />
  42. light=CreateLight() <br />
  43. RotateEntity light,90,0,0 <br />
  44. <br />
  45. cube=CreateCube() <br />
  46. PositionEntity cube,0,0,5 <br />
  47. <br />
  48. ; Load texture <br />
  49. tex=LoadTexture( "media/b3dlogo.jpg" ) <br />
  50. <br />
  51. ; Texture cube <br />
  52. EntityTexture cube,tex <br />
  53. <br />
  54. ; Set initial uv position values <br />
  55. u_position#=1 <br />
  56. v_position#=1 <br />
  57. <br />
  58. While Not KeyDown( 1 ) <br />
  59. <br />
  60. ; Change uv position values depending on key pressed <br />
  61. If KeyDown( 208 )=True Then u_position#=u_position#-0.01 <br />
  62. If KeyDown( 200 )=True Then u_position#=u_position#+0.01 <br />
  63. If KeyDown( 203 )=True Then v_position#=v_position#-0.01 <br />
  64. If KeyDown( 205 )=True Then v_position#=v_position#+0.01 <br />
  65. <br />
  66. ; Position texture <br />
  67. PositionTexture tex,u_position#,v_position# <br />
  68. <br />
  69. TurnEntity cube,0.1,0.1,0.1 <br />
  70. <br />
  71. RenderWorld <br />
  72. <br />
  73. Text 0,0,"Use cursor keys to change uv position values" <br />
  74. Text 0,20,"u_position#="+u_position# <br />
  75. Text 0,40,"v_position#="+v_position# <br />
  76. <br />
  77. Flip <br />
  78. <br />
  79. Wend <br />
  80. <br />
  81. End
  82. </td>
  83. </tr>
  84. </table>
  85. <br>
  86. <a target=_top href=../index.htm>Index</a><br>
  87. <br>
  88. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=PositionTexture&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  89. </html>