Rotates surface detail texture UV (angle in degrees, 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), angle (rotation angle in degrees double).
Returns nothing.
3D Graphics
Parameters & Returns
Parameters
meshHandleInt
surfaceHandleInt
textureHandleInt
angleDouble
Returns
Void
Quick Summary
Rotates surface detail texture UV (angle in degrees, 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), angle (rotation angle in degrees double).
Returns nothing.
Technical Exegesis...
Rotates surface detail texture UV (angle in degrees, 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), angle (rotation angle in degrees double). Returns nothing. Finds detail layer containing textureHandle in specific surface's material, updates detailTextureRotation[i] to angle, controls texture rotation around UV center (0.5, 0.5). Requires mesh.
Rotates surface detail texture UV (angle in degrees, 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), angle (rotation angle in degrees double). Returns nothing. Finds detail layer containing textureHandle in specific surface's material, updates detailTextureRotation[i] to angle, controls texture rotation around UV center (0.5, 0.5). Requires mesh.allowsUVTransforms = true (set via BBR_TEXTURE_UV flag in b3dCreateMesh).
This function rotates surface 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 back to start), rotates around UV center point (0.5, 0.5, texture center). 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. Layer identification: searches surface's material detailTextureIndex[0-2] for matching textureHandle (finds which layer contains this texture), updates corresponding detailTextureRotation[i] (rotation stored per layer). Use cases: (1) Decal orientation (rotate logo to match surface orientation, 90 degrees for vertical), (2) Pattern alignment (rotate wood grain to match direction, align scratches with geometry), (3) Animated rotation (spin textures for effects, rotating fans, spinning wheels), (4) Random variation (different rotation per surface for organic randomness), (5) Directional effects (rotate streaks/stripes to flow direction). Common patterns: rotate 90 degrees b3dRotateSurfaceDetailTexture(mesh, surf, detail, 90.0), spin animation angle = angle + 1.0 then b3dRotateSurfaceDetailTexture(mesh, surf, detail, angle), random per surface b3dRotateSurfaceDetailTexture(mesh, i, detail, mathRnd(360.0)). Typical usage: rotate to align decals/patterns with surface features, animate rotation for spinning effects, set random rotation per surface for variation (wood grain, scratches), adjust orientation for directional textures. UV coordinate math: rotation matrix applied around center (0.5, 0.5), UVs transformed via cos/sin of angle (shader computes rotated coordinates on GPU). Rotation center: always rotates around UV (0.5, 0.5) texture center (not corner, provides intuitive rotation), cannot customize center point. Angle wrapping: angles > 360 or < 0 wrap around (angle=450 same as angle=90, angle=-90 same as angle=270), full rotations multiples of 360 have no effect. Rotation defaults: likely 0.0 if never set (verify during testing, 0.0 = no rotation, texture aligned to UV axes). Surface targeting: affects single surface only (different rotation per surface for variety, randomized orientations). Animated rotation: increment angle each frame for spinning textures (fans, wheels, whirlpools), use mathMod(angle, 360.0) to prevent overflow. Performance: O(1) operation (finds surface, searches 3 slots, updates 1 float), rotation matrix computed in shader (sin/cos per pixel, moderate cost). 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: b3dScaleSurfaceDetailTexture scales detail texture UV, b3dPositionSurfaceDetailTexture offsets detail texture UV, b3dSetSurfaceDetailTexture adds detail layer (required before rotating), b3dCreateMesh creates mesh with BBR_TEXTURE_UV flag (enables UV transforms).