Trouble making a pointer to a D3DXMATRIX

Started by
3 comments, last by CiscoKid5447 24 years ago
ok consider that i have coded something of this sort class Obj {public: void SetPtrToMatrix(D3DXMATRIX *Ptr) {MatrixPtr = Ptr;}; private: D3DXMATRIX *MatrixPtr; } void SomeVoid() { Obj TheClass; D3DXMATRIX Matrix; TheClass.SetPtrToMatrix(&Matrix); //*more code } But it Here is the error I get... error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'struct D3DXMATRIX' (or there is no acceptable conversion) ?But it should only be setting a pointer!? could someone please help me with this? Cheers! Kenny Edited by - CiscoKid5447 on 4/18/00 10:09:07 AM
Advertisement
Try

TheClass.SetPtrToMatrix(&Matrix);

TheClass is not a pointer, so you need to use . and not -> to access it''s members.

Oppps, your right TimSmith but that errors only here and not in the actual code, so im still having the same problems

here is some additional info that might be where the problem
is comming from
,, Here is the structure of D3DXMATRIX as it appears in the d3dxmath.ini

typedef struct D3DXMATRIX
{
#ifdef __cplusplus
public:
D3DXMATRIX() {};
D3DXMATRIX( const float * );
D3DXMATRIX( const D3DMATRIX& );
D3DXMATRIX( float m00, float m01, float m02, float m03,
float m10, float m11, float m12, float m13,
float m20, float m21, float m22, float m23,
float m30, float m31, float m32, float m33 );


// access grants
float& operator () ( UINT iRow, UINT iCol );
float operator () ( UINT iRow, UINT iCol ) const;

// casting operators
operator float* ();
operator const float* () const;

operator D3DMATRIX* ();
operator const D3DMATRIX* () const;

operator D3DMATRIX& ();
operator const D3DMATRIX& () const;

// assignment operators
D3DXMATRIX& operator *= ( const D3DXMATRIX& );
D3DXMATRIX& operator += ( const D3DXMATRIX& );
D3DXMATRIX& operator -= ( const D3DXMATRIX& );
D3DXMATRIX& operator *= ( float );
D3DXMATRIX& operator /= ( float );

// unary operators
D3DXMATRIX operator + () const;
D3DXMATRIX operator - () const;

// binary operators
D3DXMATRIX operator * ( const D3DXMATRIX& ) const;
D3DXMATRIX operator + ( const D3DXMATRIX& ) const;
D3DXMATRIX operator - ( const D3DXMATRIX& ) const;
D3DXMATRIX operator * ( float ) const;
D3DXMATRIX operator / ( float ) const;

friend D3DXMATRIX operator * ( float, const D3DXMATRIX& );

BOOL operator == ( const D3DXMATRIX& ) const;
BOOL operator != ( const D3DXMATRIX& ) const;


#endif //__cplusplus

union
{
float m[4][4];
#ifdef __cplusplus
struct
{
float m00, m01, m02, m03;
float m10, m11, m12, m13;
float m20, m21, m22, m23;
float m30, m31, m32, m33;
};
#endif //__cplusplus
};
} D3DXMATRIX, *LPD3DXMATRIX;
Did you try replacing the D3DXMATRIX * with LPD3DXMATRIX?
i.e.:
class Obj {
public:
void SetPtrToMatrix(LPD3DXMATRIX Ptr) {MatrixPtr = Ptr;};
private:
LPD3DXMATRIX MatrixPtr;
}
Try to create the = operator explicitly vs. having the constructor being the only assingment operator.

This topic is closed to new replies.

Advertisement