Archived

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

GekkoCube

D3DVECTOR erro!!?!?

Recommended Posts

Ok. I have a file called Physics.h It contained basically alot of physics routines and linear algreba functions, such as cross_product and dot_products. The file basically looks like this... // file: physics.h #ifndef PHYSICS_H #define PHYSICS_H inline D3DVECTOR cross_product(D3DVECTOR v1, D3DVECTOR v2) { return //do cross product here; } inline D3DVECTOR Reflect(D3DVECTOR velocity, D3DVECTOR normal) { return D3DVECTOR( normal.x*57.5f, normal.y*-velocity.y/2, normal.z*57.5f ); } #endif // eof: physics.h My first question: Is this way of implementing everything ok? I know its not object-oriented. but i did that just because. Second question: In the Reflect function, I''m return a D3DVECTOR. Now I''ve been doing this for as far as I can remember with no problem. But recently I opened this file and tried to rebuild....now I get an error saying the following: error C2661: ''_D3DVECTOR::_D3DVECTOR'' : no overloaded function takes 3 parameters What does this mean? D3DVECTOR does take 3 parameters! ~ I''''m a wannabe programmer ~

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I''m not positive about this, but I don''t think the D3DVECTOR struct has a constructor defined for it. just look at the docs

Share this post


Link to post
Share on other sites
Ok.

Well like I said, this has always worked for me before.
But if it has changed from dx7 to dx8, how do you suggest I write this then?

The dxdocs arent as informative as they used to be.

thanks.

~ I''''m a wannabe programmer ~

Share this post


Link to post
Share on other sites
D3DVECTOR does not have a constructor defined for it. So you would have to use { ... }. If you want to use it your way use D3DXVECTOR3, it is inherited from D3DVECTOR anyway and you will be able to use D3DX. And I don''t recommend you making your own standard vector manipulation functions because functions provided by D3DX are much faster then yours because they are written in Processor optimised assembler ... SIMD, 3DNow.

Share this post


Link to post
Share on other sites
What do you mean by {....} ?

What I have done is something like this...

D3DVECTOR vec;
vec.x = 0.0f;
vec.y = 1.0f;
vec.z = 0.0f;

Rather than my original way of doing this...

D3DVECTOR vec = D3DVECTOR(0.0f, 1.0f, 0.0f);

Either way, it works.

Thanks.

and doesnt gamedev.net notify me that i got a reply?!



~ I''''m a wannabe programmer ~

Share this post


Link to post
Share on other sites