| 596 | } |
| 597 | |
| 598 | void ProcessedPrePassMaterial::_determineFeatures( U32 stageNum, |
| 599 | MaterialFeatureData &fd, |
| 600 | const FeatureSet &features ) |
| 601 | { |
| 602 | Parent::_determineFeatures( stageNum, fd, features ); |
| 603 | |
| 604 | // Find this for use down below... |
| 605 | bool bEnableMRTLightmap = false; |
| 606 | AdvancedLightBinManager *lightBin; |
| 607 | if ( Sim::findObject( "AL_LightBinMgr", lightBin ) ) |
| 608 | bEnableMRTLightmap = lightBin->MRTLightmapsDuringPrePass(); |
| 609 | |
| 610 | // If this material has a lightmap or tonemap (texture or baked vertex color), |
| 611 | // it must be static. Otherwise it is dynamic. |
| 612 | mIsLightmappedGeometry = ( fd.features.hasFeature( MFT_ToneMap ) || |
| 613 | fd.features.hasFeature( MFT_LightMap ) || |
| 614 | fd.features.hasFeature( MFT_VertLit ) || |
| 615 | ( bEnableMRTLightmap && (fd.features.hasFeature( MFT_IsTranslucent ) || |
| 616 | fd.features.hasFeature( MFT_ForwardShading ) || |
| 617 | fd.features.hasFeature( MFT_IsTranslucentZWrite) ) ) ); |
| 618 | |
| 619 | // Integrate proper opaque stencil write state |
| 620 | mUserDefined.addDesc( mPrePassMgr->getOpaqueStenciWriteDesc( mIsLightmappedGeometry ) ); |
| 621 | |
| 622 | FeatureSet newFeatures; |
| 623 | |
| 624 | // These are always on for prepass. |
| 625 | newFeatures.addFeature( MFT_EyeSpaceDepthOut ); |
| 626 | newFeatures.addFeature( MFT_PrePassConditioner ); |
| 627 | |
| 628 | #ifndef TORQUE_DEDICATED |
| 629 | |
| 630 | //tag all materials running through prepass as deferred |
| 631 | newFeatures.addFeature(MFT_isDeferred); |
| 632 | |
| 633 | // Deferred Shading : Diffuse |
| 634 | if (mStages[stageNum].getTex( MFT_DiffuseMap )) |
| 635 | { |
| 636 | newFeatures.addFeature(MFT_DiffuseMap); |
| 637 | } |
| 638 | newFeatures.addFeature( MFT_DiffuseColor ); |
| 639 | |
| 640 | // Deferred Shading : Specular |
| 641 | if( mStages[stageNum].getTex( MFT_SpecularMap ) ) |
| 642 | { |
| 643 | newFeatures.addFeature( MFT_DeferredSpecMap ); |
| 644 | } |
| 645 | else if ( mMaterial->mPixelSpecular[stageNum] ) |
| 646 | { |
| 647 | newFeatures.addFeature( MFT_DeferredSpecVars ); |
| 648 | } |
| 649 | else |
| 650 | newFeatures.addFeature(MFT_DeferredEmptySpec); |
| 651 | |
| 652 | // Deferred Shading : Material Info Flags |
| 653 | newFeatures.addFeature( MFT_DeferredMatInfoFlags ); |
| 654 | |
| 655 | for ( U32 i=0; i < fd.features.getCount(); i++ ) |
nothing calls this directly
no test coverage detected