Original Post
Hi in my effect class I used to say which type of texture a texture was by having an extra semantic i.e.
texture SkyCube_Tex : CubeMap
<
string ResourceName = "Materials\\Skybox\\Skybox.dds";
>;
samplerCUBE Environment = sampler_state
{
Texture = (SkyCube_Tex);
ADDRESSU = CLAMP;
ADDRESSV = CLAMP;
MAGFILTER = LINEAR;
MINFILTER = LINEAR;
MIPFILTER = LINEAR;
};
texture ColourMap_Tex : 2dTexture
<
string ResourceName = "Materials\\Skybox\\sky.jpg";
>;
sampler2D baseMap = sampler_state
{
Texture = (ColourMap_Tex);
ADDRESSU = WRAP;
ADDRESSV = WRAP;
MINFILTER = LINEAR;
MAGFILTER = LINEAR;
};
okay that worked but doesnt conform to the DXSAS and is fiddely since RenderMonkey doesnt export these semantics. Now i have found that I can get the type of texture from the Sampler e.g. the samplerCUBE and Sampler2D above. However when i read in the
while((tempHandle = pEffect->GetParameter(NULL,index)) != NULL)
{
if (pEffect->GetParameterDesc(tempHandle,&tempParamDesc) == S_OK)
{
if (tempParamDesc.Name != NULL)
{
if(tempParamDesc.Semantic != NULL)
{
Semantics.push_back(new Semantic(tempParamDesc.Name,tempParamDesc.Semantic,index));
base->logError((char*)tempParamDesc.Name,tempParamDesc.Semantic);
}
if(tempParamDesc.Type == D3DXPT_SAMPLER3D)
{
sprintf(base->buffer,"Volume Texture \n Name %s \n Type %d",tempParamDesc.Name,tempParamDesc.Type);
base->messageBox(base->hWnd,base->buffer);
}
else if(tempParamDesc.Type == D3DXPT_SAMPLERCUBE)
{
for(UINT i = 0; i < tempParamDesc.Elements; i ++)
{
D3DXPARAMETER_DESC desc;
if((SASHandle = pEffect->GetParameterElement(tempHandle,i)) != NULL)
{
pEffect->GetParameterDesc( SASHandle, &desc );
if(desc.Type == D3DXPT_STRING)
{
base->messageBox(base->hWnd,desc.Name,"BOOM");
}
}
}
sprintf(base->buffer,"CubeMap Texture \n Name %s \n Type %d",tempParamDesc.Name,tempParamDesc.Type);
base->messageBox(base->hWnd,base->buffer);
}
else if(tempParamDesc.Type == D3DXPT_SAMPLER || tempParamDesc.Type == D3DXPT_SAMPLER2D || tempParamDesc.Type == D3DXPT_SAMPLER1D)
{
sprintf(base->buffer,"Normal Texture \n Name %s \n Type %d",tempParamDesc.Name,tempParamDesc.Type);
base->messageBox(base->hWnd,base->buffer);
}
//... etc
The only thing that binds the Sampler description to the texture perameter is the name of the texture i.e Texture = (ColourMap_Tex);. Therefore as i parce through my effect I want to fnid the sampler states and then load the texture specified and bind it to the texture name. However I cant seem to read the actual Texture name part of the sampler state. how do i find it?