Jump to content
  • Advertisement
Sign in to follow this  
GeekSharp

ConvertToBlendedMesh(..) in C#

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

Greetings, I'm having some trouble getting ConvertToBlendedMesh(..) to work in C#.
				int faces;
				Direct3D.BoneCombination[] bones = null;
				try
				{
					mesh.SkinnedMesh = mesh.SkinInformation.ConvertToBlendedMesh(mesh.MeshData.Mesh, Direct3D.MeshFlags.Managed | Direct3D.MeshFlags.OptimizeVertexCache, mesh.GetAdjacencyStream(), out faces, out bones);
				}
				catch(Direct3D.Direct3DXException e)
				{
					Console.WriteLine(e.ErrorString);
				}

My program loads and shows non skinned models perfectly, it even plays animations perfectly. Now I'm trying to add blended mesh support. I have been studying how the DX mesh viewer (MView) sets up their SkinnedMesh, but this part isn't translating well to C#. When I run my program, this code snippet catches an "Error in application" exception with DX error code D3DERR_INVALIDCALL. The program then continues, loads, and displays the mesh without animation because there's no skinning info setup. I think the error has to do with the BoneCombination. In the C++ version, you pass a reference to a NULLed DXBUFFER pointer then that gets boxed into the BoneCombination. But the C# version requires an out directly to the BoneCombination array. So obviously I tried making it null like the C++ buffer. It errors. I tried to initialise it to an array with a size equal to the number of bones, that returned the same error. If anyone knows how to do this, or has some sample C# source in setting up a skinned mesh, that would be very helpful.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Have you tried ConvertToIndexedBlendedMesh() instead? Thats what ive used in the past.

Share this post


Link to post
Share on other sites
I have not tried it yet, and I will try it now.

I'm not quite sure what the Indexed version is. But I got the feeling it was just the same thing with more output information. I'm not sure if this is going to fix the problem, But I'll see.

If anyone knows what's wrong with the non-indexed version I'll still be curious.

Thanks

Share this post


Link to post
Share on other sites
Just FYI IndexedBlendedMesh is not supported in hardware on the vast majority of cards as FFP skinning really wasn't needed once shaders became available. You will have to use Mixed or Software VP if you are using Indexed whereas blended is supported in hardware.

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!