Original Post
Hi I have my engine managed so that it groups visible subsets by material and renders one material at a time. A material can be just a colour or a texture or an effect. The problem is that when I render effects, my engine realy slows down. In my ID3DXEffect wrapper class, I read in all the SAS semantics into a vector then when i come to rendering i loop through the semantics and set them to those from the engine. i.e i set the viewMatrix to the cameras view matrix and the world matrix to that of the current subset. The thing is that to do this i have to strcompi the perameter with a list of supported values:
viewMatrix = base->camera->getViewMatrix();
projectionMatrix = base->camera->getProjectionMatrix();
for(UINT i = 0; i < Semantics.size(); i ++)
{
matrix = NULL;
currentSemantic = Semantics;
if(strcmpi(currentSemantic->semantic,"View") == 0)
{
matrix = viewMatrix;
pEffect->SetMatrix(currentSemantic->name,matrix);
}
else if(strcmpi(currentSemantic->semantic,"ViewInverse") == 0)
{
matrix = viewMatrix;
D3DXMatrixInverse(matrix,NULL,matrix);
pEffect->SetMatrix(currentSemantic->name,matrix);
}
else if(strcmpi(currentSemantic->semantic,"ViewInverseTranspose") == 0)
//etc for loads of possible values.....
whats more i have to do this once for every subset which has the effect every frame. This works but its SLLLOOOWWWWW. So im asking how do other people chose how to update their effect semantics? thanks [Edited by - treeway on September 10, 2006 6:14:10 PM]