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

Method _prepRenderImage

Engine/source/T3D/shapeBase.cpp:2420–2533  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2418}
2419
2420void ShapeBase::_prepRenderImage( SceneRenderState *state,
2421 bool renderSelf,
2422 bool renderMountedImages )
2423{
2424 PROFILE_SCOPE( ShapeBase_PrepRenderImage );
2425
2426 //if ( mIsCubemapUpdate )
2427 // return false;
2428
2429 if( ( getDamageState() == Destroyed ) && ( !mDataBlock->renderWhenDestroyed ) )
2430 return;
2431
2432 // We don't need to render if all the meshes are forced hidden.
2433 if ( mMeshHidden.getSize() > 0 && mMeshHidden.testAll() )
2434 return;
2435
2436 // If we're rendering shadows don't render the mounted
2437 // images unless the shape is also rendered.
2438 if ( state->isShadowPass() && !renderSelf )
2439 return;
2440
2441 // If we're currently rendering our own reflection we
2442 // don't want to render ourselves into it.
2443 if ( mCubeReflector.isRendering() )
2444 return;
2445
2446 // We force all the shapes to use the highest detail
2447 // if we're the control object or mounted.
2448 bool forceHighestDetail = false;
2449 {
2450 GameConnection *con = GameConnection::getConnectionToServer();
2451 ShapeBase *co = NULL;
2452 if(con && ( (co = dynamic_cast<ShapeBase*>(con->getControlObject())) != NULL) )
2453 {
2454 if(co == this || co->getObjectMount() == this)
2455 forceHighestDetail = true;
2456 }
2457 }
2458
2459 mLastRenderFrame = sLastRenderFrame;
2460
2461 // get shape detail...we might not even need to be drawn
2462 Point3F cameraOffset = getWorldBox().getClosestPoint( state->getDiffuseCameraPosition() ) - state->getDiffuseCameraPosition();
2463 F32 dist = cameraOffset.len();
2464 if (dist < 0.01f)
2465 dist = 0.01f;
2466
2467 F32 invScale = (1.0f/getMax(getMax(mObjScale.x,mObjScale.y),mObjScale.z));
2468
2469 if (mShapeInstance)
2470 {
2471 if ( forceHighestDetail )
2472 mShapeInstance->setCurrentDetail( 0 );
2473 else
2474 mShapeInstance->setDetailFromDistance( state, dist * invScale );
2475
2476 mShapeInstance->animate();
2477 }

Callers

nothing calls this directly

Calls 15

getMaxFunction · 0.85
mIsZeroFunction · 0.85
isShadowPassMethod · 0.80
isRenderingMethod · 0.80
getObjectMountMethod · 0.80
getClosestPointMethod · 0.80
setDetailFromDistanceMethod · 0.80
getCurrentDetailMethod · 0.80
getSizeMethod · 0.45
testAllMethod · 0.45
getControlObjectMethod · 0.45

Tested by

no test coverage detected