CountSurfaces.bb 530 B

123456789101112131415161718192021222324252627282930
  1. ; LoadMesh Example
  2. ; ----------------
  3. Graphics3D 640,480
  4. SetBuffer BackBuffer()
  5. camera=CreateCamera()
  6. CameraClsColor camera,0,0,255
  7. light=CreateLight()
  8. RotateEntity light,90,0,0
  9. drum=LoadMesh( "media/teapot.x" )
  10. PositionEntity drum,0,0,10
  11. RotateEntity drum,0,45,0
  12. While Not KeyDown( 1 )
  13. RenderWorld
  14. ; Count no. of surfaces in mesh
  15. count_surf=CountSurfaces(drum)
  16. Text 0,0,"This mesh has "+count_surf+" surface(s)"
  17. ; Press space
  18. If KeyDown( 57 )=True Then surf=GetSurface(drum,1) : ClearSurface surf
  19. Flip
  20. Wend
  21. End