예제 #1
0
        public void UpdateOncePerFrame()
        {
            timers.Update.Begin();
            if (RuntimeConfiguration.gameTest)
            {
                var game = Services.Get <Game>();
                if (game != null)
                {
                    game.UpdateOncePerFrame();
                }
            }
            if (userInterfaceManager != null)
            {
                userInterfaceManager.UpdateOncePerFrame();
            }
            sceneManager.UpdateOncePerFrame();

            timers.Update.End();
#if ASSET_MONITOR
            var monitor = BaseServices.Get <AssetMonitor>();
            if (monitor != null)
            {
                monitor.Update();
            }
#endif

            if (sounds != null)
            {
                sounds.PlayQueue();
            }
        }
예제 #2
0
 public IActionResult Get()
 {
     try
     {
         return(new ObjectResult(service.Get()));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex));
     }
 }
예제 #3
0
        private void LoadBrush(object obj)
        {
            var       brushManager = BaseServices.Get <BrushManager>();
            var       tls          = brushManager.ThreadInfo;
            BrushInfo bInfo        = (BrushInfo)(obj);

            tls.stream.Seek(index[bInfo.index], SeekOrigin.Begin);
            string       name = (string)tls.formatter.Deserialize(tls.stream);
            GeometryMesh mesh = (GeometryMesh)tls.formatter.Deserialize(tls.stream);

            MakeBrush(name, mesh);
        }
예제 #4
0
        public void LoadFromFile(string fullpath)
        {
            string source = System.IO.File.ReadAllText(fullpath);

#if ASSET_MONITOR
            var monitor = BaseServices.Get <AssetMonitor.AssetMonitor>();
            if (monitor != null)
            {
                monitor.AssetLoaded(this, fullpath);
            }
#endif
            Load(source);
        }
예제 #5
0
        public void RenderCubes(int px, int py, Camera camera)
        {
            map.RenderChunks(camera);

            //Vector3     start       =  sceneManager.Camera.Frame.LocalToWorld.Matrix.TransformPoint(Vector3.Zero);
            //Vector3     viewVector  = -sceneManager.Camera.Frame.LocalToWorld.Matrix.GetColumn3(2);
            //Vector3     end         = start + viewVector * 10.0f;
            //Vector3     end         = sceneManager.Camera.Frame.LocalToWorld.Matrix.TransformPoint(new Vector3(0,0,-2000));

            Vector3 root = camera.WorldToClip.InverseMatrix.UnProject(
                px,
                py,
                0.0f,
                renderer.Requested.Viewport.X,
                renderer.Requested.Viewport.Y,
                renderer.Requested.Viewport.Width,
                renderer.Requested.Viewport.Height
                );
            Vector3 tip = camera.WorldToClip.InverseMatrix.UnProject(
                px,
                py,
                1.0f,
                renderer.Requested.Viewport.X,
                renderer.Requested.Viewport.Y,
                renderer.Requested.Viewport.Width,
                renderer.Requested.Viewport.Height
                );

            IVector3 pos;
            IVector3 facing;

            EditPos.Y = 255;
            bool intersect = map.Intersect(root, tip, out pos, out facing);

            if (intersect)
            {
                byte block        = map[pos.X, (byte)pos.Y, pos.Z];
                var  textRenderer = BaseServices.Get <Renderer.TextRenderer>();
                if (textRenderer != null)
                {
                    textRenderer.DebugLine(
                        "Block ahead: " + pos.ToString() + BlockType.Name(block) + " facing " + facing.ToString()
                        );
                }
                EditPos = pos + facing;
            }
        }
예제 #6
0
        public Programs()
        {
            var monitor = BaseServices.Get <AssetMonitor>();

            if (monitor == null)
            {
                return;
            }
            try
            {
                string dstPath;
                string srcPath;
                dstPath = System.IO.Path.GetFullPath("res");
                srcPath = System.IO.File.ReadAllText(
                    System.IO.Path.Combine(dstPath, "source.txt")
                    ).Trim();

                string shaders;
                if (RenderStack.Graphics.Configuration.glslVersion < 330)
                {
                    shaders = "OpenGL1";
                }
                else
                {
                    shaders = "OpenGL3";
                }

                dstPath = System.IO.Path.Combine(dstPath, shaders);
                srcPath = System.IO.Path.Combine(srcPath, shaders);
                dstPath = System.IO.Path.GetFullPath("res");
                srcPath = System.IO.File.ReadAllText(
                    System.IO.Path.Combine(dstPath, "source.txt")
                    ).Trim();

                dstPath = System.IO.Path.Combine(dstPath, shaders);
                srcPath = System.IO.Path.Combine(srcPath, shaders);

                monitor.SrcPath = srcPath;
                monitor.DstPath = dstPath;
                monitor.Start();
            }
            catch (System.Exception)
            {
                // \todo What should we do?
            }
        }
예제 #7
0
        void IOperation.Undo(Application sandbox)
        {
            SelectionManager selectionManager = BaseServices.Get <SelectionManager>();

            if (selectionManager == null)
            {
                return;
            }

            foreach (var model in selectionManager.Models)
            {
                model.Selected = false;
            }
            selectionManager.Models.Clear();

            foreach (var model in before)
            {
                model.Selected = true;
                selectionManager.Models.Add(model);
            }
        }