Jump to content
  • Advertisement
Sign in to follow this  
Steve5050

Matrix Multiply Conversion from C# to Vb.net

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

Hi, Using vb.net 2003 with dx 9.0c I don't know if I converted some code the right way and I need to know if it is correct, and if not how to correct it. I have this C# code:
 Matrix mat = frame.TransformationMatrix *((mFrame)frame).mTransform * tTransformationMatrix;
Which I can easily convert to vb.net:
Dim mat As Matrix = frame.TransformationMatrix * CType(frame,mFrame)).mTransform * tTransformationMatrix
The problem is I have vb.net 2003 which doesn't allow me to use an * operator like that, 2005 does. I have to use:
Dim mat As Matrix = Matrix.Multiply(frame.TransformationMatrix, Matrix.Multiply((CType(frame, mFrame)).mTransform, tTransformationMatrix))
I'm not sure if that is right. Can you tell me if it is correct? Thanks Steve

Share this post


Link to post
Share on other sites
Advertisement
The first parameter is the output of the multiplication. So you want this:


Dim mat As Matrix
Matrix.Multiply(mat, (CType(frame, mFrame)).mTransform, tTransformationMatrix)
Matrix.Multiply(mat, frame.TransformationMatrix, mat)

Share this post


Link to post
Share on other sites
Either I'm not following what you are saying
or there is something wrong.

I can only: Matrix.Multiply(left As Matrix, right As Matrix)

Share this post


Link to post
Share on other sites
Bah I must be looking at the documentation for the wrong function...the msdn section for Managed DX seems to be pretty screwy (keeps redirecting me to other pages). If that's the prototype, then your code looks fine.

Sorry about the mix up.

Share this post


Link to post
Share on other sites
DirectCast is the .NET version of VB6's CType for object casting and has better performance. (CType will perform additional conversion like int to double or even object to int etc...)

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!