Пример #1
0
        public void DrawSquares(DrawContext dc)
        {
            FlatBatch2D flatBatch2D = dc.PrimitivesRenderer2D.FlatBatch(1, DepthStencilState.None, null, BlendState.AlphaBlend);
            int         count       = flatBatch2D.LineVertices.Count;
            int         count2      = flatBatch2D.TriangleVertices.Count;
            float       num         = (float)MathUtils.Remainder(Time.FrameStartTime + (double)m_timeOffset, 10000.0);
            float       num2        = base.ActualSize.X / 12f;
            float       num3        = (float)(int)base.GlobalColorTransform.A / 255f;

            for (float num4 = 0f; num4 < base.ActualSize.X; num4 += num2)
            {
                for (float num5 = 0f; num5 < base.ActualSize.Y; num5 += num2)
                {
                    float   num6    = 0.35f * MathUtils.Pow(MathUtils.Saturate(SimplexNoise.OctavedNoise(num4 + 1000f, num5, 0.7f * num, 0.5f, 1, 2f, 1f) - 0.1f), 1f) * num3;
                    float   num7    = 0.7f * MathUtils.Pow(SimplexNoise.OctavedNoise(num4, num5, 0.5f * num, 0.5f, 1, 2f, 1f), 3f) * num3;
                    Vector2 corner  = new Vector2(num4, num5);
                    Vector2 corner2 = new Vector2(num4 + num2, num5 + num2);
                    if (num6 > 0.01f)
                    {
                        flatBatch2D.QueueRectangle(corner, corner2, 0f, new Color(0f, 0f, 0f, num6));
                    }
                    if (num7 > 0.01f)
                    {
                        flatBatch2D.QueueQuad(corner, corner2, 0f, new Color(0f, 0f, 0f, num7));
                    }
                }
            }
            flatBatch2D.TransformLines(base.GlobalTransform, count);
            flatBatch2D.TransformTriangles(base.GlobalTransform, count2);
        }