| 2569 | } |
| 2570 | |
| 2571 | void ShapeBase::_prepRenderImage( SceneRenderState *state, |
| 2572 | bool renderSelf, |
| 2573 | bool renderMountedImages ) |
| 2574 | { |
| 2575 | PROFILE_SCOPE( ShapeBase_PrepRenderImage ); |
| 2576 | |
| 2577 | //if ( mIsCubemapUpdate ) |
| 2578 | // return false; |
| 2579 | |
| 2580 | if( ( getDamageState() == Destroyed ) && ( !mDataBlock->renderWhenDestroyed ) ) |
| 2581 | return; |
| 2582 | |
| 2583 | // We don't need to render if all the meshes are forced hidden. |
| 2584 | if ( mMeshHidden.getSize() > 0 && mMeshHidden.testAll() ) |
| 2585 | return; |
| 2586 | |
| 2587 | // If we're rendering shadows don't render the mounted |
| 2588 | // images unless the shape is also rendered. |
| 2589 | if ( state->isShadowPass() && !renderSelf ) |
| 2590 | return; |
| 2591 | |
| 2592 | // If we're currently rendering our own reflection we |
| 2593 | // don't want to render ourselves into it. |
| 2594 | if ( mCubeReflector.isRendering() ) |
| 2595 | return; |
| 2596 | |
| 2597 | // We force all the shapes to use the highest detail |
| 2598 | // if we're the control object or mounted. |
| 2599 | bool forceHighestDetail = false; |
| 2600 | { |
| 2601 | GameConnection *con = GameConnection::getConnectionToServer(); |
| 2602 | ShapeBase *co = NULL; |
| 2603 | if(con && ( (co = dynamic_cast<ShapeBase*>(con->getControlObject())) != NULL) ) |
| 2604 | { |
| 2605 | if(co == this || co->getObjectMount() == this) |
| 2606 | forceHighestDetail = true; |
| 2607 | } |
| 2608 | } |
| 2609 | |
| 2610 | mLastRenderFrame = sLastRenderFrame; |
| 2611 | |
| 2612 | // get shape detail...we might not even need to be drawn |
| 2613 | Point3F cameraOffset = getWorldBox().getClosestPoint( state->getDiffuseCameraPosition() ) - state->getDiffuseCameraPosition(); |
| 2614 | F32 dist = cameraOffset.len(); |
| 2615 | if (dist < 0.01f) |
| 2616 | dist = 0.01f; |
| 2617 | |
| 2618 | F32 invScale = (1.0f/getMax(getMax(mObjScale.x,mObjScale.y),mObjScale.z)); |
| 2619 | |
| 2620 | if (mShapeInstance) |
| 2621 | { |
| 2622 | if ( forceHighestDetail ) |
| 2623 | mShapeInstance->setCurrentDetail( 0 ); |
| 2624 | else |
| 2625 | mShapeInstance->setDetailFromDistance( state, dist * invScale ); |
| 2626 | |
| 2627 | mShapeInstance->animate(); |
| 2628 | } |
nothing calls this directly
no test coverage detected