Category: 2D Overlay
Syntax:
b2dLoadMesh:Int(filePath:String)
.bb3d fileA mesh handle, or 0 if the file is missing or not a valid .bb3d
Loads a 3D model baked to the .bb3d format and returns a handle to it. The handle
is an asset, like an image: the runtime stores the geometry, any animation frames and the
texture, but never draws anything by itself. Your program reads the mesh back, projects its
vertices to the screen and draws each face — with
b2dDrawImageQuadDepthUV for a textured model, or
b2dDrawQuadDepth coloured by
b2dMeshFaceR/G/B for one without a texture.
.bb3d files are made from .glb models in the IDE, with
Tools → GLB to .bb3d Mesh Converter. It bakes skeletal animation to morph frames at the
rate you choose, one clip per animation in the file, copies out the texture as a .png
beside the .bb3d, and then offers a preview you can scrub through frame by frame
— the way to find the frame numbers to pass to b2dMeshAnimate.
Every version of the format is read: static and animated, float, 16-bit and compressed frames,
and material colours.
If the file names a texture, it is loaded automatically from the same folder as the .bb3d
— get its image handle with b2dMeshTexture. A texture that
cannot be found does not stop the mesh loading; b2dMeshTexture just returns 0. Because textures
are images, call this after b2dGraphics.
A malformed, truncated or unrecognised file returns 0 and prints the reason, rather than
crashing. There is no call to free a mesh.
View detailed documentation online
mesh = b2dLoadMesh("Media/cube.bb3d")
If mesh = 0 Then
Print "Could not load the mesh"
Return 1
EndIf
Print b2dMeshVertCount(mesh) & " vertices, " & b2dMeshFaceCount(mesh) & " faces"
See examples/Runtime/30 - Meshes.
BambooBasic © 2026 Michael Denathorn