CreateBrush.bb 763 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. ; CreateBrush 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 shininess
  17. BrushShininess brush,1
  18. ; Paint mesh with brush
  19. PaintMesh cube,brush
  20. While Not KeyDown( 1 )
  21. pitch#=0
  22. yaw#=0
  23. roll#=0
  24. If KeyDown( 208 )=True Then pitch#=-1
  25. If KeyDown( 200 )=True Then pitch#=1
  26. If KeyDown( 203 )=True Then yaw#=-1
  27. If KeyDown( 205 )=True Then yaw#=1
  28. If KeyDown( 45 )=True Then roll#=-1
  29. If KeyDown( 44 )=True Then roll#=1
  30. TurnEntity cube,pitch#,yaw#,roll#
  31. RenderWorld
  32. Flip
  33. Wend
  34. End