Scales surface detail texture UV (scaleU/V, requires BBR_TEXTURE_UV mesh flag, surface-based only). Takes meshHandle (mesh entity handle), surfaceHandle (surface index 0 to surfaceCount-1), textureHandle (texture handle identifying which layer), scaleU (horizontal UV scale double), scaleV (vertical UV scale double). Returns nothing. Finds detail layer containing textureHandle in specific surface's material, updates detailTextureScale[i] to {scaleU, scaleV}, controls texture repeat/stretch. Requires mesh.
Scales surface detail texture UV (scaleU/V, requires BBR_TEXTURE_UV mesh flag, surface-based only). Takes meshHandle (mesh entity handle), surfaceHandle (surface index 0 to surfaceCount-1), textureHandle (texture handle identifying which layer), scaleU (horizontal UV scale double), scaleV (vertical UV scale double). Returns nothing. Finds detail layer containing textureHandle in specific surface's material, updates detailTextureScale[i] to {scaleU, scaleV}, controls texture repeat/stretch. Requires mesh.allowsUVTransforms = true (set via BBR_TEXTURE_UV flag in b3dCreateMesh).
This function scales surface detail texture coordinates. UV scaling: scaleU/V multiply texture coordinates (scaleU=2.0 repeats texture twice horizontally, scaleU=0.5 stretches texture to half size, scaleV independent vertical control). UV transform requirement: mesh must be created with BBR_TEXTURE_UV flag (b3dCreateMesh(slots, BBR_TEXTURE_UV, unique) enables UV transforms), prints error if mesh.allowsUVTransforms = false, prevents UV manipulation on meshes without support. Layer identification: searches surface's material detailTextureIndex[0-2] for matching textureHandle (finds which layer contains this texture), updates corresponding detailTextureScale[i] (scale stored per layer). Use cases: (1) Texture tiling (scaleU=4.0, scaleV=4.0 to repeat detail 4x4 times for fine patterns), (2) Anisotropic scaling (scaleU=2.0, scaleV=1.0 for horizontal stretching), (3) Uniform scaling (scaleU=scaleV for proportional resize), (4) Dynamic tiling (animate scale for scrolling/panning effects), (5) Resolution matching (scale to match texture resolution to surface size). Common patterns: tile 4x4 b3dScaleSurfaceDetailTexture(mesh, surf, detail, 4.0, 4.0), stretch horizontally b3dScaleSurfaceDetailTexture(mesh, surf, detail, 2.0, 1.0), animate scrolling scaleU = scaleU + 0.01 then b3dScaleSurfaceDetailTexture(mesh, surf, detail, scaleU, scaleV). Typical usage: set scale > 1.0 to tile detail texture for fine patterns (brick, scratches), set scale < 1.0 to stretch detail texture for large features, set different scaleU/V for directional effects, animate for scrolling textures. UV coordinate math: finalUV = baseUV * scale (scaleU=2.0 converts UV 0.0-1.0 to 0.0-2.0, causing 2x repeat, scaleU=0.5 converts to 0.0-0.5, stretching texture to half width). Scale defaults: likely 1.0 if never set (verify during testing, 1.0 = no scaling, texture shown as-is). Surface targeting: affects single surface only (different scale per surface for variety, cube face 0 at scale 2.0, face 1 at scale 4.0). Texture wrapping: scaled UVs interact with texture sampler wrap mode (REPEAT wraps UVs > 1.0 back to 0.0 for tiling, CLAMP stretches last pixel, typically REPEAT for detail textures). Performance: O(1) operation (finds surface, searches 3 slots, updates 2 floats), scale applied in vertex/pixel shader (no CPU cost per frame). Surface-based restriction: only works for surface-based meshes (entity.mesh->isSurfaceBased = true), prints error if mesh not surface-based. UV transforms disabled error: prints helpful error if mesh.allowsUVTransforms = false, instructs to use BBR_TEXTURE_UV flag when creating mesh. Texture not found: prints error if textureHandle not in any layer for this surface (must call b3dSetSurfaceDetailTexture first). Validation: prints error if invalid mesh handle, mesh not surface-based, UV transforms not allowed, invalid surface handle, invalid texture handle, surface has no material, texture not assigned to surface. Related: b3dPositionSurfaceDetailTexture offsets detail texture UV (translation), b3dRotateSurfaceDetailTexture rotates detail texture UV, b3dSetSurfaceDetailTexture adds detail layer (required before scaling), b3dCreateMesh creates mesh with BBR_TEXTURE_UV flag (enables UV transforms).