Sets 3-component vector parameter (float3/vec3 uniform) for custom screen shader (RGB color, XYZ position, 3D vectors).
Takes shader (shader handle from b3dLoadScreenShader, positive integer), name (parameter name, string matching HLSL uniform variable), x (first component, float), y (second component, float), z (third component, float).
Returns nothing.
Shaders
Parameters & Returns
Parameters
shaderInt
nameString
xDouble
yDouble
zDouble
Returns
Void
Quick Summary
Sets 3-component vector parameter (float3/vec3 uniform) for custom screen shader (RGB color, XYZ position, 3D vectors).
Takes shader (shader handle from b3dLoadScreenShader, positive integer), name (parameter name, string matching HLSL uniform variable), x (first component, float), y (second component, float), z (third component, float).
Returns nothing.
Technical Exegesis...
Sets 3-component vector parameter (float3/vec3 uniform) for custom screen shader (RGB color, XYZ position, 3D vectors). Takes shader (shader handle from b3dLoadScreenShader, positive integer), name (parameter name, string matching HLSL uniform variable), x (first component, float), y (second component, float), z (third component, float). Returns nothing. Stores components in shader.floatParams map as name.x, name.y, name.z (three separate float entries, persists until changed).
Sets 3-component vector parameter (float3/vec3 uniform) for custom screen shader (RGB color, XYZ position, 3D vectors). Takes shader (shader handle from b3dLoadScreenShader, positive integer), name (parameter name, string matching HLSL uniform variable), x (first component, float), y (second component, float), z (third component, float). Returns nothing. Stores components in shader.floatParams map as name.x, name.y, name.z (three separate float entries, persists until changed). Use to pass RGB colors (tint color, fog color, light color), 3D vectors (camera position, light direction, world offset), or 3D parameters (color correction, chromatic aberration offset, 3D noise seed). Storage behavior: components stored separately (name.x stores x, name.y stores y, name.z stores z in floatParams map), shader reads as float3 (HLSL shader accesses as single vec3, engine packs components automatically), persists until changed (call again with same name to update, survives across frames), independent of apply (set before or after b3dApplyScreenShader, takes effect next frame). Use cases: (1) Tint color (b3dSetShaderFloat3(shader, "tintColor", 1.0, 0.8, 0.6) sepia tint RGB), (2) Camera position (b3dSetShaderFloat3(shader, "cameraPos", camX, camY, camZ) world position for depth effects), (3) Light direction (b3dSetShaderFloat3(shader, "lightDir", 0.0, -1.0, 0.0) directional lighting), (4) Fog color (b3dSetShaderFloat3(shader, "fogColor", 0.5, 0.5, 0.6) atmospheric fog RGB), (5) Chromatic aberration (b3dSetShaderFloat3(shader, "aberration", 0.01, 0.0, -0.01) R/G/B channel offsets). Common patterns: set = b3dSetShaderFloat3(shader, "paramName", x, y, z) configure vector; color = b3dSetShaderFloat3(shader, "color", r/255.0, g/255.0, b/255.0) RGB color normalized 0-1. Typical workflow: load shader (shader = b3dLoadScreenShader("effect.hlsl")), set vector (this function for 3D values), apply shader (b3dApplyScreenShader(shader) activate), render (b3dRenderWorld applies shader, reads vector), update vector (call SetShaderFloat3 again to animate). HLSL shader access: declare uniform (cbuffer ShaderParams { float3 tintColor; float3 cameraPos; float3 lightDir; }), read in pixel shader (finalColor.rgb *= tintColor; float dist = length(worldPos - cameraPos);), match parameter name (C++ "tintColor" must match HLSL "tintColor" exactly, case-sensitive), access components (tintColor.x, tintColor.y, tintColor.z or tintColor.rgb for swizzling). Common parameter names: "tintColor" or "color" (RGB tint multiply, 0.0-1.0 normalized), "fogColor" (atmospheric fog RGB, 0.0-1.0), "cameraPos" or "camPos" (world-space camera XYZ position), "lightDir" (directional light vector, normalized), "aberration" (chromatic aberration RGB offsets, -0.1 to 0.1), "offset" or "position" (world-space XYZ offset for effects), "colorCorrect" (RGB adjustment multipliers, 0.5-2.0 typical). Typical values: RGB color 0.0-1.0 (normalized, 1.0=full intensity, 0.0=none, for tint/fog), RGB color 0-255 divide by 255 (convert from integer RGB to float 0-1), world position actual coordinates (camera/light position in world space, large values OK), direction normalized -1 to 1 (unit vector for light direction, normalize in shader or before passing), chromatic aberration small offsets (0.001-0.02 typical, pixels or UV space), color correction 0.5-2.0 (multipliers for RGB channels, 1.0=unchanged). Performance: set cost zero (three map insertions/updates, trivial CPU operation), parameter read cost zero (constant buffer upload once per frame, GPU reads efficiently), vector packing automatic (engine combines name.x/y/z into float3 for shader), no performance difference vs three SetShaderFloat calls (same storage, just convenience function). Component storage: x component stored as "name.x" key (floatParams["color.x"] = 1.0), y component stored as "name.y" key (floatParams["color.y"] = 0.8), z component stored as "name.z" key (floatParams["color.z"] = 0.6), shader reads combined (HLSL sees float3 color = {1.0, 0.8, 0.6}), can mix with SetShaderFloat (can set "other.w" separately with SetShaderFloat, 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_screenShaders3D 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 SetShaderFloat3 again with same name overwrites all components), survives apply/clear (clearing active shader doesn't erase parameters, reapply uses same values), freed on shader free (b3dFreeScreenShader removes entire shader including all parameters), individual components persist (name.x/y/z stored separately, can overwrite with SetShaderFloat if needed). Multiple shaders: each shader has independent parameters (shader1.floatParams separate from shader2.floatParams), same parameter name OK (different shaders can use "tintColor" with different values), switch shaders instantly (no parameter copying, each shader remembers own values). RGB color conversion: integer RGB to float (r/255.0, g/255.0, b/255.0 for 0-255 -> 0.0-1.0), HDR colors allowed (values > 1.0 for bloom/glow effects, no upper limit), gamma correction shader responsibility (pass linear or sRGB as needed, shader converts if required). Related: b3dSetShaderFloat sets single float (for scalar values, strength, time), b3dSetShaderInt sets integer parameter (for discrete values, flags, indices), b3dSetShaderFloat2 sets 2-component vector (vec2 in HLSL, UV offsets, screen size), b3dSetShaderFloat4 sets 4-component vector (vec4 in HLSL, RGBA color with alpha), b3dLoadScreenShader loads shader (creates shader configured by this function), b3dApplyScreenShader applies shader (activates shader that uses parameters set here).