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

Function UpdateLightValues

examples/shaders/rlights.h:150–168  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

148// Send light properties to shader
149// NOTE: Light shader locations should be available
150void UpdateLightValues(Shader shader, Light light)
151{
152 // Send to shader light enabled state and type
153 SetShaderValue(shader, light.enabledLoc, &light.enabled, SHADER_UNIFORM_INT);
154 SetShaderValue(shader, light.typeLoc, &light.type, SHADER_UNIFORM_INT);
155
156 // Send to shader light position values
157 float position[3] = { light.position.x, light.position.y, light.position.z };
158 SetShaderValue(shader, light.positionLoc, position, SHADER_UNIFORM_VEC3);
159
160 // Send to shader light target position values
161 float target[3] = { light.target.x, light.target.y, light.target.z };
162 SetShaderValue(shader, light.targetLoc, target, SHADER_UNIFORM_VEC3);
163
164 // Send to shader light color values
165 float color[4] = { (float)light.color.r/(float)255, (float)light.color.g/(float)255,
166 (float)light.color.b/(float)255, (float)light.color.a/(float)255 };
167 SetShaderValue(shader, light.colorLoc, color, SHADER_UNIFORM_VEC4);
168}
169
170#endif // RLIGHTS_IMPLEMENTATION

Callers 2

mainFunction · 0.85
CreateLightFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected