Пример #1
0
        private static void Init()
        {
            shader = new ShaderProgram("Assets/Shaders/Shader.vert", "Assets/Shaders/Shader.frag");

            shader.AddUniform("vposoffset");
            shader.AddUniform("vsize");

            shader.AddUniform("aspectRatio");
            shader.AddUniform("rot");
            shader.AddUniform("maxIter");
            shader.AddUniform("clrRatio");
            shader.AddUniform("cursorClr");
            shader.AddUniform("julia_mode");
            shader.AddUniform("crosshair");

            shader.AddUniform("fractalType");
            shader.AddUniform("julia_c");
            shader.AddUniform("pos");
            shader.AddUniform("zoom");

            try {
                Serialization.FractalPair pair = Serialization.Load();
                mandelbrot    = pair.mandelbrot;
                julia         = pair.julia;
                activeFractal = pair.activeFractal;
            } catch (Exception) {
                mandelbrot = Fractal.CreateMandelbrot();
                julia      = Fractal.CreateJulia();
            }
            mandelbrot.Load();
            julia.Load();

            activeFractalTimer = new CooldownTimer(60);
            activeFractalTimer.SetTime(activeFractalTimer.GetCooldown());
        }
Пример #2
0
        private static void MainLoop()
        {
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit | ClearBufferMask.StencilBufferBit);

            GameTime.Update();
            Glfw.SetWindowTitle(window, "FPS: " + GameTime.FPS);

            CooldownTimer.Update();
            Update();
            Render(mandelbrot);
            Render(julia);

            Glfw.SwapBuffers(window);

            Glfw.PollEvents();
        }
Пример #3
0
        public void Load()
        {
            modeTimer      = new CooldownTimer(20);
            crosshairtimer = new CooldownTimer(20);
            Model model = Model.CreateRectangle(new Vector2(0.5f, 1));

            switch (fractalType)
            {
            case FractalType.Mandelbrot:
                quad = new Entity(model, new Vector2(-0.5f, 0));
                break;

            case FractalType.Julia:
                quad = new Entity(model, new Vector2(0.5f, 0));
                break;
            }
        }
Пример #4
0
 public static void AddTimer(CooldownTimer t)
 {
     Timers.Add(t);
 }