Scales base texture UV (scaleU/V, requires BBR_TEXTURE_UV flag, auto-clones shared materials). Takes entityHandle (mesh entity handle), scaleU (horizontal UV scale double), scaleV (vertical UV scale double). Returns nothing. Updates material.baseTextureScale to {scaleU, scaleV}, controls base texture repeat/stretch. Requires mesh.allowsUVTransforms = true (set via BBR_TEXTURE_UV flag in b3dCreateMesh or b3dLoadMesh). Mesh entities only.
This function scales base texture coordinates.
Scales base texture UV (scaleU/V, requires BBR_TEXTURE_UV flag, auto-clones shared materials). Takes entityHandle (mesh entity handle), scaleU (horizontal UV scale double), scaleV (vertical UV scale double). Returns nothing. Updates material.baseTextureScale to {scaleU, scaleV}, controls base texture repeat/stretch. Requires mesh.allowsUVTransforms = true (set via BBR_TEXTURE_UV flag in b3dCreateMesh or b3dLoadMesh). Mesh entities only.
This function scales base 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) or b3dLoadMesh(filename, slots, BBR_TEXTURE_UV, unique) enables UV transforms), prints helpful error if mesh.allowsUVTransforms = false, instructs how to enable. Material handling: surface-based meshes (procedural shapes) update all surface materials directly (all surfaces get same scale), loaded meshes (GLB models) auto-clone material if shared (calls EnsureUniqueMaterial to prevent affecting other entities). Use cases: (1) Texture tiling (scaleU=4.0, scaleV=4.0 to repeat base texture 4x4 times for fine patterns), (2) Anisotropic scaling (scaleU=2.0, scaleV=1.0 for horizontal stretching like wood grain), (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 mesh size). Common patterns: tile 4x4 b3dScaleBaseTexture(entity, 4.0, 4.0), stretch horizontally b3dScaleBaseTexture(entity, 2.0, 1.0), animate scrolling scaleU = scaleU + 0.01 then b3dScaleBaseTexture(entity, scaleU, scaleV). Typical usage: set scale > 1.0 to tile base texture for repeating patterns (brick, tiles), set scale < 1.0 to stretch base texture for large features, set different scaleU/V for directional effects (horizontal stripes), animate for scrolling textures (moving clouds, water flow). UV coordinate math: finalUV = baseUV * scale (scaleU=2.0 converts UV 0.0-1.0 to 0.0-2.0, causing 2x repeat). Scale defaults: likely 1.0 if never set (verify during testing, 1.0 = no scaling, texture shown as-is). Material auto-cloning: loaded meshes (GLB) automatically call EnsureUniqueMaterial if shared (clones mesh and material for per-entity scale), prevents affecting other instances, surface-based meshes don't need cloning (each has own materials). 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). Performance: O(1) for loaded mesh (updates single material after clone), O(N) for surface-based mesh with N surfaces (all surfaces updated), scale applied in vertex/pixel shader. Validation: prints error if invalid entity handle, entity not mesh, UV transforms not allowed (mesh.allowsUVTransforms = false), entity has no valid material. Related: b3dPositionBaseTexture offsets base texture UV (translation), b3dRotateBaseTexture rotates base texture UV, b3dCreateMesh creates mesh with BBR_TEXTURE_UV flag (enables UV transforms), b3dLoadMesh loads mesh with BBR_TEXTURE_UV flag, b3dScaleDetailTexture scales detail texture UV (separate from base).