| 964 | } |
| 965 | |
| 966 | void Debris::prepRenderImage( SceneRenderState *state ) |
| 967 | { |
| 968 | if( !mPart && !mShape ) |
| 969 | return; |
| 970 | |
| 971 | Point3F cameraOffset; |
| 972 | mObjToWorld.getColumn(3,&cameraOffset); |
| 973 | cameraOffset -= state->getDiffuseCameraPosition(); |
| 974 | F32 dist = cameraOffset.len(); |
| 975 | F32 invScale = (1.0f/getMax(getMax(mObjScale.x,mObjScale.y),mObjScale.z)); |
| 976 | |
| 977 | if( mShape ) |
| 978 | { |
| 979 | mShape->setDetailFromDistance( state, dist * invScale ); |
| 980 | if( mShape->getCurrentDetail() < 0 ) |
| 981 | return; |
| 982 | } |
| 983 | |
| 984 | if( mPart ) |
| 985 | { |
| 986 | // get the shapeInstance that we are using for the debris parts |
| 987 | TSShapeInstance *si = mPart->getSourceShapeInstance(); |
| 988 | if ( si ) |
| 989 | si->setDetailFromDistance( state, dist * invScale ); |
| 990 | } |
| 991 | |
| 992 | prepBatchRender( state ); |
| 993 | } |
| 994 | |
| 995 | void Debris::prepBatchRender( SceneRenderState *state ) |
| 996 | { |
nothing calls this directly
no test coverage detected