| 491 | } |
| 492 | |
| 493 | void ConvexShape::prepRenderImage( SceneRenderState *state ) |
| 494 | { |
| 495 | /* |
| 496 | if ( state->isDiffusePass() ) |
| 497 | { |
| 498 | ObjectRenderInst *ri2 = state->getRenderPass()->allocInst<ObjectRenderInst>(); |
| 499 | ri2->renderDelegate.bind( this, &ConvexShape::_renderDebug ); |
| 500 | ri2->type = RenderPassManager::RIT_Editor; |
| 501 | state->getRenderPass()->addInst( ri2 ); |
| 502 | } |
| 503 | */ |
| 504 | |
| 505 | if ( mVertexBuffer.isNull() || !state) |
| 506 | return; |
| 507 | |
| 508 | // If we don't have a material instance after the override then |
| 509 | // we can skip rendering all together. |
| 510 | BaseMatInstance *matInst = state->getOverrideMaterial( mMaterialInst ? mMaterialInst : MATMGR->getWarningMatInstance() ); |
| 511 | if ( !matInst ) |
| 512 | return; |
| 513 | |
| 514 | // Get a handy pointer to our RenderPassmanager |
| 515 | RenderPassManager *renderPass = state->getRenderPass(); |
| 516 | |
| 517 | // Allocate an MeshRenderInst so that we can submit it to the RenderPassManager |
| 518 | MeshRenderInst *ri = renderPass->allocInst<MeshRenderInst>(); |
| 519 | |
| 520 | // Set our RenderInst as a standard mesh render |
| 521 | ri->type = RenderPassManager::RIT_Mesh; |
| 522 | |
| 523 | // Calculate our sorting point |
| 524 | if ( state ) |
| 525 | { |
| 526 | // Calculate our sort point manually. |
| 527 | const Box3F& rBox = getRenderWorldBox(); |
| 528 | ri->sortDistSq = rBox.getSqDistanceToPoint( state->getCameraPosition() ); |
| 529 | } |
| 530 | else |
| 531 | ri->sortDistSq = 0.0f; |
| 532 | |
| 533 | // Set up our transforms |
| 534 | MatrixF objectToWorld = getRenderTransform(); |
| 535 | objectToWorld.scale( getScale() ); |
| 536 | |
| 537 | ri->objectToWorld = renderPass->allocUniqueXform( objectToWorld ); |
| 538 | ri->worldToCamera = renderPass->allocSharedXform(RenderPassManager::View); |
| 539 | ri->projection = renderPass->allocSharedXform(RenderPassManager::Projection); |
| 540 | |
| 541 | // If we need lights then set them up. |
| 542 | if ( matInst->isForwardLit() ) |
| 543 | { |
| 544 | LightQuery query; |
| 545 | query.init( getWorldSphere() ); |
| 546 | query.getLights( ri->lights, 8 ); |
| 547 | } |
| 548 | |
| 549 | // Make sure we have an up-to-date backbuffer in case |
| 550 | // our Material would like to make use of it |
nothing calls this directly
no test coverage detected