Creates an empty surface-based mesh for procedural geometry construction.
Takes textureSlots (BBR_ONE_SLOT to BBR_FOUR_SLOT, number of UV texture channels), uvMode (BBR_NO_TEXTURE_UV or BBR_TEXTURE_UV for UV coordinate support), unique (unused, for API compatibility).
Returns mesh entity handle or 0 on failure.
3D Graphics
Parameters & Returns
Parameters
textureSlotsInt
uvModeInt
uniqueInt
Returns
Int
Quick Summary
Creates an empty surface-based mesh for procedural geometry construction.
Takes textureSlots (BBR_ONE_SLOT to BBR_FOUR_SLOT, number of UV texture channels), uvMode (BBR_NO_TEXTURE_UV or BBR_TEXTURE_UV for UV coordinate support), unique (unused, for API compatibility).
Returns mesh entity handle or 0 on failure.
Technical Exegesis...
Creates an empty surface-based mesh for procedural geometry construction. Takes textureSlots (BBR_ONE_SLOT to BBR_FOUR_SLOT, number of UV texture channels), uvMode (BBR_NO_TEXTURE_UV or BBR_TEXTURE_UV for UV coordinate support), unique (unused, for API compatibility). Returns mesh entity handle or 0 on failure. Validates textureSlots in range (1-4), validates uvMode valid. Allocates new Mesh3D structure. Sets isSurfaceBased=true (distinguishes from loaded meshes).
Creates an empty surface-based mesh for procedural geometry construction. Takes textureSlots (BBR_ONE_SLOT to BBR_FOUR_SLOT, number of UV texture channels), uvMode (BBR_NO_TEXTURE_UV or BBR_TEXTURE_UV for UV coordinate support), unique (unused, for API compatibility). Returns mesh entity handle or 0 on failure. Validates textureSlots in range (1-4), validates uvMode valid. Allocates new Mesh3D structure. Sets isSurfaceBased=true (distinguishes from loaded meshes). Sets maxDetailSlots=textureSlots (determines vertex buffer layout). Sets allowsUVTransforms=uvMode (enables per-entity materials if BBR_TEXTURE_UV). Zero-initializes buffer views (prevents GPU crashes). Creates Entity3D with type ENTITY_MESH. Sets default transform (position 0,0,0, rotation 0,0,0, scale 1,1,1). Initializes quad ray fields to defaults. Returns entity handle. Returns 0 if validation fails.
This function creates Blitz3D-style procedural meshes built via vertex/triangle addition. Surface-based architecture: mesh contains multiple surfaces, each surface has independent vertex/index arrays and material. TextureSlots parameter determines vertex size: BBR_ONE_SLOT = UV0 only (smallest), BBR_TWO_SLOT = UV0+UV1, BBR_THREE_SLOT = UV0+UV1+UV2, BBR_FOUR_SLOT = all UVs (largest, most flexible). UVMode BBR_TEXTURE_UV enables UV coordinates (most common), BBR_NO_TEXTURE_UV excludes for solid color meshes (saves memory). AllowsUVTransforms flag: when true, b3dCopyEntity clones material enabling per-copy colors; when false, material shared. Empty mesh after creation - use b3dCreateSurface, b3dAddVertex, b3dAddTriangle to build geometry. Buffer views zero-initialized critical - uninitialized views cause GPU validation errors or crashes. Mesh starts unlocked - no need to call b3dLockMesh initially. Use cases: (1) Procedural terrain (generate heightfield vertices/triangles), (2) Custom primitives (build shapes not provided by b3dCreate* functions), (3) Dynamic geometry (modify vertices each frame), (4) Debug visualization (draw collision boxes, rays). Common workflow: mesh=b3dCreateMesh(BBR_ONE_SLOT, BBR_TEXTURE_UV, 0), surface=b3dCreateSurface(mesh), v0=b3dAddVertex(...), v1=b3dAddVertex(...), v2=b3dAddVertex(...), b3dAddTriangle(mesh, surface, v0, v1, v2), b3dUnlockMesh(mesh). Alternative: b3dLoadMesh for assets, b3dCreateSphere/Cube/etc for primitives. Unique parameter ignored (retained for Blitz3D compatibility where unique controlled mesh caching).