Rotates entity detail texture UV (angle in degrees, requires BBR_TEXTURE_UV flag, auto-clones shared materials). Takes entityHandle (mesh entity handle), textureHandle (texture handle identifying which detail layer), angle (rotation angle in degrees double). Returns nothing. Finds detail layer containing textureHandle, updates detailTextureRotation[i] to angle, controls detail texture rotation around UV center (0.5, 0.5). Requires mesh.
Rotates entity detail texture UV (angle in degrees, requires BBR_TEXTURE_UV flag, auto-clones shared materials). Takes entityHandle (mesh entity handle), textureHandle (texture handle identifying which detail layer), angle (rotation angle in degrees double). Returns nothing. Finds detail layer containing textureHandle, updates detailTextureRotation[i] to angle, controls detail texture rotation around UV center (0.5, 0.5). Requires mesh.allowsUVTransforms = true (set via BBR_TEXTURE_UV flag in b3dCreateMesh or b3dLoadMesh). Mesh entities only.
This function rotates entity-level detail texture coordinates. UV rotation: angle in degrees (positive = counter-clockwise, 0.0 = no rotation, 90.0 = quarter turn, 180.0 = upside down, 360.0 = full rotation), rotates around UV center point (0.5, 0.5, texture center). UV transform requirement: mesh must be created with BBR_TEXTURE_UV flag, prints helpful error if mesh.allowsUVTransforms = false. Layer identification: searches material detailTextureIndex[0-2] for matching textureHandle (compares both texture handle and SRV heap index), finds which layer contains this texture, updates corresponding detailTextureRotation[i]. Material handling: surface-based meshes (procedural shapes) update all surface materials directly (all surfaces get same detail rotation), loaded meshes (GLB models) auto-clone material if shared (calls EnsureUniqueMaterial first), applies rotation to entity's material. Use cases: (1) Detail orientation (rotate scratches/patterns to match mesh orientation), (2) Decal rotation (rotate logos to vertical 90 degrees), (3) Animated rotation (spin detail textures for effects, rotating particles), (4) Random variation (different rotation per instance for organic randomness), (5) Directional effects (rotate streaks/stripes to flow direction). Common patterns: rotate 90 degrees b3dRotateDetailTexture(entity, detailTex, 90.0), spin animation angle = angle + 1.0 then b3dRotateDetailTexture(entity, detailTex, angle), random rotation b3dRotateDetailTexture(entity, detailTex, mathRnd(360.0)). Typical usage: rotate to align detail textures with mesh features, animate rotation for spinning effects (rotating decals, spinning particles), set random rotation per instance for variation (scratch patterns, dirt), adjust orientation for directional details. Entity-level vs surface-level: b3dRotateDetailTexture applies to entire entity (all surfaces on surface-based mesh, single material on loaded mesh), b3dRotateSurfaceDetailTexture applies to specific surface (per-face control), use entity-level for uniform rotation. Material auto-cloning: loaded meshes (GLB) automatically call EnsureUniqueMaterial if shared (prevents affecting other instances). Texture handle matching: searches for textureHandle or matching SRV heap index (flexible compatibility). Performance: O(1) for loaded mesh (finds layer, updates 1 float after clone), O(N) for surface-based mesh with N surfaces, rotation matrix computed in shader (sin/cos per pixel). Texture not found: prints error if textureHandle not in any detail layer (must call b3dSetEntityDetailTexture first). Validation: prints error if invalid entity handle, entity not mesh, UV transforms not allowed, entity has no valid material, texture not found in detail layers. Related: b3dScaleDetailTexture scales entity detail texture UV, b3dPositionDetailTexture offsets entity detail texture UV, b3dSetEntityDetailTexture adds detail layer (required before rotating), b3dRotateSurfaceDetailTexture rotates surface-specific detail (per-face control), b3dCreateMesh creates mesh with BBR_TEXTURE_UV flag.