Exemple #1
0
        public void Init()
        {
            //PrintExtensions();
            CheckMemoryLeak();

            GL.ClearColor(0.2f, 0.3f, 0.3f, 1.0f);

            GL.Enable(EnableCap.DepthTest);
            GL.Enable(EnableCap.CullFace);
            GL.Enable(EnableCap.Blend);
            GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);

            InternalTextureManager.Init();

            ObjectManager.PushDebugGroup("Setup", "Pipelines");
            SetupPipelines();
            ObjectManager.PopDebugGroup();
            RenderContext.PrimaryRenderPipeline = RenderContext.GetPipeline <DeferredRenderPipeline>();

            RenderContext.LightBinding = new BindingPoint();
            Log.Verbose("LightBinding: {Number}", RenderContext.LightBinding.Number);

            // ctx.Camera = new OrthographicCamera(new Vector3(1f, -5f, 2f))
            // {
            //     NearPlane = 0.01f,
            //     FarPlane = 100.0f,
            // };

            RenderContext.AddObject(new ScreenSceneObject()
            {
            });
        }
Exemple #2
0
 private void CheckMemoryLeak()
 {
     if (InternalTextureManager.ReferencedCount() > 0)
     {
         Log.Warning("{Path}: {Value}", $"{nameof(InternalTextureManager)}.{nameof(InternalTextureManager.ReferencedCount)}", InternalTextureManager.ReferencedCount());
     }
 }
Exemple #3
0
        private void ConsoleLoop()
        {
            string prevCmd = "";

            while (true)
            {
                var cmd = Console.ReadLine().Trim();
                if (cmd == "r")
                {
                    cmd = prevCmd;
                }
                else
                {
                    prevCmd = cmd;
                }

                var args = cmd.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                if (args.Length == 0)
                {
                    continue;
                }

                switch (cmd)
                {
                case "q":
                    return;

                case "diag":
                    SceneContext.Current.DumpInfo(true);
                    break;

                case "actor new":
                    Application.Current.DispatchUpdater(() =>
                    {
                        SceneContext.Current.AddActor(new Actor(new CubeComponent()));
                    });
                    break;

                case "act del":
                case "actor del":
                    Application.Current.DispatchUpdater(() =>
                    {
                        SceneContext.Current.RemoveActor(SceneContext.Current.Actors.LastOrDefault());
                    });
                    break;

                case "map list":
                    Application.Current.DispatchUpdater(() =>
                    {
                        InternalTextureManager.DumpInfo(true);
                    });
                    break;

                default:
                    var a = new ExecuteConsoleCommandLineArgs(cmd);
                    CommandLineManager.Current.InvokeExecuteConsoleCommandLine(a);
                    if (!a.Handled)
                    {
                        Console.WriteLine("Unknown command");
                    }
                    break;
                }
            }
        }