示例#1
0
        public DebugModelRenderer(Alex alex)
        {
            Background   = Color.DeepSkyBlue;
            Anchor       = Alignment.Fill;
            ClipToBounds = false;

            EntityPosition = new PlayerLocation(Vector3.Zero);
            Camera         = new DebugModelRendererCamera(this);

            // World = new World(alex, alex.GraphicsDevice, alex.Services.GetService<IOptionsProvider>().AlexOptions,
            //     new FirstPersonCamera(16, Vector3.Zero, Vector3.Zero), new DebugNetworkProvider());

            BlockModelExplorer  = new BlockModelExplorer(alex, null);
            EntityModelExplorer = new EntityModelExplorer(alex, null);

            ModelExplorer = BlockModelExplorer;
        }
示例#2
0
        public ModelDebugState()
        {
            _debugInfo = new GuiDebugInfo();

            Background = Color.DeepSkyBlue;

            BlockModelExplorer  = new BlockModelExplorer(Alex.Instance, null);
            EntityModelExplorer = new EntityModelExplorer(Alex.Instance, null);

            ModelExplorer = BlockModelExplorer;

            //AddChild(_wrap = new GuiStackContainer()
            //{
            //	Orientation = Orientation.Horizontal,
            //	Anchor = Alignment.Fill,
            //	ChildAnchor = Alignment.FillY
            //});

            AddChild(_modelExplorerView = new GuiModelExplorerView(ModelExplorer, new Vector3(0f, 1.85f, 6f), new Vector3(0.5f, 0.5f, 0.5f))
            {
                Anchor            = Alignment.Fill,
                Background        = Color.TransparentBlack,
                BackgroundOverlay = new Color(Color.Black, 0.15f),

                Margin = new Thickness(0),

                Width  = 92,
                Height = 128,

                AutoSizeMode = AutoSizeMode.None,

                //Anchor = Alignment.BottomRight,

                // Width = 100,
                // Height = 100
            });

            AddChild(_mainMenu = new GuiStackMenu()
            {
                Margin  = new Thickness(0, 0, 15, 0),
                Padding = new Thickness(0, 50, 0, 0),
                Width   = 125,
                Anchor  = Alignment.FillY | Alignment.MinX,

                ChildAnchor       = Alignment.CenterY | Alignment.FillX,
                BackgroundOverlay = new Color(Color.Black, 0.35f)
            });

            //_wrap.AddChild(_modelRenderer = new DebugModelRenderer(Alex)
            //{
            //	Anchor = Alignment.Fill,
            //	// Width = 100,
            //	// Height = 100
            //});



            _mainMenu.AddMenuItem("Skip", () => { Task.Run(() => { ModelExplorer.Skip(); }); });
            _mainMenu.AddMenuItem("Next", NextModel);
            _mainMenu.AddMenuItem("Previous", PrevModel);
            _mainMenu.AddMenuItem("Switch Models", () =>
            {
                SwitchModelExplorers();
                _modelExplorerView.ModelExplorer = ModelExplorer;
            });

            //AddChild(_mainMenu);

            _debugInfo.AddDebugRight(() => Alex.DotnetRuntime);
            //_debugInfo.AddDebugRight(() => MemoryUsageDisplay);
            _debugInfo.AddDebugRight(() => $"RAM: {PlayingState.GetBytesReadable(_ramUsage, 2)}");
            _debugInfo.AddDebugRight(() =>
                                     $"GPU: {PlayingState.GetBytesReadable(GpuResourceManager.GetMemoryUsage, 2)}");
            _debugInfo.AddDebugRight(() =>
            {
                return
                ($"Threads: {(_threadsUsed):00}/{_maxThreads}\nCompl.ports: {_complPortUsed:00}/{_maxComplPorts}");
            });

            _debugInfo.AddDebugRight(() =>
            {
                if (ModelExplorer == null)
                {
                    return(string.Empty);
                }

                return(ModelExplorer.GetDebugInfo());
            });

            _keyState = Keyboard.GetState();
        }