Create a light and get shader locations
| 119 | |
| 120 | // Create a light and get shader locations |
| 121 | Light CreateLight(int type, Vector3 position, Vector3 target, Color color, Shader shader) |
| 122 | { |
| 123 | Light light = { 0 }; |
| 124 | |
| 125 | if (lightsCount < MAX_LIGHTS) |
| 126 | { |
| 127 | light.enabled = true; |
| 128 | light.type = type; |
| 129 | light.position = position; |
| 130 | light.target = target; |
| 131 | light.color = color; |
| 132 | |
| 133 | // NOTE: Lighting shader naming must be the provided ones |
| 134 | light.enabledLoc = GetShaderLocation(shader, TextFormat("lights[%i].enabled", lightsCount)); |
| 135 | light.typeLoc = GetShaderLocation(shader, TextFormat("lights[%i].type", lightsCount)); |
| 136 | light.positionLoc = GetShaderLocation(shader, TextFormat("lights[%i].position", lightsCount)); |
| 137 | light.targetLoc = GetShaderLocation(shader, TextFormat("lights[%i].target", lightsCount)); |
| 138 | light.colorLoc = GetShaderLocation(shader, TextFormat("lights[%i].color", lightsCount)); |
| 139 | |
| 140 | UpdateLightValues(shader, light); |
| 141 | |
| 142 | lightsCount++; |
| 143 | } |
| 144 | |
| 145 | return light; |
| 146 | } |
| 147 | |
| 148 | // Send light properties to shader |
| 149 | // NOTE: Light shader locations should be available |
no test coverage detected