ANY way to convert CD3DMesh to ID3DXBaseMesh?
I''m wanting to use D3DXIntersect in my game and it needs an ID3DXBaseMesh. Now, I have loaded the object (and rendered and stuff) using the CD3DXMesh class. Is there any possible way I could get this same terrain model transfered to ID3DXBaseMesh just for the Intersection test?
thx
Umm, isn''t CD3DMesh a wrapper for a D3DXMesh? And I believe there is something like a GetMesh method to retrieve it. I don''t have my docs handy though.
Stay Casual,
Ken
Drunken Hyena
Stay Casual,
Ken
Drunken Hyena
quote:
Umm, isn't CD3DMesh a wrapper for a D3DXMesh? And I believe there is something like a GetMesh method to retrieve it. I don't have my docs handy though.
The following is the header source code for CD3DMesh:
//-----------------------------------------------------------------------------// Name: class CD3DMesh// Desc: Class for loading and rendering file-based meshes//-----------------------------------------------------------------------------class CD3DMesh{public: TCHAR m_strName[512]; LPD3DXMESH m_pSysMemMesh; // SysMem mesh, lives through resize LPD3DXMESH m_pLocalMesh; // Local mesh, rebuilt on resize DWORD m_dwNumMaterials; // Materials for the mesh D3DMATERIAL9* m_pMaterials; LPDIRECT3DTEXTURE9* m_pTextures; bool m_bUseMaterials;public: // Rendering HRESULT Render( LPDIRECT3DDEVICE9 pd3dDevice, bool bDrawOpaqueSubsets = true, bool bDrawAlphaSubsets = true ); // Mesh access LPD3DXMESH GetSysMemMesh() { return m_pSysMemMesh; } LPD3DXMESH GetLocalMesh() { return m_pLocalMesh; } // Rendering options void UseMeshMaterials( bool bFlag ) { m_bUseMaterials = bFlag; } HRESULT SetFVF( LPDIRECT3DDEVICE9 pd3dDevice, DWORD dwFVF ); // Initializing HRESULT RestoreDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice ); HRESULT InvalidateDeviceObjects(); // Creation/destruction HRESULT Create( LPDIRECT3DDEVICE9 pd3dDevice, TCHAR* strFilename ); HRESULT Create( LPDIRECT3DDEVICE9 pd3dDevice, LPDIRECTXFILEDATA pFileData ); HRESULT Destroy(); CD3DMesh( TCHAR* strName = _T("CD3DFile_Mesh") ); virtual ~CD3DMesh();};
Two different functions for retrieving the mesh of type ID3DXMesh are outlined below. This is what you want since ID3DXMesh is a concrete class for the base class or abstract class ID3DXBaseMesh. I don't normally use the framework, so I am not sure if there is any real difference in Meshes being returned?
1) ->GetSysMemMesh(); // SysMem mesh, lives through resize
2) ->GetLocalMesh(); // Local mesh, rebuilt on resize
_______________________________________
Understanding is a three edged sword...
[edited by - Sean Doherty on November 13, 2003 6:35:32 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement