Advertisement Jump to content
Sign in to follow this  
lucky6969b

'D3DXMATRIXA16' does not name a type

This topic is 1744 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 got this error when trying to compile a Direct3D 9 Application with mingw64.

I basically use the header files included in the x:\mingw64\x86_64-w64-mingw32\include

folder.

 

Here some source code:

#ifndef SKINNED_MESH
#define SKINNED_MESH

#include <windows.h>
#include <d3dx9.h>
#include <string>
#include <vector>
#include "../IK/InverseKinematics.h"

using namespace std;

class SkinnedMesh;



// enum for various skinning modes possible
enum METHOD
{
    D3DNONINDEXED,
    D3DINDEXED,
    SOFTWARE,
    D3DINDEXEDVS,
    D3DINDEXEDHLSLVS,
    NONE
};


//using namespace std;
struct D3DXFRAME_DERIVED : public  D3DXFRAME
{
    D3DXMATRIX CombinedTransformationMatrix;

    D3DXFRAME_DERIVED()
    {
        Name = 0;
        pFrameSibling = NULL;
        pFrameFirstChild = NULL;
        pMeshContainer = NULL;
    }

    ~D3DXFRAME_DERIVED()
    {

    }

};

struct D3DXMESHCONTAINER_DERIVED : public D3DXMESHCONTAINER
{
    LPDIRECT3DTEXTURE9 *ppTextures;
    //std::vector<D3DMATERIAL9> materials;
    //std::vector<IDirect3DTexture9*> textures;


    LPD3DXMESH              pOrigMesh;
    LPD3DXATTRIBUTERANGE    pAttributeTable;
    DWORD                   NumAttributeGroups;
    DWORD                   NumInfl;
    LPD3DXBUFFER            pBoneCombinationBuf;
    D3DXMATRIX**            ppBoneMatrixPtrs;
    D3DXMATRIX*             pBoneOffsetMatrices;
    DWORD                   NumPaletteEntries;
    bool                    UseSoftwareVP;
    DWORD                   iAttributeSW;     // used to denote the split between SW and HW if necessary for non-indexed skinning


    D3DXMESHCONTAINER_DERIVED()
    {
        Name = 0;
        pSkinInfo = 0;
        ppBoneMatrixPtrs = 0;
        pBoneOffsetMatrices = 0;

        pAttributeTable = 0;
        pOrigMesh = 0;
        pEffects = 0;
        pMaterials = 0;
        pAdjacency = 0;
        NumMaterials = 0;
        NumAttributeGroups = 0;

    }

    ~D3DXMESHCONTAINER_DERIVED()
    {

    }
};

class CAllocateHierarchy: public ID3DXAllocateHierarchy
{
    public:
        STDMETHOD(CreateFrame)(THIS_ LPCSTR Name, LPD3DXFRAME *ppNewFrame);
        STDMETHOD(CreateMeshContainer)(THIS_ LPCSTR Name, CONST D3DXMESHDATA * pMeshData, CONST D3DXMATERIAL * pMaterials, CONST D3DXEFFECTINSTANCE * pEffectInstances, DWORD NumMaterials, CONST DWORD * pAdjacency, LPD3DXSKININFO pSkinInfo, LPD3DXMESHCONTAINER * ppNewMeshContainer);
        STDMETHOD(DestroyFrame)(THIS_ LPD3DXFRAME pFrameToFree);
        STDMETHOD(DestroyMeshContainer)(THIS_ LPD3DXMESHCONTAINER pMeshContainerBase);

        CAllocateHierarchy(SkinnedMesh *_mesh) { m_SkinnedMesh = _mesh; }
public:
    SkinnedMesh* m_SkinnedMesh;
};

class SkinnedMesh
{
public:
    SkinnedMesh() { }
    SkinnedMesh(const D3DCAPS9& caps);
    ~SkinnedMesh();

    bool Load(const std::wstring& filename);
private:

    void SetupBoneMatrixPointers(D3DXFRAME_DERIVED *f);


public:
    void Render(D3DXFRAME_DERIVED *f);
    void Render2(D3DXFRAME_DERIVED *f);
    LPD3DXFRAME GetFrameRoot() { return m_pRootBone; }
    LPD3DXANIMATIONCONTROLLER GetMasterAnimCtrl() { return m_pAnimCtrl; }
    HRESULT GenerateSkinnedMesh(D3DXMESHCONTAINER_DERIVED *pMeshContainer, LPD3DXMESH pMesh);
    void UpdateMatrices(D3DXFRAME_DERIVED* f, D3DXMATRIX* parentMatrix);


public:
    // Look for a position given the name by searching the .x file frame hierarchy
    D3DXVECTOR3 GetPos(const std::string& name);

    float GetRotation(std::string name)
    {
        LPD3DXFRAME frame = GetFrame(name.c_str());
    //    float angle = D3DXMatrixDecompose(NULL
        return 0.0f;
    }

public:

    LPD3DXFRAME GetBone(const std::string& name);


private:
    LPD3DXFRAME GetFrame(const std::string& name);


private:
    LPD3DXFRAME                            m_pRootBone;
    LPD3DXANIMATIONCONTROLLER              m_pAnimCtrl;
    METHOD                                 m_SkinningMethod;   // Current skinning method
    D3DXMATRIXA16*                         m_pBoneMatrices;
    UINT                                   m_NumBoneMatricesMax;
    D3DCAPS9                               m_d3dcaps;
    int                                    m_activeAnimation;
};


#endif
Edited by lucky6969b

Share this post


Link to post
Share on other sites
Advertisement

Those header files seem to be missing the type definition.  Here it is from Microsoft's own d3dx9math.h:

//---------------------------------------------------------------------------
// Aligned Matrices
//
// This class helps keep matrices 16-byte aligned as preferred by P4 cpus.
// It aligns matrices on the stack and on the heap or in global scope.
// It does this using __declspec(align(16)) which works on VC7 and on VC 6
// with the processor pack. Unfortunately there is no way to detect the 
// latter so this is turned on only on VC7. On other compilers this is the
// the same as D3DXMATRIX.
//
// Using this class on a compiler that does not actually do the alignment
// can be dangerous since it will not expose bugs that ignore alignment.
// E.g if an object of this class in inside a struct or class, and some code
// memcopys data in it assuming tight packing. This could break on a compiler
// that eventually start aligning the matrix.
//---------------------------------------------------------------------------
#ifdef __cplusplus
typedef struct _D3DXMATRIXA16 : public D3DXMATRIX
{
    _D3DXMATRIXA16() {}
    _D3DXMATRIXA16( CONST FLOAT * );
    _D3DXMATRIXA16( CONST D3DMATRIX& );
    _D3DXMATRIXA16( CONST D3DXFLOAT16 * );
    _D3DXMATRIXA16( FLOAT _11, FLOAT _12, FLOAT _13, FLOAT _14,
                    FLOAT _21, FLOAT _22, FLOAT _23, FLOAT _24,
                    FLOAT _31, FLOAT _32, FLOAT _33, FLOAT _34,
                    FLOAT _41, FLOAT _42, FLOAT _43, FLOAT _44 );

    // new operators
    void* operator new   ( size_t );
    void* operator new[] ( size_t );

    // delete operators
    void operator delete   ( void* );   // These are NOT virtual; Do not 
    void operator delete[] ( void* );   // cast to D3DXMATRIX and delete.
    
    // assignment operators
    _D3DXMATRIXA16& operator = ( CONST D3DXMATRIX& );

} _D3DXMATRIXA16;

#else //!__cplusplus
typedef D3DXMATRIX  _D3DXMATRIXA16;
#endif //!__cplusplus



#if _MSC_VER >= 1300  // VC7
#define D3DX_ALIGN16 __declspec(align(16))
#else
#define D3DX_ALIGN16  // Earlier compiler may not understand this, do nothing.
#endif

typedef D3DX_ALIGN16 _D3DXMATRIXA16 D3DXMATRIXA16, *LPD3DXMATRIXA16;

You'd be well advised to heed the warning in the comment about making it a struct member.  My own recommended approach would be to just forget about the alignment and use the following (put in in one of your own project headers), unless you're more familiar with the behaviour of your compiler:

typedef D3DXMATRIX  D3DXMATRIXA16;

Share this post


Link to post
Share on other sites

I am guessing DirectX headers used by MinGW have D3DXMATRIXA16 removed because it's alignment was in some way done specifically for MSVC or if you use the original headers it's definition could be between "#ifdef MSVC" braces. Use D3DXMATRIX and if you want to align it do it the GCC's way.

 

EDIT:

Got beaten by mhagain. tongue.png

Edited by Guns

Share this post


Link to post
Share on other sites
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!