Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            //BrightnessInit.go();
            //BrightnessInit.sortstuff();
            init(RENDER_WIDTH, RENDER_HEIGHT, "render");
            FrameBuffer buffer = new FrameBuffer();
            Rasterizer  rast   = new Rasterizer();

            someShape.translate(new Mesh.point3(-800, -300, -8));
            //someShape.rotate((float)0.25);

            buffer.drawFrame(rast.renderSolid());
            Console.ReadLine();
            //someShape.rotate((float)(3.1415));
            for (double i = 0; i < 1000; i += 0.01)
            {
                //light1.intensity = (int)((double)800 * Math.Sin(4*i));
                //someShape.rotate(0.005, 0);
                //someShape.rotate(0.005, 1);
                //someShape.rotate(0.005, 2);
                //someShape.translate(new Mesh.point3((float)Math.Sin(i), 0, 0));
                //  buffer.drawFrame(drawLine(new byte[RENDER_HEIGHT * RENDER_WIDTH], a1, a2));
                if (ts.x == 0)
                {
                    buffer.drawFrame(rast.renderSolid());
                }
                else if (ts.x == 2)
                {
                    buffer.drawFrame(rast.renderWire(someShape));
                }
                else if (ts.x == 1)
                {
                    buffer.drawFrame(rast.renderVerts(someShape));
                }

                //light1.coords.x = 1000 * (float)Math.Sin(i);
                // light1.coords.y = 1000 * (float)Math.Sin(i);
                //light1.coords.z = 100 * (float)Math.Sin(i);
                //someShape.rotate((float)0.005, 0);
                //someShape.rotate((float)0.005, 1);
            }
            Console.ReadLine();
        }
Exemplo n.º 2
0
        static void getInput()
        {
            ConsoleKeyInfo cki;

            // Console.TreatControlCAsInput = true;
            do
            {
                cki = Console.ReadKey();
                if (cki.Key == ConsoleKey.Spacebar)
                {
                    ts.changeState();
                }
                else if (cki.Key == ConsoleKey.W)
                {
                    someShape.translate(new Mesh.point3(0, 0, 1));
                }
                else if (cki.Key == ConsoleKey.A)
                {
                    someShape.translate(new Mesh.point3(-10, 0, 0));
                }
                else if (cki.Key == ConsoleKey.S)
                {
                    someShape.translate(new Mesh.point3(0, 0, -1));
                }
                else if (cki.Key == ConsoleKey.D)
                {
                    someShape.translate(new Mesh.point3(10, 0, 0));
                }
                else if (cki.Key == ConsoleKey.R)
                {
                    someShape.rotate(0.05);
                }
                else if (cki.Key == ConsoleKey.Q)
                {
                    someShape.translate(new Mesh.point3(0, -10, 0));
                }
                else if (cki.Key == ConsoleKey.E)
                {
                    someShape.translate(new Mesh.point3(0, 10, 0));
                }
            } while (cki.Key != ConsoleKey.Escape);
        }