Sets 3-component vector parameter (float3/vec3 uniform) for entity shader (RGB colors, 3D positions, normals).
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), 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 entity shader (RGB colors, 3D positions, normals).
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), z (third component, float).
Returns nothing.
Technical Exegesis...
Sets 3-component vector parameter (float3/vec3 uniform) for entity shader (RGB colors, 3D positions, normals). 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), 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 entity shader (RGB colors, 3D positions, normals). 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), 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, rim color, outline color), 3D vectors (light direction, wind direction, camera offset), or 3D parameters (color correction, emission, 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), shared by all entities (shader's parameters used by all entities referencing this shader, not per-entity). Use cases: (1) Tint color (b3dSetEntityShaderFloat3(shader, "tintColor", 1.0, 0.5, 0.2) orange tint RGB), (2) Rim color (b3dSetEntityShaderFloat3(shader, "rimColor", 0.0, 1.0, 1.0) cyan rim lighting), (3) Outline color (b3dSetEntityShaderFloat3(shader, "outlineColor", 0.0, 0.0, 0.0) black outline), (4) Light direction (b3dSetEntityShaderFloat3(shader, "customLightDir", 0.0, -1.0, 0.0) directional lighting), (5) Emission (b3dSetEntityShaderFloat3(shader, "emissive", 0.5, 0.5, 1.0) blue glow). Common patterns: set = b3dSetEntityShaderFloat3(shader, "paramName", x, y, z) configure vector; color = b3dSetEntityShaderFloat3(shader, "color", r/255.0, g/255.0, b/255.0) RGB normalized 0-1. Typical workflow: load shader (shader = b3dLoadEntityShader("toon.hlsl")), set vector (this function for 3D values), assign to entity (b3dEntityShader(entity, shader) activate), render (b3dRenderWorld applies shader with parameters), update vector (call SetEntityShaderFloat3 again to animate). HLSL shader access: declare in CustomShaderParams cbuffer (cbuffer CustomShaderParams : register(b3) { float3 tintColor; float3 rimColor; float3 customLightDir; }), read in pixel shader (finalColor.rgb *= tintColor; float rimFactor = pow(1.0 - dot(normal, viewDir), rimPower); finalColor.rgb += rimColor * rimFactor;), 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), "rimColor" (rim lighting RGB, 0.0-1.0), "outlineColor" (silhouette edge RGB, 0.0-1.0), "emissive" or "emissionColor" (self-illumination RGB, 0.0-1.0 or higher for glow), "customLightDir" or "lightDirection" (directional light vector, normalized), "windDirection" (wind vector for vegetation), "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/rim/outline), RGB color 0-255 divide by 255 (convert from integer RGB to float 0-1), emissive >1.0 allowed (HDR bloom/glow effects), light direction normalized -1 to 1 (unit vector, normalize in shader or before passing), wind direction world-space (any values, magnitude affects strength), 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 entity draw, GPU reads efficiently), vector packing automatic (engine combines name.x/y/z into float3 for shader), no performance difference vs three SetEntityShaderFloat calls (same storage, just convenience function). Component storage: x component stored as "name.x" key (floatParams["tintColor.x"] = 1.0), y component stored as "name.y" key (floatParams["tintColor.y"] = 0.5), z component stored as "name.z" key (floatParams["tintColor.z"] = 0.2), shader reads combined (HLSL sees float3 tintColor = {1.0, 0.5, 0.2}), can mix with SetEntityShaderFloat (can set "other.w" 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 SetEntityShaderFloat3 again with same name overwrites all 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/y/z stored separately, can overwrite with SetEntityShaderFloat if needed). 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: b3dSetEntityShaderFloat sets single float (for scalar values, intensity, time), b3dSetEntityShaderInt sets integer parameter (for discrete values, flags), b3dSetEntityShaderFloat2 sets 2-component vector (vec2 in HLSL, UV offsets), b3dSetEntityShaderFloat4 sets 4-component vector (vec4 in HLSL, RGBA colors with alpha), 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).