Sets 2-component vector uniform in image shader (stored as name.x/name.y in floatParams, uploaded to GPU during rendering).
Takes shader (shader handle), name (uniform base name, string), x (first component, double converted to float), y (second component, double converted to float).
Returns nothing.
Shaders
Parameters & Returns
Parameters
shaderInt
nameString
xDouble
yDouble
Returns
Void
Quick Summary
Sets 2-component vector uniform in image shader (stored as name.x/name.y in floatParams, uploaded to GPU during rendering).
Takes shader (shader handle), name (uniform base name, string), x (first component, double converted to float), y (second component, double converted to float).
Returns nothing.
Technical Exegesis...
Sets 2-component vector uniform in image shader (stored as name.x/name.y in floatParams, uploaded to GPU during rendering). Takes shader (shader handle), name (uniform base name, string), x (first component, double converted to float), y (second component, double converted to float). Returns nothing. Stores as two separate float entries (shader.floatParams[name+".x"]=x, shader.floatParams[name+".y"]=y), uploaded to constant buffer during draw (packed into cbuffer, sent to GPU with draw command).
Sets 2-component vector uniform in image shader (stored as name.x/name.y in floatParams, uploaded to GPU during rendering). Takes shader (shader handle), name (uniform base name, string), x (first component, double converted to float), y (second component, double converted to float). Returns nothing. Stores as two separate float entries (shader.floatParams[name+".x"]=x, shader.floatParams[name+".y"]=y), uploaded to constant buffer during draw (packed into cbuffer, sent to GPU with draw command). Use for 2D coordinates (offset position, UV scrolling), 2D scaling (separate X/Y scale factors), direction vectors (2D movement direction), or paired values (min/max range, width/height). Parameter storage: CPU map (two entries name.x and name.y in floatParams), uploaded on use (when image with this shader drawn, params packed to cbuffer), persistent (remains until changed, survives across frames). Use cases: (1) UV scroll (b2dSetImageShaderFloat2(shader,"uvOffset",scrollX,scrollY) texture animation), (2) Scale factor (b2dSetImageShaderFloat2(distortShader,"scale",scaleX,scaleY) non-uniform distortion), (3) Screen resolution (b2dSetImageShaderFloat2(shader,"resolution",width,height) for normalized coordinates), (4) Direction vector (b2dSetImageShaderFloat2(motionShader,"direction",dx,dy) motion blur direction). HLSL access: declare uniform (float2 uvOffset; in shader OR separate float uvOffset_x; float uvOffset_y;), use in shader (uv += uvOffset; OR uv.x += uvOffset_x; uv.y += uvOffset_y;), component access (uvOffset.x and uvOffset.y if using float2). Storage format: decomposed to components (single float2 parameter stored as two separate float entries name.x and name.y), shader receives as components (HLSL must access as separate floats or reconstruct float2). Performance: cost zero (two map inserts/updates, no GPU operation until draw), batched upload (all parameters uploaded together during draw ~0.001ms). Validation: ignores if shader<=0, ignores if name null, silently ignored if not found in shader (HLSL doesn't need to use all set parameters). Related: b2dSetImageShaderFloat (single float), b2dSetImageShaderFloat3/4 (3/4-component vectors), b2dSetImageShaderInt (integer parameters), b2dLoadImageShader (creates shader), b2dDrawImageEx (draws with shader).