Sign in to follow this  
tokaplan

Loading FX instance in D3DXLoadMeshFromX

Recommended Posts

The 6th parameter of D3DXLoadMeshFromX ( LPD3DXBUFFER* ppEffectInstances ) is supposed to return an array of effect instances specified in X file. And it does, filling D3DXEFFECTINSTANCE structure. But for some reason or other, it does NOT fill its (LPSTR pEffectFilename) field, though I can see that the effects file name IS specified in X file. This sort of troubles me, for it's the only field I really need. Any suggestions? Thank you.

Share this post


Link to post
Share on other sites
Sorry, I forgot to show what I'm doing:

LPD3DXBUFFER effectInstance = NULL;
if( FAILED( hr = D3DXLoadMeshFromX( strPath, D3DXMESH_SYSTEMMEM, pd3dDevice,
&pAdjacencyBuffer, &pMtrlBuffer, &effectInstance,
&m_dwNumMaterials, &m_pSysMemMesh ) ) )
{
return hr;
}

D3DXEFFECTINSTANCE* effect =
(D3DXEFFECTINSTANCE*)effectInstance->GetBufferPointer();

strcpy( m_effectFileName, effect->pEffectFilename );

And I always receive NULL in effect->pEffectFilename, though other fields of D3DXEFFECTINSTANCE contain valid information.

Share this post


Link to post
Share on other sites
I remember something similar happened to me.

It should return an array of instances but the first item in the array always had no filename associated with it. So I always start at "1"... it works but I never understood why this happened. Maybe my maya exporter was buggy.

Share this post


Link to post
Share on other sites
Where and how exactly in the X file can the effect instance be specified? It would be cool for me to know that as currently I keep a track of various effect files for the different meshes I load in my project.

thanks
Tan

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this