MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / light

Method light

Engine/source/lighting/basic/blTerrainSystem.cpp:228–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226}
227
228void blTerrainProxy::light(LightInfo * light)
229{
230 // If we don't have terrain or its not a directional
231 // light then skip processing.
232 TerrainBlock * terrain = getObject();
233 if ( !terrain || light->getType() != LightInfo::Vector )
234 return;
235
236 S32 time = Platform::getRealMilliseconds();
237
238 // reset
239 mShadowVolume = new ShadowVolumeBSP;
240
241 // build interior shadow volume
242 for(ObjectProxy ** itr = gLighting->mLitObjects.begin(); itr != gLighting->mLitObjects.end(); itr++)
243 {
244 ObjectProxy* objproxy = *itr;
245 if (markObjectShadow(objproxy))
246 objproxy->addToShadowVolume(mShadowVolume, light, SceneLighting::SHADOW_DETAIL);
247 }
248
249 lightVector(light);
250
251 // set the lightmap...
252 terrain->clearLightMap();
253
254 // Blur...
255 F32 kernel[3][3] = { {1, 2, 1},
256 {2, 3, 2},
257 {1, 2, 1} };
258
259 F32 modifier = 1;
260 F32 divisor = 0;
261
262
263 for( U32 i=0; i<3; i++ )
264 {
265 for( U32 j=0; j<3; j++ )
266 {
267 if( i==1 && j==1 )
268 {
269 kernel[i][j] = 1 + kernel[i][j] * modifier;
270 }
271 else
272 {
273 kernel[i][j] = kernel[i][j] * modifier;
274 }
275
276 divisor += kernel[i][j];
277 }
278 }
279
280 for( U32 i=0; i < mLightMapSize; i++ )
281 {
282 for( U32 j=0; j < mLightMapSize; j++ )
283 {
284
285 LinearColorF val;

Callers

nothing calls this directly

Calls 8

printfFunction · 0.85
addToShadowVolumeMethod · 0.80
clearLightMapMethod · 0.80
getLightMapMethod · 0.80
getTypeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
setColorMethod · 0.45

Tested by

no test coverage detected