private void SetModelPicker(GenericModelRender modelRender) { if (!modelRender.Visible) { return; } if (pickingModeCB.SelectedIndex != 0) { modelRender.CanPick = true; } else { modelRender.CanPick = false; } switch (pickingModeCB.SelectedIndex) { case 0: case 1: modelRender.PickingSelection = GenericRenderer.PickingMode.Object; break; case 2: modelRender.PickingSelection = GenericRenderer.PickingMode.Mesh; break; case 3: //Todo picking CB does not include materials yet as it is not functional atm modelRender.PickingSelection = GenericRenderer.PickingMode.Material; break; } }
public void LoadModelFormat(IModelSceneFormat resourceFormat) { var resource = resourceFormat.ToGeneric(); if (ResourceFormats.Contains(resourceFormat)) { activeModelCB.SelectedItem = resource.Name; return; } ResourceFormats.Add(resourceFormat); var container = new ModelContainer(); container.AddModel(resourceFormat); Runtime.ModelContainers.Add(container); ModelContainers.Add(container); var drawableContainer = new DrawContainer(); drawableContainer.Name = resource.Name; var drawable = new GenericModelRender(resourceFormat.Renderer); drawableContainer.Drawables.Add(drawable); foreach (var model in resource.Models) { var skeleton = new GenericSkeletonRenderer(model.Skeleton); drawableContainer.Drawables.Add(skeleton); } Containers.Add(drawableContainer); if (Viewport3D.Scene != null) { ReloadScene(); } activeModelCB.Items.Add(resource.Name); activeModelCB.SelectedItem = resource.Name; }