コード例 #1
0
        public static void Main(string[] args)
        {
            try
            {
                ActiveMesh = Mesh.LoadMeshFromFile(@"Resources\Meshes\link.obj");
            }
            catch (Exception e)
            {
                Console.WriteLine($"Failed to load mesh: {e.Message}");
                Console.Read();
                return;
            }

            //BrightnessInit.go();
            //BrightnessInit.sortstuff();
            GameInit(RENDER_WIDTH, RENDER_HEIGHT, "render");
            ActiveMesh.Translate(new Vector3(-800, -300, -8));
            //someShape.rotate((float)0.25);

            FrameBuffer.DrawFrame(Rasterizer.RenderSolid(ActiveMesh));
            //Console.ReadLine();
            //someShape.rotate((float)(3.1415));

            // render loop
            while (true)
            {
                //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 (renderState.x == 0)
                {
                    FrameBuffer.DrawFrame(Rasterizer.RenderSolid(ActiveMesh));
                }
                else if (renderState.x == 1)
                {
                    FrameBuffer.DrawFrame(Rasterizer.RenderVertices(ActiveMesh));
                }
                else if (renderState.x == 2)
                {
                    FrameBuffer.DrawFrame(Rasterizer.RenderWire(ActiveMesh));
                }

                //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);
            }
        }
コード例 #2
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();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: nerai/Console-Graphics
        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();
        }