MCPcopy Create free account
hub / github.com/RobLoach/raylib-cpp / UpdateLight

Function UpdateLight

examples/shaders/shaders_basic_pbr.cpp:319–333  ·  view source on GitHub ↗

Send light properties to shader NOTE: Light shader locations should be available

Source from the content-addressed store, hash-verified

317// Send light properties to shader
318// NOTE: Light shader locations should be available
319static void UpdateLight(Shader shader, const Light& light)
320{
321 SetShaderValue(shader, light.enabledLoc, &light.enabled, SHADER_UNIFORM_INT);
322 SetShaderValue(shader, light.typeLoc, &light.type, SHADER_UNIFORM_INT);
323
324 // Send to shader light position values
325 std::array<float, 3> position = { light.position.x, light.position.y, light.position.z };
326 SetShaderValue(shader, light.positionLoc, position.data(), SHADER_UNIFORM_VEC3);
327
328 // Send to shader light target position values
329 std::array<float, 3> target = { light.target.x, light.target.y, light.target.z };
330 SetShaderValue(shader, light.targetLoc, target.data(), SHADER_UNIFORM_VEC3);
331 SetShaderValue(shader, light.colorLoc, light.color.data(), SHADER_UNIFORM_VEC4);
332 SetShaderValue(shader, light.intensityLoc, &light.intensity, SHADER_UNIFORM_FLOAT);
333}

Callers 2

mainFunction · 0.85
CreateLightFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected