Search code examples
helix-3d-toolkithelix

How is a Scene Node bound to MeshGeometryModel3D with HelixToolKit


I'm able to load in a model using assimp with:

SceneNode _sceneModel = new Importer().Load(path).Root;

This seems to load in the geometry into its separate meshes - for instance if in Maya you built a room with Wall_1, Wall_2, Wall_3, etc. the SceneNode is some kind of data structure with all the meshes.

The separate meshes can then be put into an array

        geometry = _sceneModel.Traverse().Where(x => (x is MeshNode)).Select(m => ((MeshNode)m).Geometry).ToArray();

But ultimately I just want to bind the entire single piece of geometry (eg a house) in xml to

<MeshGeometryModel3D>

but can't figure out how to do it. I can bind a single piece of geometry eg. from the geometry array I can bind geometry[1] which might represent a wall but can't workout how to bind the whole thing.

Thanks


Solution

  • MeshGeometryModel3D is a wpf wrapper for Mesh Node (which is a scene node). If you only want to display your loaded model, you can add the root scene node into a GroupNodeModel3D. You can find example here https://github.com/helix-toolkit/helix-toolkit/blob/2254fce0870a165352ccb888e2f3e17398751724/Source/Examples/WPF.SharpDX/FileLoadDemo/MainViewModel.cs#L128