예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }