Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

CiscoKid5447

Trouble making a pointer to a D3DXMATRIX

This topic is 6758 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

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

Share this post


Link to post
Share on other sites
Advertisement
Try

TheClass.SetPtrToMatrix(&Matrix);

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

Share this post


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

Share this post


Link to post
Share on other sites
Did you try replacing the D3DXMATRIX * with LPD3DXMATRIX?
i.e.:
class Obj {
public:
void SetPtrToMatrix(LPD3DXMATRIX Ptr) {MatrixPtr = Ptr;};
private:
LPD3DXMATRIX MatrixPtr;
}

Share this post


Link to post
Share on other sites
Try to create the = operator explicitly vs. having the constructor being the only assingment operator.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!