Пример #1
0
        public static void Render()
        {
            Shaders.Uniform(Shaders.TextureShader, ref matrix, Color.White);

            foreach (var r in beforeRender)
            {
                r.Render();
            }

            game.ScreenControl.Render();

            foreach (var r in afterRender)
            {
                r.Render();
            }

            var possibleTarget = game.World.LocalPlayer != null && game.World.LocalPlayer.GetPart <PlayerPart>().FindValidTarget(MouseInput.GamePosition) != null;

            if (Settings.DeveloperMode)
            {
                ColorManager.DrawRect(new CPos(-64, -64, 0), new CPos(64, 64, 0), Color.Cyan);
                ColorManager.DrawRect(MouseInput.WindowPosition + new CPos(-64, -64, 0), MouseInput.WindowPosition + new CPos(64, 64, 0), possibleTarget ? Color.Red : Color.Blue);
            }
            else
            {
                Cursor.Current = possibleTarget ? CursorType.ATTACK : CursorType.DEFAULT;
                Cursor.Render();
            }

            tooltip?.Render();

            MasterRenderer.RenderBatch();

            if (Settings.DeveloperMode)
            {
                MasterRenderer.UseDebugRenderer = true;
                MasterRenderer.PrimitiveType    = PrimitiveType.Lines;

                game.ScreenControl.DebugRender();

                MasterRenderer.RenderBatch();
                MasterRenderer.PrimitiveType    = PrimitiveType.Triangles;
                MasterRenderer.UseDebugRenderer = false;
            }
        }
Пример #2
0
        public static void Render()
        {
            game.LocalRender++;

            if (beforeRender.Count != 0)
            {
                foreach (var o in beforeRender)
                {
                    o.Render();
                }

                MasterRenderer.RenderBatch();
            }

            Shaders.Uniform(Shaders.TextureShader, ref Camera.Matrix, Ambient);

            world.TerrainLayer.Render();
            world.SmudgeLayer.Render();

            var pos = world.Game.Editor ? MouseInput.GamePosition : world.PlayerAlive ? world.LocalPlayer.Position : CPos.Zero;

            foreach (var o in prepareRenderList())
            {
                if (((o is Actor actor && actor.WorldPart != null && actor.WorldPart.Hideable) || (o is Wall wall && wall.IsHorizontal && wall.Type.Height >= 512)) && o.Position.Y > pos.Y && Math.Abs(o.Position.X - pos.X) < 4096)
                {
                    var alpha     = o.Position.Y - pos.Y < 1024 ? 1 - (o.Position.Y - pos.Y) / 1024f : (o.Position.Y - pos.Y - 1024) / 1024f;
                    var sidealpha = Math.Abs(o.Position.X - pos.X) / 4096f;
                    if (sidealpha > alpha)
                    {
                        alpha = sidealpha;
                    }
                    alpha = Math.Clamp(alpha, 0.5f, 1f);

                    o.SetColor(new Color(1f, 1f, 1f, alpha));
                    o.Render();
                    o.SetColor(Color.White);
                }