BrushTexture.htm 2.1 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>BrushTexture brush,texture[,frame][,index]</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. brush - brush handle <br />
  13. texture - texture handle <br />
  14. frame (optional) - texture frame. Defaults to 0. <br />
  15. index (optional) - texture index. Defaults to 0.
  16. </td>
  17. </tr>
  18. </table>
  19. <h1>Description</h1>
  20. <table>
  21. <tr>
  22. <td>
  23. Assigns a texture to a brush. <br />
  24. <br />
  25. The optional frame parameter specifies which animation frame, if any exist, should be assigned to the brush. <br />
  26. <br />
  27. The optional index parameter specifies texture layer that the texture should be assigned to. Brushes have up to four texture layers, 0-3 inclusive.
  28. </td>
  29. </tr>
  30. </table>
  31. <h1><a href=../3d_examples/BrushTexture.bb>Example</a></h1>
  32. <table>
  33. <tr>
  34. <td>
  35. ; BrushTexture Example <br />
  36. ; -------------------- <br />
  37. <br />
  38. Graphics3D 640,480 <br />
  39. SetBuffer BackBuffer() <br />
  40. <br />
  41. camera=CreateCamera() <br />
  42. <br />
  43. light=CreateLight() <br />
  44. RotateEntity light,90,0,0 <br />
  45. <br />
  46. cube=CreateCube() <br />
  47. PositionEntity cube,0,0,5 <br />
  48. <br />
  49. ; Load texture <br />
  50. tex=LoadTexture( "media/b3dlogo.jpg" ) <br />
  51. <br />
  52. ; Create brush <br />
  53. brush=CreateBrush() <br />
  54. <br />
  55. ; Apply texture to brush <br />
  56. BrushTexture brush,tex <br />
  57. <br />
  58. ; Paint mesh with brush <br />
  59. PaintMesh cube,brush <br />
  60. <br />
  61. While Not KeyDown( 1 ) <br />
  62. <br />
  63. pitch#=0 <br />
  64. yaw#=0 <br />
  65. roll#=0 <br />
  66. <br />
  67. If KeyDown( 208 )=True Then pitch#=-1 <br />
  68. If KeyDown( 200 )=True Then pitch#=1 <br />
  69. If KeyDown( 203 )=True Then yaw#=-1 <br />
  70. If KeyDown( 205 )=True Then yaw#=1 <br />
  71. If KeyDown( 45 )=True Then roll#=-1 <br />
  72. If KeyDown( 44 )=True Then roll#=1 <br />
  73. <br />
  74. TurnEntity cube,pitch#,yaw#,roll# <br />
  75. <br />
  76. RenderWorld <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=BrushTexture&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  89. </html>