LightMesh.htm 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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>LightMesh mesh,red#,green#,blue#[,range#][,light_x#][,light_y#][,light_z#]</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. mesh - mesh handle <br />
  13. red# - mesh red value <br />
  14. green# - mesh green value <br />
  15. blue# - mesh blue value <br />
  16. range# (optional) - light range <br />
  17. light_x# (optional) - light x position <br />
  18. light_y# (optional) - light y position <br />
  19. light_z# (optional) - light z position
  20. </td>
  21. </tr>
  22. </table>
  23. <h1>Description</h1>
  24. <table>
  25. <tr>
  26. <td>
  27. Performs a 'fake' lighting operation on a mesh. <br />
  28. <br />
  29. You need to use EntityFX ent,2 to enable vertex colors on the target mesh before you can see any results. <br />
  30. <br />
  31. Since V1.83 the default vertex color for primitives is 255,255,255 and not 0,0,0, so for LightMesh to effect primitives as it did before, you will first need to reset the vertex colors to 0,0,0. You can do this using LightMesh mesh,-255,-255,-255.
  32. </td>
  33. </tr>
  34. </table>
  35. <h1><a href=../3d_examples/LightMesh.bb>Example</a></h1>
  36. <table>
  37. <tr>
  38. <td>
  39. Graphics3D 640,480 ,16,2 <br />
  40. camera=CreateCamera() <br />
  41. <br />
  42. ent=CreateSphere() <br />
  43. EntityFX ent,2 ; enable vertex colors <br />
  44. Lightmesh ent,-255,-255,-255 ; reset vertex colors from 255,255,255 (default) to 0,0,0 <br />
  45. LightMesh ent,255,255,0,50,-20,20,-20 ; apply fake lighting <br />
  46. <br />
  47. MoveEntity camera,0,2,-10 <br />
  48. PointEntity camera,ent <br />
  49. <br />
  50. While Not KeyDown(1) <br />
  51. RenderWorld <br />
  52. Flip <br />
  53. Wend <br />
  54. End
  55. </td>
  56. </tr>
  57. </table>
  58. <br>
  59. <a target=_top href=../index.htm>Index</a><br>
  60. <br>
  61. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=LightMesh&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  62. </html>