예제 #1
0
        private void LoadRoom()
        {
            var floor = new Mesh();

            LoadMeshByPath(ref floor, "../../models/plane.obj");
            floor.material            = new Material();
            floor.material.color      = Color.White;
            floor.material.parameters = new List <double> {
                0, 0, 0, 0
            };
            ApplyTransform(ref floor, Rotate((180) / 360.0 * (2.0 * Math.PI), 'z'), true);
            ApplyTransform(ref floor, Transformation.Scale(2.5, 2.5, 5));
            ApplyTransform(ref floor, Transformation.Move(0, -100 + 250, -1));
            meshes.Add(floor);

            var ceiling = new Mesh();

            LoadMeshByPath(ref ceiling, "../../models/plane.obj");
            ceiling.material            = new Material();
            ceiling.material.color      = Color.DarkGreen;
            ceiling.material.parameters = new List <double> {
                0, 0, 0, 0
            };
            //AtheneTransform(ref ceiling, AtheneRotate((180) / 360.0 * (2.0 * Math.PI), 'z'), true);
            ApplyTransform(ref ceiling, Transformation.Scale(2.5, 2.5, 5));
            ApplyTransform(ref ceiling, Transformation.Move(0, -100 - 250, -1));
            meshes.Add(ceiling);

            var wall1 = new Mesh();

            LoadMeshByPath(ref wall1, "../../models/plane.obj");
            wall1.material            = new Material();
            wall1.material.color      = Color.LightYellow;
            wall1.material.parameters = new List <double> {
                0, 0, 0.8, 0
            };
            ApplyTransform(ref wall1, Transformation.Scale(2.5, 2.5, 5));
            ApplyTransform(ref wall1, Rotate((90) / 360.0 * (2.0 * Math.PI), 'z'), true);
            ApplyTransform(ref wall1, Transformation.Move(-250, -100, -1));
            meshes.Add(wall1);

            var wall2 = new Mesh();

            LoadMeshByPath(ref wall2, "../../models/plane.obj");
            wall2.material            = new Material();
            wall2.material.color      = Color.Purple;
            wall2.material.parameters = new List <double> {
                0, 0, 0, 0
            };
            ApplyTransform(ref wall2, Transformation.Scale(2.5, 2.5, 2.5));
            ApplyTransform(ref wall2, Rotate((90) / 360.0 * (2.0 * Math.PI), 'x'), true);
            ApplyTransform(ref wall2, Transformation.Move(0, -100, -1 + 500));
            meshes.Add(wall2);

            var wall3 = new Mesh();

            LoadMeshByPath(ref wall3, "../../models/plane.obj");
            wall3.material            = new Material();
            wall3.material.color      = Color.PaleTurquoise;
            wall3.material.parameters = new List <double> {
                0, 0, 0, 0
            };
            ApplyTransform(ref wall3, Transformation.Scale(2.5, 2.5, 5));
            ApplyTransform(ref wall3, Rotate((-90) / 360.0 * (2.0 * Math.PI), 'z'), true);
            ApplyTransform(ref wall3, Transformation.Move(250, -100, -1));
            meshes.Add(wall3);

            var wall4 = new Mesh();

            LoadMeshByPath(ref wall4, "../../models/plane.obj");
            wall4.material            = new Material();
            wall4.material.color      = Color.Red;
            wall4.material.parameters = new List <double> {
                0, 0, 0, 0
            };
            ApplyTransform(ref wall4, Transformation.Scale(2.5, 2.5, 2.5));
            ApplyTransform(ref wall4, Rotate((-90) / 360.0 * (2.0 * Math.PI), 'x'), true);
            ApplyTransform(ref wall4, Transformation.Move(0, -100, -500 - 1));
            meshes.Add(wall4);
        }
예제 #2
0
        private void LoadScene2()
        {
            LoadRoom();
            // Diffuse, Specular, Reflection, Refraction

            var t1 = new Mesh();

            LoadMeshByPath(ref t1, "../../models/cube.obj");
            t1.material            = new Material();
            t1.material.color      = Color.ForestGreen;
            t1.material.parameters = new List <double> {
                0, 0, 0.8, 0
            };
            //Transform(ref t1, Transformation.Scale(1.5, 1.5, 1.5));
            ApplyTransform(ref t1, Rotate(-130.0 / 360.0 * (2.0 * Math.PI), 'y'), true);
            ApplyTransform(ref t1, Transformation.Move(-80, 75, 300));
            meshes.Add(t1);

            var t3 = new Sphere();

            t3.mat                   = new Material();
            t3.mat.color             = Color.Black;
            t3.mat.specularHighlight = 100;
            t3.mat.parameters        = new List <double> {
                0.1, 5, 0.8, 0
            };
            t3.pos    = new Point3D(160, 100, 200);
            t3.radius = 50;
            spheres.Add(t3);

            var t6 = new Sphere();

            t6.mat                   = new Material();
            t6.mat.color             = Color.Yellow;
            t6.mat.specularHighlight = 30;
            t6.mat.refractionIndex   = 1.5;
            t6.mat.parameters        = new List <double> {
                0, 0.1, 0.1, 0.8
            };
            t6.pos    = new Point3D(-140, 90, 0);
            t6.radius = 60;
            spheres.Add(t6);

            var t2 = new Mesh();

            LoadMeshByPath(ref t2, "../../models/cube.obj");
            t2.material                   = new Material();
            t2.material.color             = Color.Red;
            t2.material.specularHighlight = 30;
            t2.material.refractionIndex   = 1.5;
            t2.material.parameters        = new List <double> {
                0.15, 0.5, 0, 0.8
            };
            ApplyTransform(ref t2, Transformation.Scale(0.5, 0.5, 0.5));
            ApplyTransform(ref t2, Rotate(-55.0 / 360.0 * (2.0 * Math.PI), 'y'), true);
            ApplyTransform(ref t2, Transformation.Move(115, 100, 0));
            meshes.Add(t2);

            /*
             * var t2 = new Mesh();
             * LoadMeshByPath(ref t2, "../../models/cube.obj");
             * t2.material = new Material();
             * t2.material.color = Color.Green;
             * t2.material.specularHighlight = 5;
             * t2.material.parameters = new List<double> { 0, 0.2, 0, 0 };
             * Transform(ref t2, Transformation.Scale(0.75, 0.75, 0.75));
             * Transform(ref t2, Rotate(-30.0 / 360.0 * (2.0 * Math.PI), 'y'), true);
             * Transform(ref t2, Transformation.Move(115, 75, 300));
             * meshes.Add(t2);
             *
             * var t3 = new Sphere();
             * t3.mat = new Material();
             * t3.mat.color = Color.Yellow;
             * t3.mat.specularHighlight = 300;
             * t3.mat.parameters = new List<double> { 0, 5, 0.5, 0 };
             * t3.pos = new Point3D(-160, 100, 200);
             * t3.radius = 50;
             * spheres.Add(t3);
             *
             * var t4 = new Mesh();
             * LoadMeshByPath(ref t4, "../../models/plane.obj");
             * t4.material = new Material();
             * t4.material.color = Color.Gray;
             * t4.material.parameters = new List<double> { 0, 0, 0, 0 };
             * //AtheneTransform(ref t4, AtheneScale(0.75, 0.75, 0.75));
             * Transform(ref t4, Rotate((180 + 75.0) / 360.0 * (2.0 * Math.PI), 'z'), true);
             * Transform(ref t4, Transformation.Move(220, 50, 50));
             * meshes.Add(t4);
             *
             * /*
             * var t5 = new Mesh();
             * LoadMeshByPath(ref t5, "../../models/plane.obj");
             * t5.material = new Material();
             * t5.material.color = Color.Gray;
             * t5.material.parameters = new List<double> { 0, 0, 0.9, 0 };
             * Transform(ref t5, Transformation.Scale(0.95, 0.95, 0.95));
             * Transform(ref t5, Rotate((180 + 75.0) / 360.0 * (2.0 * Math.PI), 'z'), true);
             * Transform(ref t5, Transformation.Move(219, 50, 50));
             * meshes.Add(t5);
             */

            //var t6 = new Sphere();
            //t6.mat = new Material();
            //t6.mat.color = Color.Yellow;
            //t6.mat.specularity = 30;
            //t6.mat.albedo = new List<double> { 1, 0, 0.5, 0 };
            //t6.location = new Point3D(180, -100, 250);
            //t6.radius = 100;
            //spheres.Add(t6);

            /*
             * var t6 = new Sphere();
             * t6.mat = new Material();
             * t6.mat.color = Color.Yellow;
             * t6.mat.specularHighlight = 30;
             * t6.mat.refractionIndex = 1.5;
             * t6.mat.parameters = new List<double> { 0, 0, 0, 1 };
             * t6.pos = new Point3D(-40, 90, 60);
             * t6.radius = 60;
             * spheres.Add(t6);
             *
             * var t7 = new Sphere();
             * t7.mat = new Material();
             * t7.mat.color = Color.Yellow;
             * t7.mat.specularHighlight = 30;
             * t7.mat.refractionIndex = 1.5;
             * t7.mat.parameters = new List<double> { 0, 0, 0, 0 };
             * t7.pos = new Point3D(-180, 110, -40);
             * t7.radius = 40;
             * spheres.Add(t7);
             */

            var l1 = new Light();

            l1.pos       = new Point3D(0, -250, 150);
            l1.intensity = 1;
            l1.color     = Color.White;
            lights.Add(l1);

            var l2 = new Light();

            l2.pos       = new Point3D(-150, 0, 0);
            l2.intensity = 0.7;
            l2.color     = Color.Cyan;
            lights.Add(l2);

            /*
             * var l1 = new Light();
             * l1.pos = new Point3D(150, 0, 0);
             * l1.intensity = 0.7;
             * l1.color = Color.Orange;
             * lights.Add(l1);
             *
             * var l2 = new Light();
             * l2.pos = new Point3D(-150, 0, 0);
             * l2.intensity = 0.7;
             * l2.color = Color.Cyan;
             * lights.Add(l2);*/
        }