public static NMSModel Read(string fname) { var model = new NMSModel(); using (var fs = File.OpenRead(fname)) { using (var handle = new BinaryReader(fs)) { model.Read(handle); } } return(model); }
public bool LoadModel(string FileName) { if (!File.Exists(FileName)) { return(false); } Console.WriteLine("Loading {0}...", Path.GetFileNameWithoutExtension(FileName)); var model = NMSModel.Read(FileName); model.PrintStats(); var Desc = RasterizerStateDescription.Default; Desc.CullMode = CullMode.None; var entity = CreateCustomMeshModel( GraphicsDevice, model.ToXenkoVertices(), model.Indices.ToArray(), PrimitiveType.TriangleList, Desc, Asset.Load <Material>("Sphere Material"), Vector3.Zero, Quaternion.Identity, false); EntityAddQueue.Enqueue(entity); Console.WriteLine("OK"); if (OnModelLoaded != null) { OnModelLoaded(model, entity, FileName); } return(true); }
public void SetModelInst(string Name, NMSModel Model) { this.ModelInst = Model; this.Text = Name; }