| 2418 | } |
| 2419 | |
| 2420 | void 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 | } |
nothing calls this directly
no test coverage detected