/// <summary> /// Constructor /// </summary> /// <param name="device">Device</param> /// <param name="model">Model Data</param> public SharpModel(SharpDevice device, ModelData model) { this.Name = model.Name; this.Device = device; Children = new List<Node>(); Geometries = new List<Geometry>(); Animations = new List<AnimationManager>(); foreach (var m in model.Nodes) { var c = new Node(Device, m, this); Children.Add(c); } //Animations Animations = new List<AnimationManager>(); foreach (Animation anim in model.Animations) { //carica le animazioni Animations.Add(new AnimationManager(anim)); } Initialize(); SetTime(0); }
/// <summary> /// Constructor /// </summary> /// <param name="device">Device</param> /// <param name="node">Parent Node</param> /// <param name="Model">Sharp Model</param> public Node(SharpDevice device, ModelNode node, SharpModel Model) { Name = node.Name; World = node.World; PreComputed = this.World; Children = new List<Node>(); //Create Child Nodes foreach (var m in node.Children) { var c = new Node(device, m, Model); c.Parent = this; Children.Add(c); } //Create Node Geometries foreach (var g in node.Geometries) { var g3d = new Geometry(device, g, node.Skinning != null); g3d.Node = this; Model.Geometries.Add(g3d); } //Get Skinning Data if (node.Skinning != null) { Skinning = new SkinData() { BindMatrix = node.Skinning.BindMatrix, InverseBindMatrix = new List<Matrix>(node.Skinning.InverseBinding), JointNames = new List<string>(node.Skinning.JointNames), }; } }