Sign in to follow this  
b3rs3rk

[C#] SkinInformation problem

Recommended Posts

b3rs3rk    216
Hello everyone. I've written a class that loads and displays skinned meshes (using the .x file format) using LoadHierarchyFromFile. Works very good with full skinned meshes, and now I'm trying to add support for non-skinned meshes, but I've run into a small problem. In the CreateMeshContainer (override from AllocateHierarchy) function I get a SkinInformation object that can be null... and if so I want to create a new one. Seems pretty easy huh? The problem is that the SkinInformation constructor doesn't work (throws an application error exception) and I don't know if this is a bug of MDX or something else -___-' This is what I'm doing:
public override MeshContainer CreateMeshContainer(string name, MeshData meshData, 
                                   ExtendedMaterial[] materials, EffectInstance[] effectInstances, 
                                   GraphicsStream adjacency, SkinInformation skinInfo)
        {
            if (meshData.Mesh == null)
                throw new ArgumentException();

            MeshContainerDerived container = new MeshContainerDerived();
           
            container.Name = name;

            if (skinInfo == null) 
            {
// the function crashes here
                SkinInformation s = new SkinInformation(meshData.Mesh.NumberVertices,
                    VertexDeclarations.SimpleVertexSkinned, 1);
            }
/******* non essential part *****/

meshData.Mesh is a valid object, NumberVertices is positive and finite (-> approx 300...), SimpleVertexSkinned is a custom Vertex Declaration I've already used, and 1...is one bone :D Any help will be really appreciated :D

Share this post


Link to post
Share on other sites
Mike.Popoloski    3258
In order to help you out more, we would need to see output from the debug runtimes as well as the actual information from the exception itself.

As a side note, MDX is old and even officially deprecated, and will no longer be updated. Depending on how far you are with your project, I would suggest taking a look at SlimDX, which is extremely similar to MDX, but improves upon it in a number of ways. Also, if your bug occurs in both MDX and SlimDX, it's likely that the problem is your fault.

Share this post


Link to post
Share on other sites
Buckeye    10747
Just an observation. I'm not familiar with MDX. However, in general terms, skin information contains frame information (i.e., the bones for skinning).

If you load a non-skinned mesh, which doesn't have a hierarchy (no bones) so SkinInfo is null, I'm not sure that you can force the container to have information it.. well, doesn't have.

SkinInformation is the result of the setup of a frame hierarchy; it doesn't create one. It appears that's what you're trying to do.

Share this post


Link to post
Share on other sites
b3rs3rk    216
"SkinInformation is the result of the setup of a frame hierarchy; it doesn't create one. It appears that's what you're trying to do."
In the engine I wrote in C++, I could create a "dummy" frame hierarchy with only one bone and assign it to a new skin information object.

Seems that with MDX this cannot be done.... I've taken a look at SlimDX, but at this point I think I'll return to C++ :)

Thank you :D

Share this post


Link to post
Share on other sites

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