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

Method calcScore

Engine/source/scene/reflector.cpp:202–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

200}
201
202F32 ReflectorBase::calcScore( const ReflectParams &params )
203{
204 PROFILE_SCOPE( ReflectorBase_calcScore );
205
206 // First check the occlusion query to see if we're hidden.
207 if ( mDesc->useOcclusionQuery &&
208 mOcclusionQuery )
209 {
210 GFXOcclusionQuery::OcclusionQueryStatus status = mOcclusionQuery->getStatus( false );
211
212 if ( status == GFXOcclusionQuery::Waiting )
213 {
214 mQueryPending = true;
215 // Don't change mOccluded since we don't know yet, use the value
216 // from last frame.
217 }
218 else
219 {
220 mQueryPending = false;
221
222 if ( status == GFXOcclusionQuery::Occluded )
223 mOccluded = true;
224 else if ( status == GFXOcclusionQuery::NotOccluded )
225 mOccluded = false;
226 }
227 }
228
229 // If we're disabled for any reason then there
230 // is nothing more left to do.
231 if ( !mEnabled ||
232 mOccluded ||
233 params.culler.isCulled( mObject->getWorldBox() ) )
234 {
235 score = 0;
236 return score;
237 }
238
239 // This mess is calculating a score based on LOD.
240
241 /*
242 F32 sizeWS = getMax( object->getWorldBox().len_z(), 0.001f );
243 Point3F cameraOffset = params.culler.getPosition() - object->getPosition();
244 F32 dist = getMax( cameraOffset.len(), 0.01f );
245 F32 worldToScreenScaleY = ( params.culler.getNearDist() * params.viewportExtent.y ) /
246 ( params.culler.getNearTop() - params.culler.getNearBottom() );
247 F32 sizeSS = sizeWS / dist * worldToScreenScaleY;
248 */
249
250 if ( mDesc->priority == -1.0f )
251 {
252 score = 1000.0f;
253 return score;
254 }
255
256 F32 lodFactor = 1.0f; //sizeSS;
257
258 F32 maxRate = getMax( (F32)mDesc->maxRateMs, 1.0f );
259 U32 delta = params.startOfUpdateMs - lastUpdateMs;

Callers 1

updateMethod · 0.80

Calls 10

getMaxFunction · 0.85
calcFaceScoreMethod · 0.80
mDotFunction · 0.50
getStatusMethod · 0.45
isCulledMethod · 0.45
getWorldBoxMethod · 0.45
isOccludedMethod · 0.45
getForwardVectorMethod · 0.45
getPositionMethod · 0.45
lenSquaredMethod · 0.45

Tested by

no test coverage detected