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

Method setLightMatrices

Engine/source/lighting/common/blobShadow.cpp:146–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144//--------------------------------------------------------------
145
146void BlobShadow::setLightMatrices(const Point3F & lightDir, const Point3F & pos)
147{
148 AssertFatal(mDot(lightDir,lightDir)>0.0001f,"BlobShadow::setLightDir: light direction must be a non-zero vector.");
149
150 // construct light matrix
151 Point3F x,z;
152 if (mFabs(lightDir.z)>0.001f)
153 {
154 // mCross(Point3F(1,0,0),lightDir,&z);
155 z.x = 0.0f;
156 z.y = lightDir.z;
157 z.z = -lightDir.y;
158 z.normalize();
159 mCross(lightDir,z,&x);
160 }
161 else
162 {
163 mCross(lightDir,Point3F(0,0,1),&x);
164 x.normalize();
165 mCross(x,lightDir,&z);
166 }
167
168 mLightToWorld.identity();
169 mLightToWorld.setColumn(0,x);
170 mLightToWorld.setColumn(1,lightDir);
171 mLightToWorld.setColumn(2,z);
172 mLightToWorld.setColumn(3,pos);
173
174 mWorldToLight = mLightToWorld;
175 mWorldToLight.inverse();
176}
177
178void BlobShadow::setRadius(F32 radius)
179{

Callers

nothing calls this directly

Calls 8

mFabsFunction · 0.85
setColumnMethod · 0.80
mDotFunction · 0.50
mCrossFunction · 0.50
Point3FClass · 0.50
normalizeMethod · 0.45
identityMethod · 0.45
inverseMethod · 0.45

Tested by

no test coverage detected