Sets float parameter (uniform variable) for entity shader (configures CustomShaderParams cbuffer).
Takes shader (shader handle from b3dLoadEntityShader, positive integer), name (parameter name, string matching HLSL CustomShaderParams cbuffer field), value (float value, will be passed to shader constant buffer).
Returns nothing.
Shaders
Parameters & Returns
Parameters
shaderInt
nameString
valueDouble
Returns
Void
Quick Summary
Sets float parameter (uniform variable) for entity shader (configures CustomShaderParams cbuffer).
Takes shader (shader handle from b3dLoadEntityShader, positive integer), name (parameter name, string matching HLSL CustomShaderParams cbuffer field), value (float value, will be passed to shader constant buffer).
Returns nothing.
Technical Exegesis...
Sets float parameter (uniform variable) for entity shader (configures CustomShaderParams cbuffer). Takes shader (shader handle from b3dLoadEntityShader, positive integer), name (parameter name, string matching HLSL CustomShaderParams cbuffer field), value (float value, will be passed to shader constant buffer). Returns nothing. Stores value in shader.floatParams[name] map (persists until changed or shader freed).
Sets float parameter (uniform variable) for entity shader (configures CustomShaderParams cbuffer). Takes shader (shader handle from b3dLoadEntityShader, positive integer), name (parameter name, string matching HLSL CustomShaderParams cbuffer field), value (float value, will be passed to shader constant buffer). Returns nothing. Stores value in shader.floatParams[name] map (persists until changed or shader freed). Use to configure shader material properties (metalness, roughness, intensity), control shader effects (outline thickness, rim lighting strength), or pass time/animation values (scroll speed, pulse rate). Parameter behavior: stored in map (std::map<std::string, float> persists per shader), passed to GPU (shader reads via CustomShaderParams cbuffer register(b3) during rendering), persists until changed (call again with same name to update, survives across frames), shared by all entities (shader's parameters used by all entities referencing this shader, not per-entity). Use cases: (1) Toon shader bands (b3dSetEntityShaderFloat(shader, "bandCount", 4.0) discrete color levels), (2) Outline thickness (b3dSetEntityShaderFloat(shader, "outlineWidth", 0.05) edge detection width), (3) Material properties (b3dSetEntityShaderFloat(shader, "roughness", 0.7) surface roughness), (4) Animation time (b3dSetEntityShaderFloat(shader, "time", MilliSecs()/1000.0) scrolling/pulsing effects), (5) Effect intensity (b3dSetEntityShaderFloat(shader, "glowIntensity", 1.5) holographic glow). Common patterns: set = b3dSetEntityShaderFloat(shader, "paramName", value) configure parameter; animate = b3dSetEntityShaderFloat(shader, "time", MilliSecs()/1000.0) each frame for animation. Typical workflow: load shader (shader = b3dLoadEntityShader("toon.hlsl")), set parameters (this function multiple times for different uniforms), assign to entity (b3dEntityShader(entity, shader) activate), render (b3dRenderWorld applies shader with parameters), update parameters (call SetEntityShaderFloat again to animate, all entities using shader affected). HLSL shader access: declare in CustomShaderParams cbuffer (cbuffer CustomShaderParams : register(b3) { float bandCount; float outlineWidth; float time; }), read in pixel shader (float band = floor(diffuse * bandCount) / bandCount; for toon shading), match parameter name (C++ "bandCount" must match HLSL "bandCount" exactly, case-sensitive). Common parameter names: "bandCount" (toon shader color bands, 3-10 typical), "outlineWidth" (edge detection thickness, 0.01-0.1 pixels), "rimPower" (rim lighting falloff, 1.0-5.0), "roughness" (surface roughness 0.0-1.0), "metalness" (metallic property 0.0-1.0), "time" (animation time seconds or milliseconds), "intensity" or "strength" (effect multiplier 0.0-2.0), "scrollSpeed" (texture scroll rate). Typical values: bandCount 3-10 (toon shader levels, low=stylized, high=smooth), outlineWidth 0.01-0.1 (edge pixels, depends on resolution and desired thickness), rim/glow intensity 0.0-5.0 (0=none, 1=normal, >1=strong effect), roughness/metalness 0.0-1.0 (PBR properties, 0=smooth/nonmetal, 1=rough/metal), time continuously increasing (MilliSecs()/1000.0 for seconds, wrap at large values), scrollSpeed -10 to 10 (UV offset per second, negative=reverse). Performance: set cost zero (map insertion/update, trivial CPU operation), parameter read cost zero (constant buffer upload once per entity draw, GPU reads efficiently), many parameters OK (dozens of floats no problem, cbuffer has 64KB limit but practically unlimited for typical use), shared parameters (all entities using shader read same values, efficient). 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 value (no range validation, user responsible for sensible values). No return value: void function (doesn't indicate success/failure), assumes success (parameter set if shader valid, nothing if invalid), silent operation (no error messages, no confirmation prints). Parameter lifetime: persists until changed (call SetEntityShaderFloat again with same name overwrites), survives entity changes (shader parameters independent of entity assignments, changing entities doesn't reset parameters), freed on shader free (b3dFreeEntityShader removes entire shader including all parameters). Shader sharing: parameters shared by all entities (multiple entities using same shader see same parameter values, not per-entity customization), workaround for per-entity (load multiple shader instances with different parameters, or use entity properties like b3dEntityColor), efficient for common materials (single toon shader with same bandCount for all toon-shaded entities). Related: b3dSetEntityShaderInt sets integer parameter (for discrete values, flags, mode selection), b3dSetEntityShaderFloat2 sets 2-component vector (vec2 in HLSL, UV offsets, 2D values), b3dSetEntityShaderFloat3 sets 3-component vector (vec3 in HLSL, RGB colors, 3D values), b3dSetEntityShaderFloat4 sets 4-component vector (vec4 in HLSL, RGBA colors, full vectors), b3dSetEntityShaderTexture sets shader texture (custom texture binding), b3dLoadEntityShader loads shader (creates shader configured by this function), b3dEntityShader applies shader to entity (activates shader that uses parameters set here).