Jump to content
  • Advertisement
Sign in to follow this  
littlekid

Shaderx5 - Transparent Shader Data Binding

This topic is 3815 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have read the article by Dustin Franklin, and was wondering how to actually use it. For example if I have a global common ShadowMap.fx that generates shadowmaps. This EffectFile would be common across all entity/mesh to be drawn. How would I bind the data to the ShadowMap.fx? Does that mean for each Mesh, I need to have a Static/Dynamic Linker for every effect to be used? I was thinking of having something like this in each mesh:
class CLinkerTable
{
    std::map<ID3D10Effect*, std::vector<CLinker> > LinkerMap;

public:
    HRESULT ApplyLink(ID3D10Effect *pEffectToUse)
    {
        //Attempt to find if the Effect to be used has a list of Linker
        if (LinkerMap.find(pEffectToUse) == LinkerMap.end())
           return E_FAIL;

        //Apply the Link to bind the data
        for(size_t n=0; n<LinkerMap[pEffectToUse]->second.size(); n++)
           LinkerMap[pEffectToUse]->second[n].UpdateLink();
    }
};

//To draw a mesh I with shadowmap generation:
CMesh HumanMesh;
CLinkerTable HumanMeshLinkTable;
...

//ShadowMap
HumanMeshLinkTable.ApplyLink(pShadowMapEffect);
HumanMesh.Draw();

//Standard Drawing
HumanMeshLinkTable.ApplyLink(pStandardEffect);
HumanMesh.Draw();

However it seems that each time I load a effect, I need to loop through all the entites/mesh and create the Data Link for it and store it in the CLinkerTable. Wouldn't it be slow if the game has like 1000 entites?

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!