SetListenerPosition() public method

public SetListenerPosition ( OpenRA.WPos position ) : void
position OpenRA.WPos
return void
示例#1
0
        static void RenderTick()
        {
            using (new PerfSample("render"))
            {
                ++RenderFrame;

                // worldRenderer is null during the initial install/download screen
                if (worldRenderer != null)
                {
                    Renderer.BeginFrame(worldRenderer.Viewport.TopLeft, worldRenderer.Viewport.Zoom);
                    Sound.SetListenerPosition(worldRenderer.Viewport.CenterPosition);
                    worldRenderer.Draw();
                }
                else
                {
                    Renderer.BeginFrame(int2.Zero, 1f);
                }

                using (new PerfSample("render_widgets"))
                {
                    Renderer.WorldVoxelRenderer.BeginFrame();
                    Ui.PrepareRenderables();
                    Renderer.WorldVoxelRenderer.EndFrame();

                    Ui.Draw();

                    if (ModData != null && ModData.CursorProvider != null)
                    {
                        Cursor.SetCursor(Ui.Root.GetCursorOuter(Viewport.LastMousePos) ?? "default");
                        Cursor.Render(Renderer);
                    }
                }

                using (new PerfSample("render_flip"))
                    Renderer.EndFrame(new DefaultInputHandler(OrderManager.World));

                if (TakeScreenshot)
                {
                    TakeScreenshot = false;
                    TakeScreenshotInner();
                }
            }

            PerfHistory.Items["render"].Tick();
            PerfHistory.Items["batches"].Tick();
            PerfHistory.Items["render_widgets"].Tick();
            PerfHistory.Items["render_flip"].Tick();

            if (BenchmarkMode)
            {
                Log.Write("render", "{0};{1}".F(RenderFrame, PerfHistory.Items["render"].LastValue));
            }
        }
示例#2
0
文件: Game.cs 项目: xbayrockx/OpenRA
        static void Tick(OrderManager orderManager)
        {
            if (orderManager.Connection.ConnectionState != lastConnectionState)
            {
                lastConnectionState = orderManager.Connection.ConnectionState;
                ConnectionStateChanged(orderManager);
            }

            TickInner(orderManager);
            if (worldRenderer != null && orderManager.world != worldRenderer.world)
            {
                TickInner(worldRenderer.world.orderManager);
            }

            using (new PerfSample("render"))
            {
                ++RenderFrame;

                // worldRenderer is null during the initial install/download screen
                if (worldRenderer != null)
                {
                    Renderer.BeginFrame(worldRenderer.Viewport.TopLeft.ToFloat2(), worldRenderer.Viewport.Zoom);
                    Sound.SetListenerPosition(worldRenderer.Position(worldRenderer.Viewport.CenterLocation));
                    worldRenderer.Draw();
                }
                else
                {
                    Renderer.BeginFrame(float2.Zero, 1f);
                }

                using (new PerfSample("render_widgets"))
                {
                    Ui.Draw();
                    var cursorName = Ui.Root.GetCursorOuter(Viewport.LastMousePos) ?? "default";
                    CursorProvider.DrawCursor(Renderer, cursorName, Viewport.LastMousePos, (int)cursorFrame);
                }

                using (new PerfSample("render_flip"))
                {
                    Renderer.EndFrame(new DefaultInputHandler(orderManager.world));
                }
            }

            PerfHistory.items["render"].Tick();
            PerfHistory.items["batches"].Tick();
            PerfHistory.items["render_widgets"].Tick();
            PerfHistory.items["render_flip"].Tick();

            delayedActions.PerformActions();
        }
示例#3
0
文件: Game.cs 项目: wytsep/OpenRA
        static void RenderTick()
        {
            using (new PerfSample("render"))
            {
                ++RenderFrame;

                // worldRenderer is null during the initial install/download screen
                if (worldRenderer != null)
                {
                    Renderer.BeginFrame(worldRenderer.Viewport.TopLeft, worldRenderer.Viewport.Zoom);
                    Sound.SetListenerPosition(worldRenderer.Position(worldRenderer.Viewport.CenterLocation));
                    worldRenderer.Draw();
                }
                else
                {
                    Renderer.BeginFrame(int2.Zero, 1f);
                }

                using (new PerfSample("render_widgets"))
                {
                    Ui.Draw();

                    if (modData != null && modData.CursorProvider != null)
                    {
                        var cursorName = Ui.Root.GetCursorOuter(Viewport.LastMousePos) ?? "default";
                        modData.CursorProvider.DrawCursor(Renderer, cursorName, Viewport.LastMousePos, (int)cursorFrame);
                    }
                }

                using (new PerfSample("render_flip"))
                    Renderer.EndFrame(new DefaultInputHandler(orderManager.world));
            }

            PerfHistory.items["render"].Tick();
            PerfHistory.items["batches"].Tick();
            PerfHistory.items["render_widgets"].Tick();
            PerfHistory.items["render_flip"].Tick();
        }
示例#4
0
        static void RenderTick()
        {
            using (new PerfSample("render"))
            {
                ++RenderFrame;

                // Prepare renderables (i.e. render voxels) before calling BeginFrame
                using (new PerfSample("render_prepare"))
                {
                    Renderer.WorldModelRenderer.BeginFrame();

                    // World rendering is disabled while the loading screen is displayed
                    if (worldRenderer != null && !worldRenderer.World.IsLoadingGameSave)
                    {
                        worldRenderer.Viewport.Tick();
                        worldRenderer.PrepareRenderables();
                    }

                    Ui.PrepareRenderables();
                    Renderer.WorldModelRenderer.EndFrame();
                }

                // worldRenderer is null during the initial install/download screen
                // World rendering is disabled while the loading screen is displayed
                // Use worldRenderer.World instead of OrderManager.World to avoid a rendering mismatch while processing orders
                if (worldRenderer != null && !worldRenderer.World.IsLoadingGameSave)
                {
                    Renderer.BeginWorld(worldRenderer.Viewport.Rectangle);
                    Sound.SetListenerPosition(worldRenderer.Viewport.CenterPosition);
                    using (new PerfSample("render_world"))
                        worldRenderer.Draw();
                }

                using (new PerfSample("render_widgets"))
                {
                    Renderer.BeginUI();

                    if (worldRenderer != null && !worldRenderer.World.IsLoadingGameSave)
                    {
                        worldRenderer.DrawAnnotations();
                    }

                    Ui.Draw();

                    if (ModData != null && ModData.CursorProvider != null)
                    {
                        if (HideCursor)
                        {
                            Cursor.SetCursor(null);
                        }
                        else
                        {
                            Cursor.SetCursor(Ui.Root.GetCursorOuter(Viewport.LastMousePos) ?? "default");
                            Cursor.Render(Renderer);
                        }
                    }
                }

                using (new PerfSample("render_flip"))
                    Renderer.EndFrame(new DefaultInputHandler(OrderManager.World));

                if (takeScreenshot)
                {
                    takeScreenshot = false;
                    TakeScreenshotInner();
                }
            }

            PerfHistory.Items["render"].Tick();
            PerfHistory.Items["batches"].Tick();
            PerfHistory.Items["render_world"].Tick();
            PerfHistory.Items["render_widgets"].Tick();
            PerfHistory.Items["render_flip"].Tick();
            PerfHistory.Items["terrain_lighting"].Tick();
        }
示例#5
0
        static void RenderTick()
        {
            using (new PerfSample("render"))
            {
                ++RenderFrame;
                if (Renderer.sproc.UseCandidates())
                {
                    Renderer.ResetSproc();
                }
                if (Renderer.SpriteRenderer.shader.UseCandidates())
                {
                    Renderer.ResetSproc();
                }
                if (Renderer.WorldSpriteRenderer.shader.UseCandidates())
                {
                    Renderer.ResetSproc();
                }
                if (Renderer.FontSpriteRenderer.shader.UseCandidates())
                {
                    Renderer.ResetSproc();
                }

                // worldRenderer is null during the initial install/download screen
                if (worldRenderer == null)
                {
                    Renderer.BeginFrame(int2.Zero, 1f);
                }
                else
                {
                    Renderer.BeginFrame(worldRenderer.Viewport.TopLeft, worldRenderer.Viewport.Zoom);
                    Sound.SetListenerPosition(worldRenderer.Viewport.CenterPosition);

                    // Use worldRenderer.World instead of OrderManager.World to avoid a rendering mismatch while processing orders
                    if (!worldRenderer.World.IsLoadingGameSave)
                    {
                        worldRenderer.Draw();
                    }
                }

                {
                    //	Game.Renderer.PixelDumpRenderer.Setup();
                    //	Game.Renderer.PixelDumpRenderer.fb.Bind();
                    //	Sheet seqsheet;
                    //	seqsheet = Game.ModData.DefaultSequences["arrakis2"].SpriteCache.SheetBuilder.Current;
                    //	Sprite sp = new Sprite(seqsheet, new Rectangle() { Width = 2048, Height = 2048 }, TextureChannel.Red); //чтобы прочитать все 4 канала seqsheet
                    //	//нужно использовать 4 итерации, где нужно менять канал в спрайте.

                    //	Game.Renderer.PixelDumpRenderer.DrawSprite(sp, new float3(0, 0, 0));
                    //	Game.Renderer.PixelDumpRenderer.Flush();
                    //	Game.Renderer.PixelDumpRenderer.fb.Unbind();
                    //	//нарисовали в текстуру в другой фреймбуфер.


                    //	//теперь нужно запустить еще раз рендер, где эта текстура будет как аргумент у шейдера и он нарисует все пиксели в фреймбуфер главный.
                    //	sp.SpriteType = 5;
                    //	Sheet sh1 = new Sheet(SheetType.BGRA, Game.Renderer.PixelDumpRenderer.fb.Texture);
                    //	Sprite sp2 = new Sprite(sh1, new Rectangle(0, 0, 2048, 2048), TextureChannel.Red);
                    //	sp2.SpriteType = 5;
                    //	Game.Renderer.PixelDumpRenderer.DrawSprite(sp2, new float3(0, 0, 0));

                    //	//Game.Renderer.PixelDumpRenderer.DrawSprite(sp, new float3(0, 0, 0));
                    //	sp.SpriteType = 0;
                    //	Game.Renderer.PixelDumpRenderer.Flush();
                    ////	Game.Renderer.Context.Present();
                    //	//Game.TakeScreenshotInner();
                }

                using (new PerfSample("render_widgets"))
                {
                    Renderer.WorldModelRenderer.BeginFrame();
                    Ui.PrepareRenderables();
                    Renderer.WorldModelRenderer.EndFrame();

                    Ui.Draw();

                    if (ModData != null && ModData.CursorProvider != null)
                    {
                        if (HideCursor)
                        {
                            Cursor.SetCursor(null);
                        }
                        else
                        {
                            Cursor.SetCursor(Ui.Root.GetCursorOuter(Viewport.LastMousePos) ?? "default");
                            Cursor.Render(Renderer);
                        }
                    }
                }

                using (new PerfSample("render_flip"))
                    Renderer.EndFrame(new DefaultInputHandler(OrderManager.World));

                if (takeScreenshot)
                {
                    takeScreenshot = false;
                    TakeScreenshotInner();
                }
            }

            PerfHistory.Items["render"].Tick();
            PerfHistory.Items["batches"].Tick();
            PerfHistory.Items["render_widgets"].Tick();
            PerfHistory.Items["render_flip"].Tick();
        }