Saves a mesh entity to file, automatically choosing format based on extension.
Takes meshHandle (entity with mesh data), filename (output path with extension), meshName (name for mesh in file metadata).
Returns 1 on success, 0 on failure.
3D Graphics
Parameters & Returns
Parameters
meshHandleInt
filenameString
meshNameString
Returns
Int
Quick Summary
Saves a mesh entity to file, automatically choosing format based on extension.
Takes meshHandle (entity with mesh data), filename (output path with extension), meshName (name for mesh in file metadata).
Returns 1 on success, 0 on failure.
Technical Exegesis...
Saves a mesh entity to file, automatically choosing format based on extension. Takes meshHandle (entity with mesh data), filename (output path with extension), meshName (name for mesh in file metadata). Returns 1 on success, 0 on failure. Extracts file extension from filename. Converts extension to lowercase. If extension is ".obj", calls b3dSaveMeshOBJ. Otherwise (default), calls b3dSaveMeshGLB for binary GLB format. Wrapper function that routes to format-specific savers.
Saves a mesh entity to file, automatically choosing format based on extension. Takes meshHandle (entity with mesh data), filename (output path with extension), meshName (name for mesh in file metadata). Returns 1 on success, 0 on failure. Extracts file extension from filename. Converts extension to lowercase. If extension is ".obj", calls b3dSaveMeshOBJ. Otherwise (default), calls b3dSaveMeshGLB for binary GLB format. Wrapper function that routes to format-specific savers. Supports both surface-based meshes (created with b3dCreateMesh, b3dCreateSphere, etc.) and loaded meshes (from b3dLoadMesh). Returns 0 if entity doesn't exist, entity has no mesh, or format-specific saver fails.
This function provides convenient format dispatch based on extension. Supported formats: .glb (binary glTF, recommended for round-trip with b3dLoadMesh, preserves materials/UVs/submeshes), .obj (Wavefront OBJ, text format, widely compatible, loses some material data). Use GLB for game assets, OBJ for interchange with modeling software. Extension detection case-insensitive (".GLB" and ".glb" both work). If no extension or unrecognized extension, defaults to GLB. MeshName parameter becomes object name in file - use descriptive names for identification in modeling software. Common workflow: (1) Load mesh, (2) Modify with b3dSetEntityColor, b3dSetScale, b3dBakeMesh, (3) Save with b3dSaveMesh. Surface-based meshes export all surfaces as separate primitives/groups. Loaded meshes export as originally loaded (maintains submesh structure). Doesn't save entity transform (position/rotation/scale) - only mesh geometry/materials. To save transformed mesh, use b3dCopyMesh or manually bake transform into vertices.