PaintMesh.htm 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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>PaintMesh mesh,brush</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. mesh - mesh handle <br />
  13. brush - brush handle
  14. </td>
  15. </tr>
  16. </table>
  17. <h1>Description</h1>
  18. <table>
  19. <tr>
  20. <td>
  21. Paints a mesh with a brush. <br />
  22. <br />
  23. This has the effect of instantly altering the visible appearance of the mesh, assuming the brush's properties are different to what was was applied to the surface before. <br />
  24. <br />
  25. The reason for using PaintMesh to apply specific properties to a mesh using a brush rather than just using EntityTexture, EntityColor, EntityShininess etc, is that you can pre-define one brush, and then paint meshes over and over again using just the one command rather than lots of separate ones. <br />
  26. <br />
  27. See also: PaintEntity, PaintSurface.
  28. </td>
  29. </tr>
  30. </table>
  31. <h1><a href=../3d_examples/PaintMesh.bb>Example</a></h1>
  32. <table>
  33. <tr>
  34. <td>
  35. ; PaintMesh 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. ; And some other effects <br />
  59. BrushColor brush,0,0,255 <br />
  60. BrushShininess brush,1 <br />
  61. <br />
  62. ; Paint mesh with brush <br />
  63. PaintMesh cube,brush <br />
  64. <br />
  65. While Not KeyDown( 1 ) <br />
  66. <br />
  67. pitch#=0 <br />
  68. yaw#=0 <br />
  69. roll#=0 <br />
  70. <br />
  71. If KeyDown( 208 )=True Then pitch#=-1 <br />
  72. If KeyDown( 200 )=True Then pitch#=1 <br />
  73. If KeyDown( 203 )=True Then yaw#=-1 <br />
  74. If KeyDown( 205 )=True Then yaw#=1 <br />
  75. If KeyDown( 45 )=True Then roll#=-1 <br />
  76. If KeyDown( 44 )=True Then roll#=1 <br />
  77. <br />
  78. TurnEntity cube,pitch#,yaw#,roll# <br />
  79. <br />
  80. RenderWorld <br />
  81. Flip <br />
  82. <br />
  83. Wend <br />
  84. <br />
  85. End
  86. </td>
  87. </tr>
  88. </table>
  89. <br>
  90. <a target=_top href=../index.htm>Index</a><br>
  91. <br>
  92. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=PaintMesh&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  93. </html>