ANY way to convert CD3DMesh to ID3DXBaseMesh?

Started by
4 comments, last by 3dZmaster 20 years, 5 months ago
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
Woe to you, oh earth, and sea, for the devil sends the best with wrath, because he knows the time is short. Let him who hath understranding reckon the number of the beast, for it is a human number. Its number is 10011101101010110100110100101010101000101110100110100101010010100101101010101011...
Advertisement
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,KenDrunken 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]
_______________________________________Understanding is a three edged sword...Freelance Games - Home of XBLIG Starchonwww.FreelanceGames.com
Thank you. I''ll try this as soon as I get to my computer.
Woe to you, oh earth, and sea, for the devil sends the best with wrath, because he knows the time is short. Let him who hath understranding reckon the number of the beast, for it is a human number. Its number is 10011101101010110100110100101010101000101110100110100101010010100101101010101011...
Ok... Its tested now and it returns ID3DXMesh *. This is good to knwo cause I need it in other things. Now, the D3DXIntersect functionc is still complaining ''cause it needs an ID3DXBaseMesh(never ever heard of it...). Anyone has an idea how to do this?

thx
Woe to you, oh earth, and sea, for the devil sends the best with wrath, because he knows the time is short. Let him who hath understranding reckon the number of the beast, for it is a human number. Its number is 10011101101010110100110100101010101000101110100110100101010010100101101010101011...
Nevermind, I''ve got it solved....

thanks all!
Woe to you, oh earth, and sea, for the devil sends the best with wrath, because he knows the time is short. Let him who hath understranding reckon the number of the beast, for it is a human number. Its number is 10011101101010110100110100101010101000101110100110100101010010100101101010101011...

This topic is closed to new replies.

Advertisement