Loading FX instance in D3DXLoadMeshFromX
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.
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.
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.
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.
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.
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
thanks
Tan
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement