Sets 2-component vector parameter (float2/vec2 uniform) for entity shader (UV offsets, 2D values).
Takes shader (shader handle from b3dLoadEntityShader, positive integer), name (parameter name, string matching HLSL CustomShaderParams cbuffer field), x (first component, float), y (second component, float).
Returns nothing.
Shaders
Parameters & Returns
Parameters
shaderInt
nameString
xDouble
yDouble
Returns
Void
Quick Summary
Sets 2-component vector parameter (float2/vec2 uniform) for entity shader (UV offsets, 2D values).
Takes shader (shader handle from b3dLoadEntityShader, positive integer), name (parameter name, string matching HLSL CustomShaderParams cbuffer field), x (first component, float), y (second component, float).
Returns nothing.
Technical Exegesis...
Sets 2-component vector parameter (float2/vec2 uniform) for entity shader (UV offsets, 2D values). Takes shader (shader handle from b3dLoadEntityShader, positive integer), name (parameter name, string matching HLSL CustomShaderParams cbuffer field), x (first component, float), y (second component, float). Returns nothing. Stores components in shader.floatParams map as name.x and name.y (two separate float entries, persists until changed).
Sets 2-component vector parameter (float2/vec2 uniform) for entity shader (UV offsets, 2D values). Takes shader (shader handle from b3dLoadEntityShader, positive integer), name (parameter name, string matching HLSL CustomShaderParams cbuffer field), x (first component, float), y (second component, float). Returns nothing. Stores components in shader.floatParams map as name.x and name.y (two separate float entries, persists until changed). Use to pass 2D vectors (UV scroll offsets, texture scale, 2D noise seeds), configure 2D effects (outline direction, rim fade range), or control 2D parameters (size/thickness, min/max ranges). Storage behavior: components stored separately (name.x stores x value, name.y stores y value in floatParams map), shader reads as float2 (HLSL shader accesses as single vec2, engine packs components automatically), 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) UV scroll (b3dSetEntityShaderFloat2(shader, "uvOffset", scrollX, scrollY) animate texture coordinates), (2) Texture scale (b3dSetEntityShaderFloat2(shader, "uvScale", 2.0, 2.0) repeat texture), (3) Outline direction (b3dSetEntityShaderFloat2(shader, "outlineDir", 1.0, 0.0) directional outline), (4) Fade range (b3dSetEntityShaderFloat2(shader, "fadeRange", 10.0, 50.0) min/max distance for fade), (5) Noise seed (b3dSetEntityShaderFloat2(shader, "noiseSeed", seedX, seedY) procedural variation). Common patterns: set = b3dSetEntityShaderFloat2(shader, "paramName", x, y) configure vector; animate = b3dSetEntityShaderFloat2(shader, "uvOffset", Sin(time), Cos(time)) circular scroll. Typical workflow: load shader (shader = b3dLoadEntityShader("effect.hlsl")), set vector (this function for 2D values), assign to entity (b3dEntityShader(entity, shader) activate), render (b3dRenderWorld applies shader with parameters), update vector (call SetEntityShaderFloat2 again to animate). HLSL shader access: declare in CustomShaderParams cbuffer (cbuffer CustomShaderParams : register(b3) { float2 uvOffset; float2 uvScale; float2 fadeRange; }), read in pixel shader (float2 uv = input.texcoord * uvScale + uvOffset; float fadeFactor = saturate((dist - fadeRange.x) / (fadeRange.y - fadeRange.x));), match parameter name (C++ "uvOffset" must match HLSL "uvOffset" exactly, case-sensitive), access components (uvOffset.x, uvOffset.y or uvOffset.xy for swizzling). Common parameter names: "uvOffset" (texture coordinate offset for scrolling), "uvScale" (texture repeat scale, multiply UVs), "fadeRange" (min/max distance for effects, x=start y=end), "noiseScale" or "noiseSeed" (procedural noise parameters), "outlineOffset" or "outlineDir" (outline direction vector), "sizeRange" or "thicknessRange" (min/max for variable properties). Typical values: uvOffset 0.0-1.0 for scroll (wrap with fmod or frac in shader), uvScale (1.0=normal, 2.0=double size, 0.5=half size), fade range distance units (10.0, 50.0 for 10-50 units fade), noise seed arbitrary (any values, affects procedural variation), outline direction normalized or pixels (depends on shader implementation). Performance: set cost zero (two map insertions/updates, trivial CPU operation), parameter read cost zero (constant buffer upload once per entity draw, GPU reads efficiently), vector packing automatic (engine combines name.x and name.y into float2 for shader), no performance difference vs two SetEntityShaderFloat calls (same storage, just convenience function). Component storage: x component stored as "name.x" key (floatParams["uvOffset.x"] = scrollX), y component stored as "name.y" key (floatParams["uvOffset.y"] = scrollY), shader reads combined (HLSL sees float2 uvOffset = {scrollX, scrollY}), can mix with SetEntityShaderFloat (can set "other.z" separately with SetEntityShaderFloat, components independent). 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 values (no range validation, user responsible for sensible values). No return value: void function (doesn't indicate success/failure), assumes success (parameters set if shader valid, nothing if invalid), silent operation (no error messages, no confirmation prints). Parameter lifetime: persists until changed (call SetEntityShaderFloat2 again with same name overwrites both components), survives entity changes (shader parameters independent of entity assignments), freed on shader free (b3dFreeEntityShader removes entire shader including all parameters), individual components persist (name.x and name.y stored separately, can overwrite with SetEntityShaderFloat if needed). Related: b3dSetEntityShaderFloat sets single float (for scalar values, intensity, time), b3dSetEntityShaderInt sets integer parameter (for discrete values, flags), b3dSetEntityShaderFloat3 sets 3-component vector (vec3 in HLSL, RGB colors), b3dSetEntityShaderFloat4 sets 4-component vector (vec4 in HLSL, RGBA colors), 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).