| 1560 | } |
| 1561 | |
| 1562 | void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *mat ) |
| 1563 | { |
| 1564 | GFXDrawUtil *drawer = GFX->getDrawUtil(); |
| 1565 | |
| 1566 | GFX->setTexture( 0, NULL ); |
| 1567 | |
| 1568 | // Render world box. |
| 1569 | if (Con::getBoolVariable("$pref::convexDBG::ShowWorldBox", false)) |
| 1570 | { |
| 1571 | Box3F wbox( mWorldBox ); |
| 1572 | if ( getServerObject() ) |
| 1573 | wbox = static_cast<ConvexShape*>( getServerObject() )->mWorldBox; |
| 1574 | GFXStateBlockDesc desc; |
| 1575 | desc.setCullMode( GFXCullNone ); |
| 1576 | desc.setFillModeWireframe(); |
| 1577 | drawer->drawCube( desc, wbox, ColorI::RED ); |
| 1578 | } |
| 1579 | |
| 1580 | |
| 1581 | const Vector< Point3F > &pointList = mGeometry.points; |
| 1582 | const Vector< ConvexShape::Face > &faceList = mGeometry.faces; |
| 1583 | |
| 1584 | // Render Edges. |
| 1585 | if (Con::getBoolVariable("$pref::convexDBG::ShowEdges", false)) |
| 1586 | { |
| 1587 | GFXTransformSaver saver; |
| 1588 | //GFXFrustumSaver fsaver; |
| 1589 | |
| 1590 | MatrixF xfm( getRenderTransform() ); |
| 1591 | xfm.scale( getScale() ); |
| 1592 | GFX->multWorld( xfm ); |
| 1593 | |
| 1594 | GFXStateBlockDesc desc; |
| 1595 | desc.setZReadWrite( true, false ); |
| 1596 | desc.setBlend( true ); |
| 1597 | GFX->setStateBlockByDesc( desc ); |
| 1598 | |
| 1599 | //MathUtils::getZBiasProjectionMatrix( 0.01f, state->getFrustum(), ) |
| 1600 | |
| 1601 | const Point3F &camFvec = state->getCameraTransform().getForwardVector(); |
| 1602 | |
| 1603 | |
| 1604 | |
| 1605 | for ( S32 i = 0; i < faceList.size(); i++ ) |
| 1606 | { |
| 1607 | const ConvexShape::Face &face = faceList[i]; |
| 1608 | |
| 1609 | const Vector< ConvexShape::Edge > &edgeList = face.edges; |
| 1610 | |
| 1611 | const Vector< U32 > &facePntList = face.points; |
| 1612 | |
| 1613 | PrimBuild::begin( GFXLineList, edgeList.size() * 2 ); |
| 1614 | |
| 1615 | PrimBuild::color( LinearColorF(ColorI::WHITE) * 0.8f ); |
| 1616 | |
| 1617 | for ( S32 j = 0; j < edgeList.size(); j++ ) |
| 1618 | { |
| 1619 | PrimBuild::vertex3fv( pointList[ facePntList[ edgeList[j].p0 ] ] - camFvec * 0.001f ); |
nothing calls this directly
no test coverage detected