PaintMesh.bb 788 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ; PaintMesh 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. ; Create brush
  13. brush=CreateBrush()
  14. ; Apply texture to brush
  15. BrushTexture brush,tex
  16. ; And some other effects
  17. BrushColor brush,0,0,255
  18. BrushShininess brush,1
  19. ; Paint mesh with brush
  20. PaintMesh cube,brush
  21. While Not KeyDown( 1 )
  22. pitch#=0
  23. yaw#=0
  24. roll#=0
  25. If KeyDown( 208 )=True Then pitch#=-1
  26. If KeyDown( 200 )=True Then pitch#=1
  27. If KeyDown( 203 )=True Then yaw#=-1
  28. If KeyDown( 205 )=True Then yaw#=1
  29. If KeyDown( 45 )=True Then roll#=-1
  30. If KeyDown( 44 )=True Then roll#=1
  31. TurnEntity cube,pitch#,yaw#,roll#
  32. RenderWorld
  33. Flip
  34. Wend
  35. End