Enables/disables base texture tiling (WRAP vs CLAMP mode). Takes entityHandle (mesh entity), enable (1 = tile/wrap, 0 = clamp). Returns nothing. Sets material.tileBase flag for texture sampling mode.
This function controls texture addressing. Tiling modes: enable=1 (WRAP mode, texture repeats infinitely), enable=0 (CLAMP mode, texture edges stretched), affects base color texture sampling in shader, changes how UVs outside 0-1 range are handled. WRAP mode: UVs outside 0-1 repeat the texture (e.g., UV 2.
Enables/disables base texture tiling (WRAP vs CLAMP mode). Takes entityHandle (mesh entity), enable (1 = tile/wrap, 0 = clamp). Returns nothing. Sets material.tileBase flag for texture sampling mode.
This function controls texture addressing. Tiling modes: enable=1 (WRAP mode, texture repeats infinitely), enable=0 (CLAMP mode, texture edges stretched), affects base color texture sampling in shader, changes how UVs outside 0-1 range are handled. WRAP mode: UVs outside 0-1 repeat the texture (e.g., UV 2.5 wraps to 0.5), creates seamless tiling patterns, used for repeating textures (brick walls, grass, floor tiles), texture coordinates can exceed 1.0 for multiple repeats. CLAMP mode: UVs outside 0-1 sample edge pixels (e.g., UV 2.5 clamps to 1.0), stretches texture edges infinitely, prevents seams on non-repeating textures, used for UI elements, skyboxes, unique textures. Use cases: (1) Tiled brick wall (enable=1 for seamless repeating), (2) Character texture (enable=0 to prevent wrapping at UV seams), (3) Terrain (enable=1 for grass/dirt repetition), (4) Billboard (enable=0 for single image display), (5) Architectural detail (enable=1 for wallpaper patterns). Common patterns: procedural terrain = enable tiling for repeating ground textures, unique models = disable tiling to avoid UV artifacts, seamless textures = enable tiling with proper UV scale, non-seamless = disable tiling or fix UVs to stay in 0-1 range. Typical usage: call after creating entity or loading mesh, set once during initialization (rarely changed at runtime), combine with b3dScaleTexture or b3dPositionTexture to control repetition count, enable for textures designed to tile seamlessly. Material targeting: updates entity's material.tileBase flag, affects material override if set (materialOverrideIndex), surface-based meshes update all surface materials, loaded meshes update mesh's default material, change propagates to GPU via g_materialPropertiesDirty flag. Sampler state: tileBase flag controls D3D12_TEXTURE_ADDRESS_MODE, enable=1 uses ADDRESS_MODE_WRAP, enable=0 uses ADDRESS_MODE_CLAMP, sampler state set during material upload to GPU, affects all texture sampling of base color map. UV coordinates: with tiling enabled, UVs can be any value (2.0 = 2 repeats, 0.5 = half texture), with tiling disabled, UVs clamped to 0.0-1.0 range automatically, UV scaling (via b3dScaleTexture) only meaningful with tiling enabled for repeats. Texture design: seamless textures designed for tiling (edges match), enable tiling for these textures, non-seamless textures have unique content (don't repeat), disable tiling for unique content to prevent visible seams. Default behavior: new materials default to tiling enabled (WRAP mode), most procedural textures benefit from tiling, explicitly disable if texture shouldn't repeat, check texture design to determine appropriate mode. Performance: no performance difference between modes, sampler mode set once during material setup, GPU hardware handles both modes efficiently, change only affects texture sampling logic (not speed). UV seams: tiling disabled can show stretched edges if UVs outside 0-1, tiling enabled hides UV discontinuities with wrapping, disable tiling if texture has borders that shouldn't repeat, enable tiling for seamless patterns. Related detail textures: b3dSetDetailTextureTiling controls detail texture tiling (independent setting), base and detail textures can have different tiling modes, combine tiled base with clamped detail or vice versa. Material dirty flag: setting tiling marks g_materialPropertiesDirty = true, triggers material constant buffer upload to GPU, change takes effect on next frame, minimal cost (single flag set + GPU upload). Example scenarios: brick wall (tiling ON, UV scale 4x4 for 16 bricks), character model (tiling OFF, UVs fit in 0-1 range), grass terrain (tiling ON, UV scale 10x10 for repeated grass), UI element (tiling OFF, UV exactly 0-1), seamless metal (tiling ON for infinite pattern). Validation: function checks entity is valid mesh, prints error if invalid entity handle, prints error if entity not a mesh, no validation for enable parameter (any non-zero = enabled). Related: b3dScaleTexture scales texture UVs (repetition count with tiling), b3dPositionTexture offsets texture UVs (shifts pattern), b3dSetDetailTextureTiling sets tiling for detail textures (independent control), b3dRotateTexture rotates texture around pivot (works with both modes).