Jump to content
  • Advertisement
Sign in to follow this  
hotpixel

[SOLVED] C# with Animation and HLSL, working example!

This topic is 3781 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 guys, I am very new to game programming and I first of all tried C++ but then stepped back to C# because it is a much easier to start with. I am working through tuts on the internet and the samples with the various DirectX 9c SDKs. I'm gradually getting the hang of but I am having problems with the animation stuff. From what I can work out an .x file contains all the vertex info, bones, bone linkage and matrices for the bone rotations/translations and if you want to use an effect file then you have to extract the matrix and bone info then pass it into the effect file parameters, am I right? The C++ skinnedmesh example uses HLSL but the C# simple animation doesn't. I am trying to cross reference the two but I can't work out how to put a matrix array into an fx parameter. I've tried; effect.SetValue("mWorldMatrixArray", boneMatrices); boneMatrices being a Matrix array (Matrix[]) and mWorldMatrixArray is also an array in the fx file (fx file taken straight from the example) but this just throws up an error (general effect setValue() error nothing specific). I've also tried using the overloaded function which the C++ example uses: public void SetValue(EffectHandle parameter, void* data, int dataSize); but this asks for a pointer and when I try to use pointers C# says you have to use unsafe expressions which I don't fully understand but i gave it a go and then it can't assign a Matrix[] to a pointer but the C++ example seems to manage it fine? I've looked everywhere for help on C# animations with HLSL but can't seem to find it anywhere, can anyone please help? [Edited by - hotpixel on July 16, 2008 6:42:10 AM]

Share this post


Link to post
Share on other sites
Advertisement
Perhaps this sample (2nd on the list) is of any use to you. Be sure to also follow that link to Circlesoft's DirectMesh reference. It covers skeletal animation quite thoroughly and it helped me to get a better idea of how it would work in a 'real' application.

And here's of course the obligatory note that DirectX with C# has been superseded by XNA in MS's plan. You can find a HLSL sample for that over here. If you're looking for an alternative to DirectX w/ C#, SlimDX may be for you.

Share this post


Link to post
Share on other sites
The DirectMesh v2 is exactly what I'm looking for but all the links are broken :'( does anyone know of anywhere else I can get the DMSDK from?

Share this post


Link to post
Share on other sites
Acutally that second example is perfect, it uses the C# simple animation but also the HLSL as well, although its an old version of DirectX so I'll have to change a few variable names but that shouldnt be problem, thank you so much.

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.

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!