Sign in to follow this  

[.net] Converting ppBoneMatrices

This topic is 4810 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 am converting the skinned mesh code from the DX SkinnedMesh sample. ppBoneMatrices is a pointer to an array pointers in my understanding. To replicate this behaviour in C#, do I need to make a class that contains the Matrix structure?

Share this post


Link to post
Share on other sites
I could be wrong about this, but it looks like they are using a double pointer to keep references to the MATs in the frame without making copies so that when the frame changes the bone mats change too. Sadly in C# the GC can move the mats around in memory however it pleases and so this hack won't work. Beacuse Matricies are value types assigning them will make a copy and when the frame changes the bones will not.

You should be able to keep an array of Frames in place of the pointer to pointer to Matrix and call TransformationMatrix to get the Mat rather than accessing its memory location directly. Because Frame is a reference type your array will not be coppies but references and when you update the Frames you should have the correct Mat for the bone.

Making a Matrix wrapper class or boxing the matricies probably won't help because the matrix of interest is not boxed inside the Frame, all the same it might be worth a try (just cast the Matrix to an object and keep an array of objects -- this truly should be the same as a double pointer) it is possible that a reference to a value type in an object will remain valid if the value of the value type in the object changes, but I can't say for sure.

Hope this helps.
past.

Share this post


Link to post
Share on other sites
Thanks, turnpast.

Yesterday I think it was, I made a matrix container, but your idea is better, I will keep refs to the frames instead. It should only take 10 mins (I'd be rather displeased if it extended > 30 though!) as I only need to alter a few lines in the mesh container renderer and the function setting it all up.

Just before writing this, I saw on Jason Olsen's blog that there was an October 2004 update. I was a bit surprised as the summer update said that is was the last! It contains a skinned mesh example, but alas, I have almost finished my conversion anyway (~7 hours) and since I have not got broadband I would need to download it at school and burn it to a CD, requiring permission from the IT staff - I only just did it recently for NVidia's FX Composer!

Eeek! I wrote all that? Sorry for blabbing on :~}

Share this post


Link to post
Share on other sites
Yeah, I know how it goes. I usually am happy about updates but when its a big download and it means that I need to rewrite code I am less happy. Hopefully this update will be good, lord knows some things hould really use some help (like the managed documentation -- partucularly in the SkinnedMesh area). What I am really ready for is the dotnet 2.0 release. That should be an update I can truly be happy about.

past.

Share this post


Link to post
Share on other sites
I rated you up but it didn't seem to affect your rating. Maybe it is a delayed effect.

I agree that the help is not too brilliant or descriptive and you can tell that loads of it has been copied from the C++ help.
Still talks about pointers...

Share this post


Link to post
Share on other sites

This topic is 4810 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this