public override object AssignTo(object obj) { if (obj is Scene) { Scene scene = (Scene)obj; Scene.PushCurrentScene(); try { scene.MakeCurrent(); Entity ent = new Entity(); MeshRender meshRender = new MeshRender(); ent.Name = Name; meshRender.Entity = ent; meshRender.Mesh = (Mesh)GetInstance(); return(ent); } finally { Scene.PopCurrentScene(); } } return(null); }
static public Entity NewCube() { Entity ent = new Entity(); MeshRender renderer = new MeshRender(); new CollisionableOBB().Entity = ent; renderer.Entity = ent; renderer.Mesh = (Mesh)Resource.FindResource(typeof(Mesh), "Cube"); ent.Name = "Cube"; return(ent); }
public override object AssignTo(object obj) { if (obj is Entity) { Entity ent = (Entity)obj; MeshRender render = (MeshRender)ent.FindChildComponent(typeof(MeshRender)); if (render != null) { render.Texture = this; } return(this); } return(null); }