Removes surface detail layer (frees slot, compacts layers, 1=success 0=not found, surface-based only).
Takes meshHandle (mesh entity handle), surfaceHandle (surface index 0 to surfaceCount-1), textureHandle (texture handle identifying which layer to remove).
Returns 1 (TRUE) if layer removed successfully, 0 (FALSE) if texture not found or error.
3D Graphics
Parameters & Returns
Parameters
meshHandleInt
surfaceHandleInt
textureHandleInt
Returns
Int
Quick Summary
Removes surface detail layer (frees slot, compacts layers, 1=success 0=not found, surface-based only).
Takes meshHandle (mesh entity handle), surfaceHandle (surface index 0 to surfaceCount-1), textureHandle (texture handle identifying which layer to remove).
Returns 1 (TRUE) if layer removed successfully, 0 (FALSE) if texture not found or error.
Technical Exegesis...
Removes surface detail layer (frees slot, compacts layers, 1=success 0=not found, surface-based only). Takes meshHandle (mesh entity handle), surfaceHandle (surface index 0 to surfaceCount-1), textureHandle (texture handle identifying which layer to remove). Returns 1 (TRUE) if layer removed successfully, 0 (FALSE) if texture not found or error. Finds detail layer containing textureHandle in specific surface's material, removes it, shifts higher layers down to compact array, clears last slot.
Removes surface detail layer (frees slot, compacts layers, 1=success 0=not found, surface-based only). Takes meshHandle (mesh entity handle), surfaceHandle (surface index 0 to surfaceCount-1), textureHandle (texture handle identifying which layer to remove). Returns 1 (TRUE) if layer removed successfully, 0 (FALSE) if texture not found or error. Finds detail layer containing textureHandle in specific surface's material, removes it, shifts higher layers down to compact array, clears last slot. Surface-based meshes only.
This function removes surface-specific detail layers. Layer identification: searches surface's material detailTextureIndex[0-2] for matching textureHandle (finds which layer contains this texture in this specific surface), returns 0 if not found (texture not in any layer for this surface). Layer compaction: shifts remaining layers down to fill gap (if removing layer 0 then layer 1 becomes 0, layer 2 becomes 1, layer 2 cleared), ensures no gaps in layer array. Slot clearing: last layer (layer 2 after compaction) set to detailTextureIndex=-1, detailBlendFactor=0.0 (marks as empty, ready for new texture). Surface targeting: affects single surface only (removing detail from cube face 0 does not affect face 1), allows per-surface detail management. Use cases: (1) Surface-specific cleanup (remove rust from cleaned surface, keep on other surfaces), (2) Selective detail removal (remove damage from repaired face, leave on others), (3) Slot reuse per surface (remove old detail from specific surface to add new one), (4) Dynamic surface states (remove clean texture from surface, add dirty texture), (5) Per-surface layer swapping (swap detail on one face without affecting others). Common patterns: remove from surface result = b3dRemoveSurfaceDetailTexture(mesh, surf, detail) if result = 0 then print "Not found", selective removal for damaged in damagedSurfaces then b3dRemoveSurfaceDetailTexture(mesh, damaged, oldDetail), swap surface detail b3dRemoveSurfaceDetailTexture(mesh, surf, old) then b3dSetSurfaceDetailTexture(mesh, surf, new). Typical usage: remove detail from specific surface when no longer needed (repair damage on one face), remove to free slot for different texture (swap decals per surface), remove for per-surface dynamic management (weathering changes surface by surface). Surface-based restriction: only works for surface-based meshes (entity.mesh->isSurfaceBased = true), prints error if mesh not surface-based, does NOT work for loaded GLB models. Not found return: returns 0 if textureHandle not in any layer for this surface (texture never added to this surface or already removed, safe to call without checking). Performance: O(1) operation (finds surface, searches 3 slots, shifts at most 2 elements). Validation: prints error if invalid mesh handle, mesh not surface-based, invalid surface handle, invalid texture handle, surface has no material, returns 0 for all errors. Related: b3dSetSurfaceDetailTexture adds surface detail layer (inverse operation), b3dSetSurfaceDetailAlpha adjusts surface detail opacity (alternative to removal), b3dRemoveEntityDetailTexture removes detail from all surfaces (entire mesh).