|
@@ -79,6 +79,7 @@ void ProcessedCustomMaterial::_setStageData()
|
|
|
if(filename.equal(String("$dynamiclight"), String::NoCase))
|
|
|
{
|
|
|
rpd->mTexType[i] = Material::DynamicLight;
|
|
|
+ rpd->mSamplerNames[i] = mCustomMaterial->mSamplerNames[i];
|
|
|
mMaxTex = i+1;
|
|
|
continue;
|
|
|
}
|
|
@@ -86,6 +87,7 @@ void ProcessedCustomMaterial::_setStageData()
|
|
|
if(filename.equal(String("$dynamiclightmask"), String::NoCase))
|
|
|
{
|
|
|
rpd->mTexType[i] = Material::DynamicLightMask;
|
|
|
+ rpd->mSamplerNames[i] = mCustomMaterial->mSamplerNames[i];
|
|
|
mMaxTex = i+1;
|
|
|
continue;
|
|
|
}
|
|
@@ -93,6 +95,7 @@ void ProcessedCustomMaterial::_setStageData()
|
|
|
if(filename.equal(String("$lightmap"), String::NoCase))
|
|
|
{
|
|
|
rpd->mTexType[i] = Material::Lightmap;
|
|
|
+ rpd->mSamplerNames[i] = mCustomMaterial->mSamplerNames[i];
|
|
|
mMaxTex = i+1;
|
|
|
continue;
|
|
|
}
|
|
@@ -102,6 +105,7 @@ void ProcessedCustomMaterial::_setStageData()
|
|
|
if( mCustomMaterial->mCubemapData )
|
|
|
{
|
|
|
rpd->mTexType[i] = Material::Cube;
|
|
|
+ rpd->mSamplerNames[i] = mCustomMaterial->mSamplerNames[i];
|
|
|
mMaxTex = i+1;
|
|
|
}
|
|
|
else
|
|
@@ -114,6 +118,7 @@ void ProcessedCustomMaterial::_setStageData()
|
|
|
if(filename.equal(String("$dynamicCubemap"), String::NoCase))
|
|
|
{
|
|
|
rpd->mTexType[i] = Material::SGCube;
|
|
|
+ rpd->mSamplerNames[i] = mCustomMaterial->mSamplerNames[i];
|
|
|
mMaxTex = i+1;
|
|
|
continue;
|
|
|
}
|
|
@@ -121,6 +126,7 @@ void ProcessedCustomMaterial::_setStageData()
|
|
|
if(filename.equal(String("$backbuff"), String::NoCase))
|
|
|
{
|
|
|
rpd->mTexType[i] = Material::BackBuff;
|
|
|
+ rpd->mSamplerNames[i] = mCustomMaterial->mSamplerNames[i];
|
|
|
mMaxTex = i+1;
|
|
|
continue;
|
|
|
}
|
|
@@ -128,6 +134,7 @@ void ProcessedCustomMaterial::_setStageData()
|
|
|
if(filename.equal(String("$reflectbuff"), String::NoCase))
|
|
|
{
|
|
|
rpd->mTexType[i] = Material::ReflectBuff;
|
|
|
+ rpd->mSamplerNames[i] = mCustomMaterial->mSamplerNames[i];
|
|
|
mMaxTex = i+1;
|
|
|
continue;
|
|
|
}
|
|
@@ -135,6 +142,7 @@ void ProcessedCustomMaterial::_setStageData()
|
|
|
if(filename.equal(String("$miscbuff"), String::NoCase))
|
|
|
{
|
|
|
rpd->mTexType[i] = Material::Misc;
|
|
|
+ rpd->mSamplerNames[i] = mCustomMaterial->mSamplerNames[i];
|
|
|
mMaxTex = i+1;
|
|
|
continue;
|
|
|
}
|
|
@@ -151,6 +159,7 @@ void ProcessedCustomMaterial::_setStageData()
|
|
|
texTarget->getShaderMacros( &mConditionerMacros );
|
|
|
|
|
|
rpd->mTexType[i] = Material::TexTarget;
|
|
|
+ rpd->mSamplerNames[i] = mCustomMaterial->mSamplerNames[i];
|
|
|
mMaxTex = i+1;
|
|
|
continue;
|
|
|
}
|
|
@@ -162,6 +171,7 @@ void ProcessedCustomMaterial::_setStageData()
|
|
|
continue;
|
|
|
}
|
|
|
rpd->mTexType[i] = Material::Standard;
|
|
|
+ rpd->mSamplerNames[i] = mCustomMaterial->mSamplerNames[i];
|
|
|
mMaxTex = i+1;
|
|
|
}
|
|
|
|
|
@@ -232,6 +242,20 @@ bool ProcessedCustomMaterial::init( const FeatureSet &features,
|
|
|
setMaterialParameters( mDefaultParameters, 0 );
|
|
|
mStateHint.init( this );
|
|
|
|
|
|
+ for(int i = 0; i < mMaxTex; i++)
|
|
|
+ {
|
|
|
+ ShaderConstHandles *handles = _getShaderConstHandles( mPasses.size()-1 );
|
|
|
+ AssertFatal(handles,"");
|
|
|
+
|
|
|
+ if(rpd->mSamplerNames[i].isEmpty())
|
|
|
+ continue;
|
|
|
+
|
|
|
+ String samplerName = rpd->mSamplerNames[i].startsWith("$") ? rpd->mSamplerNames[i] : String("$") + rpd->mSamplerNames[i];
|
|
|
+ GFXShaderConstHandle *handle = rpd->shader->getShaderConstHandle( samplerName );
|
|
|
+ AssertFatal(handle,"");
|
|
|
+ handles->mTexHandlesSC[i] = handle;
|
|
|
+ }
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -384,14 +408,14 @@ void ProcessedCustomMaterial::setTextureStages( SceneRenderState *state, const S
|
|
|
if ( !texObject )
|
|
|
texObject = GFXTexHandle::ZERO;
|
|
|
|
|
|
- if ( handles->mRTParamsSC[samplerRegister]->isValid() && texObject )
|
|
|
+ if ( handles->mRTParamsSC[i]->isValid() && texObject )
|
|
|
{
|
|
|
const Point3I &targetSz = texObject->getSize();
|
|
|
const RectI &targetVp = texTarget->getViewport();
|
|
|
Point4F rtParams;
|
|
|
|
|
|
ScreenSpace::RenderTargetParameters(targetSz, targetVp, rtParams);
|
|
|
- shaderConsts->set(handles->mRTParamsSC[samplerRegister], rtParams);
|
|
|
+ shaderConsts->set(handles->mRTParamsSC[i], rtParams);
|
|
|
}
|
|
|
|
|
|
GFX->setTexture( samplerRegister, texObject );
|