| 95 | } |
| 96 | |
| 97 | void ImposterCaptureMaterialHook::init( BaseMatInstance *inMat ) |
| 98 | { |
| 99 | // We cannot capture impostors on custom materials |
| 100 | // as we don't know how to get just diffuse and just |
| 101 | // normals rendering. |
| 102 | if ( dynamic_cast<CustomMaterial*>( inMat->getMaterial() ) ) |
| 103 | return; |
| 104 | |
| 105 | // Tweak the feature data to include just what we need. |
| 106 | FeatureSet features; |
| 107 | features.addFeature( MFT_VertTransform ); |
| 108 | features.addFeature( MFT_DiffuseMap ); |
| 109 | features.addFeature( MFT_OverlayMap ); |
| 110 | features.addFeature( MFT_DetailMap ); |
| 111 | features.addFeature( MFT_DiffuseColor ); |
| 112 | features.addFeature( MFT_AlphaTest ); |
| 113 | features.addFeature( MFT_IsTranslucent ); |
| 114 | |
| 115 | const String &matName = inMat->getMaterial()->getName(); |
| 116 | |
| 117 | mDiffuseMatInst = MATMGR->createMatInstance( matName ); |
| 118 | mDiffuseMatInst->getFeaturesDelegate().bind( &ImposterCaptureMaterialHook::_overrideFeatures ); |
| 119 | mDiffuseMatInst->init( features, inMat->getVertexFormat() ); |
| 120 | |
| 121 | features.addFeature( MFT_IsBC3nm ); |
| 122 | features.addFeature( MFT_NormalMap ); |
| 123 | features.addFeature( MFT_NormalsOut ); |
| 124 | features.addFeature( MFT_AccuMap ); |
| 125 | mNormalsMatInst = MATMGR->createMatInstance( matName ); |
| 126 | mNormalsMatInst->getFeaturesDelegate().bind( &ImposterCaptureMaterialHook::_overrideFeatures ); |
| 127 | mNormalsMatInst->init( features, inMat->getVertexFormat() ); |
| 128 | } |
| 129 | |
| 130 | void ImposterCaptureMaterialHook::_overrideFeatures( ProcessedMaterial *mat, |
| 131 | U32 stageNum, |
no test coverage detected