Sets texture parameter for entity shader (custom texture binding for shader sampling). Takes shader (shader handle from b3dLoadEntityShader, positive integer), name (texture parameter name, string matching HLSL texture variable), textureHandle (texture handle from b3dLoadTexture3D, positive integer). Returns nothing. Stores texture handle in shader.textureParams[name] map (persists until changed or shader freed).
Sets texture parameter for entity shader (custom texture binding for shader sampling). Takes shader (shader handle from b3dLoadEntityShader, positive integer), name (texture parameter name, string matching HLSL texture variable), textureHandle (texture handle from b3dLoadTexture3D, positive integer). Returns nothing. Stores texture handle in shader.textureParams[name] map (persists until changed or shader freed). Use to bind custom textures (color lookup tables, ramp textures, detail maps), provide additional texture inputs (noise textures, gradient maps, mask textures), or override default textures (custom diffuse, normal, emission). Parameter behavior: stored in map (std::map<std::string, int> persists per shader), passed to GPU (texture bound to shader's texture slots during rendering), persists until changed (call again with same name to update, survives across frames), shared by all entities (shader's textures used by all entities referencing this shader, not per-entity). Use cases: (1) Color LUT (tex = b3dLoadTexture3D("lut.png"): b3dSetEntityShaderTexture(shader, "lutTexture", tex) color grading lookup table), (2) Toon ramp (tex = b3dLoadTexture3D("ramp.png"): b3dSetEntityShaderTexture(shader, "rampTexture", tex) toon shading gradient), (3) Detail map (tex = b3dLoadTexture3D("detail.png"): b3dSetEntityShaderTexture(shader, "detailMap", tex) surface detail overlay), (4) Noise texture (tex = b3dLoadTexture3D("noise.png"): b3dSetEntityShaderTexture(shader, "noiseTexture", tex) procedural variation), (5) Emission mask (tex = b3dLoadTexture3D("emission.png"): b3dSetEntityShaderTexture(shader, "emissionMask", tex) glow map). Common patterns: set = texture = b3dLoadTexture3D("file.png"): b3dSetEntityShaderTexture(shader, "texName", texture) load and bind texture. Typical workflow: load shader (shader = b3dLoadEntityShader("toon.hlsl")), load texture (texture = b3dLoadTexture3D("ramp.png")), set texture (this function, bind texture to shader), assign to entity (b3dEntityShader(entity, shader) activate), render (b3dRenderWorld applies shader with custom texture). HLSL shader access: declare texture variable (Texture2D<float4> lutTexture : register(t8); Texture2D<float4> rampTexture : register(t9); note: custom texture slots t8+ to avoid conflicts with entity's default textures t0-t7), declare sampler (SamplerState samplerState : register(s0); use default linear sampler), sample texture (float4 color = lutTexture.Sample(samplerState, uv); float ramp = rampTexture.Sample(samplerState, float2(diffuse, 0.5)).r;), match parameter name (C++ "lutTexture" must match HLSL "lutTexture" exactly, case-sensitive). Common parameter names: "lutTexture" or "colorLUT" (color lookup table for grading), "rampTexture" or "toonRamp" (1D gradient for toon shading), "detailMap" or "detailTexture" (detail/overlay texture), "noiseTexture" or "noiseMap" (noise for procedural effects), "emissionMask" or "glowMap" (emission/glow texture), "matcapTexture" (matcap for stylized reflection), "gradientMap" (gradient texture for effects). Typical texture usage: color LUT (3D LUT cube 32x32x32 or 2D strip 256x16, sample with RGB coordinates), toon ramp (1D gradient 256x1, sample with dot(N,L) diffuse term), detail map (tiling texture, multiply/add with base color), noise texture (Perlin/simplex noise, any size, repeat tiling), emission mask (grayscale or RGB, multiply with emission color). Texture slots: entity default textures use t0-t7 (t0=diffuse, t1=normal, t2=specular, etc, avoid conflicts), custom textures use t8+ (shader assigns register(t8), register(t9), etc for custom textures), example shader declaration (Texture2D<float4> customTex : register(t8); to avoid conflicting with entity's t0-t7 textures). Performance: set cost zero (map insertion/update, trivial CPU operation), texture binding cost minimal (descriptor table upload, GPU reads efficiently), texture sampling cost depends on resolution (small textures <256x256 fast, large textures >2048x2048 slower, mipmap filtering recommended), multiple custom textures OK (limited by descriptor table size, typically 8+ custom textures supported). Validation: ignores if shader <= 0 (invalid handle, silent no-op), ignores if name null (null pointer, early return), ignores if shader not found (not in g_entityShaders map, silent no-op), accepts any texture handle (positive for valid texture, 0 or negative may unbind or cause errors, user responsibility to pass valid texture). No return value: void function (doesn't indicate success/failure), assumes success (texture bound if shader valid, nothing if invalid), silent operation (no error messages, no confirmation prints). Parameter lifetime: persists until changed (call SetEntityShaderTexture again with same name overwrites), survives entity changes (shader textures independent of entity assignments), freed on shader free (b3dFreeEntityShader removes entire shader including all texture references, but textures themselves remain loaded until b3dFreeTexture3D called). Texture lifetime: texture must remain loaded (don't call b3dFreeTexture3D on texture while shader using it, will crash or render black), texture shared OK (multiple shaders can reference same texture handle, efficient reuse), texture loading separate (load texture once, bind to multiple shaders). Related: b3dLoadTexture3D loads texture (creates texture handle bound by this function), b3dFreeTexture3D frees texture (should not free while shader using texture), b3dSetEntityShaderFloat sets shader parameter (float uniform variable), b3dSetEntityShaderInt sets shader parameter (integer uniform variable), b3dSetEntityShaderFloat2/Float3/Float4 set vector parameters (multiple component uniforms), b3dLoadEntityShader loads shader (creates shader configured by this function), b3dEntityShader applies shader to entity (activates shader that uses textures set here).