MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / _setPrimaryLightInfo

Method _setPrimaryLightInfo

Engine/source/materials/processedFFMaterial.cpp:248–287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246}
247
248void ProcessedFFMaterial::_setPrimaryLightInfo(const MatrixF &_objTrans, LightInfo* light, U32 pass)
249{
250 // Just in case
251 GFX->setGlobalAmbientColor(ColorF(0.0f, 0.0f, 0.0f, 1.0f));
252 if ( light->getType() == LightInfo::Ambient )
253 {
254 // Ambient light
255 GFX->setGlobalAmbientColor( light->getAmbient() );
256 return;
257 }
258
259 GFX->setLight(0, NULL);
260 GFX->setLight(1, NULL);
261 // This is a quick hack that lets us use FF lights
262 GFXLightMaterial lightMat;
263 lightMat.ambient = ColorF(1.0f, 1.0f, 1.0f, 1.0f);
264 lightMat.diffuse = ColorF(1.0f, 1.0f, 1.0f, 1.0f);
265 lightMat.emissive = ColorF(0.0f, 0.0f, 0.0f, 0.0f);
266 lightMat.specular = ColorF(0.0f, 0.0f, 0.0f, 0.0f);
267 lightMat.shininess = 128.0f;
268 GFX->setLightMaterial(lightMat);
269
270 // set object transform
271 MatrixF objTrans = _objTrans;
272 objTrans.inverse();
273
274 // fill in primary light
275 //-------------------------
276 GFXLightInfo xlatedLight;
277 light->setGFXLight(&xlatedLight);
278 Point3F lightPos = light->getPosition();
279 Point3F lightDir = light->getDirection();
280 objTrans.mulP(lightPos);
281 objTrans.mulV(lightDir);
282
283 xlatedLight.mPos = lightPos;
284 xlatedLight.mDirection = lightDir;
285
286 GFX->setLight(0, &xlatedLight);
287}
288
289void ProcessedFFMaterial::_setSecondaryLightInfo(const MatrixF &_objTrans, LightInfo* light)
290{

Callers

nothing calls this directly

Calls 12

setGlobalAmbientColorMethod · 0.80
setLightMethod · 0.80
setLightMaterialMethod · 0.80
setGFXLightMethod · 0.80
mulPMethod · 0.80
mulVMethod · 0.80
ColorFFunction · 0.50
getTypeMethod · 0.45
getAmbientMethod · 0.45
inverseMethod · 0.45
getPositionMethod · 0.45
getDirectionMethod · 0.45

Tested by

no test coverage detected