Exports mesh entity to Wavefront OBJ text format for broad software compatibility.
Takes meshHandle (entity with mesh data), filename (output .obj path), meshName (mesh name in OBJ comment, defaults to "Mesh_0" if empty).
Returns 1 on success, 0 on failure.
3D Graphics
Parameters & Returns
Parameters
meshHandleInt
filenameString
meshNameString
Returns
Int
Quick Summary
Exports mesh entity to Wavefront OBJ text format for broad software compatibility.
Takes meshHandle (entity with mesh data), filename (output .obj path), meshName (mesh name in OBJ comment, defaults to "Mesh_0" if empty).
Returns 1 on success, 0 on failure.
Technical Exegesis...
Exports mesh entity to Wavefront OBJ text format for broad software compatibility. Takes meshHandle (entity with mesh data), filename (output .obj path), meshName (mesh name in OBJ comment, defaults to "Mesh_0" if empty). Returns 1 on success, 0 on failure. Validates entity exists and has mesh. Opens file for writing. Writes OBJ header comments (BambooBasic export, mesh name). Writes "o Mesh" object declaration. Collects all vertices/indices from surfaces (surface-based) or mesh buffers (loaded).
Exports mesh entity to Wavefront OBJ text format for broad software compatibility. Takes meshHandle (entity with mesh data), filename (output .obj path), meshName (mesh name in OBJ comment, defaults to "Mesh_0" if empty). Returns 1 on success, 0 on failure. Validates entity exists and has mesh. Opens file for writing. Writes OBJ header comments (BambooBasic export, mesh name). Writes "o Mesh" object declaration. Collects all vertices/indices from surfaces (surface-based) or mesh buffers (loaded). Writes vertex positions as "v x y z" lines. Writes texture coordinates as "vt u v" lines (if present). Writes normals as "vn x y z" lines (if present). Writes faces as "f v1/vt1/vn1 v2/vt2/vn2 v3/vt3/vn3" triangles. OBJ uses 1-based indexing (adds 1 to all indices). Returns 0 if: invalid handle, no mesh data, file creation fails.
This function exports to Wavefront OBJ - text-based 3D format from 1990s, still widely supported. OBJ advantages: human-readable (can edit in text editor), universal import (Blender, Maya, 3DS Max, Unity, Unreal), simple specification. OBJ limitations: no material embedding (requires separate .mtl file, not generated), no vertex colors, no multi-UV sets (only TEXCOORD_0), no animations, no scene hierarchy. File structure: header comments, vertex positions (v), texture coords (vt), normals (vn), faces (f). Face format: "f 1/1/1 2/2/2 3/3/3" means vertex1/UV1/normal1 vertex2/UV2/normal2 vertex3/UV3/normal3. Triangulated output (all faces have 3 vertices). Coordinate system: OBJ convention +Y up (matches BambooBasic). Use cases: (1) Export to Blender for editing, (2) Share models with colleagues (universal format), (3) Debug mesh topology (human-readable), (4) Import to web converters. For full material preservation, use b3dSaveMeshGLB instead. For texture atlas baking, use b3dSaveMeshBaked. Common workflow: create procedural mesh with b3dCreateMesh, add surfaces with different materials, export OBJ, import to Blender, assign materials manually, re-export as GLB.