| 303 | } |
| 304 | |
| 305 | void LightManager::_update4LightConsts( const SceneData &sgData, |
| 306 | GFXShaderConstHandle *lightPositionSC, |
| 307 | GFXShaderConstHandle *lightDiffuseSC, |
| 308 | GFXShaderConstHandle *lightAmbientSC, |
| 309 | GFXShaderConstHandle *lightConfigDataSC, |
| 310 | GFXShaderConstHandle *lightSpotDirSC, |
| 311 | GFXShaderConstHandle *lightSpotParamsSC, |
| 312 | GFXShaderConstHandle* hasVectorLightSC, |
| 313 | GFXShaderConstHandle* vectorLightDirectionSC, |
| 314 | GFXShaderConstHandle* vectorLightColorSC, |
| 315 | GFXShaderConstHandle* vectorLightBrightnessSC, |
| 316 | GFXShaderConstBuffer *shaderConsts ) |
| 317 | { |
| 318 | PROFILE_SCOPE( LightManager_Update4LightConsts ); |
| 319 | |
| 320 | // Skip over gathering lights if we don't have to! |
| 321 | if ( lightPositionSC->isValid() || |
| 322 | lightDiffuseSC->isValid() || |
| 323 | lightConfigDataSC->isValid() || |
| 324 | lightSpotDirSC->isValid() || |
| 325 | lightSpotParamsSC->isValid() ) |
| 326 | { |
| 327 | PROFILE_SCOPE( LightManager_Update4LightConsts_setLights ); |
| 328 | |
| 329 | //new setup |
| 330 | const U32 MAX_FORWARD_LIGHTS = 4; |
| 331 | |
| 332 | static AlignedArray<Point4F> lightPositions(MAX_FORWARD_LIGHTS, sizeof(Point4F)); |
| 333 | static AlignedArray<Point4F> lightSpotDirs(MAX_FORWARD_LIGHTS, sizeof(Point4F)); |
| 334 | static AlignedArray<Point4F> lightColors(MAX_FORWARD_LIGHTS, sizeof(Point4F)); |
| 335 | static AlignedArray<Point4F> lightConfigData(MAX_FORWARD_LIGHTS, sizeof(Point4F)); //type, brightness, range, invSqrRange : rgba |
| 336 | static AlignedArray<Point2F> lightSpotParams(MAX_FORWARD_LIGHTS, sizeof(Point2F)); |
| 337 | |
| 338 | dMemset(lightPositions.getBuffer(), 0, lightPositions.getBufferSize()); |
| 339 | dMemset(lightSpotDirs.getBuffer(), 0, lightSpotDirs.getBufferSize()); |
| 340 | dMemset(lightColors.getBuffer(), 0, lightColors.getBufferSize()); |
| 341 | dMemset(lightConfigData.getBuffer(), 0, lightConfigData.getBufferSize()); |
| 342 | dMemset(lightSpotParams.getBuffer(), 0, lightSpotParams.getBufferSize()); |
| 343 | |
| 344 | //sun-only |
| 345 | F32 vectorLightBrightness; |
| 346 | static Point4F vectorLightDirection; |
| 347 | static Point4F vectorLightColor; |
| 348 | static Point4F vectorLightAmbientColor; |
| 349 | int hasVectorLight = 0; |
| 350 | |
| 351 | vectorLightBrightness = 0; |
| 352 | vectorLightDirection = Point4F::Zero; |
| 353 | vectorLightColor = Point4F::Zero; |
| 354 | vectorLightAmbientColor = Point4F::Zero; |
| 355 | |
| 356 | // Gather the data for the first 4 lights. |
| 357 | const LightInfo* light; |
| 358 | for (U32 i = 0; i < MAX_FORWARD_LIGHTS; i++) |
| 359 | { |
| 360 | light = sgData.lights[i]; |
| 361 | if (!light) |
| 362 | break; |
nothing calls this directly
no test coverage detected