示例#1
0
        public static void TestDirectionalLight(int width, int height, EventHandler taskEndEventHandler)
        {
            UnionLight lights = new UnionLight();

            lights.Add(new DirectionalLight(Model.Color.White, new Vector3(-1.75, -2, -1.5)));
            Scene scene = new Scene(DefaultGeometries, lights, DefaultCamera);

            scene.Initialize();
            scene.GetImage(width, height, taskEndEventHandler);
        }
示例#2
0
        public static void TestPointLight(int width, int height, EventHandler taskEndEventHandler)
        {
            UnionLight lights = new UnionLight();

            lights.Add(new PointLight(Model.Color.White * 2000, new Vector3(30, 40, 20)));
            Scene scene = new Scene(DefaultGeometries, lights, DefaultCamera);

            scene.Initialize();
            scene.GetImage(width, height, taskEndEventHandler, 8, false, 3);
        }
示例#3
0
        public static void TestDepth(int width, int height, EventHandler taskEndEventHandler)
        {
            UnionGeometry geometries = new UnionGeometry();

            geometries.Add(new Sphere(new Vector3(0, 10, -10), 10));
            geometries.Add(new Plane(new Vector3(0, 1, 0), 0));
            UnionLight lights = new UnionLight();
            Scene      scene  = new Scene(geometries, lights, DefaultCamera);

            scene.Initialize();
            scene.GetImage(width, height, taskEndEventHandler, 8, true);
        }
示例#4
0
        public static void TestTrichromatismLights(int width, int height, EventHandler taskEndEventHandler)
        {
            UnionLight lights = new UnionLight();

            lights.Add(new PointLight(Model.Color.White * 1000, new Vector3(30, 40, 20)));
            lights.Add(new SpotLight(Model.Color.Red * 3000, new Vector3(0, 30, 10), new Vector3(0, -1, -1), 20, 30, 1));
            lights.Add(new SpotLight(Model.Color.Green * 3000, new Vector3(6, 30, 20), new Vector3(0, -1, -1), 20, 30, 1));
            lights.Add(new SpotLight(Model.Color.Blue * 3000, new Vector3(-6, 30, 20), new Vector3(0, -1, -1), 20, 30, 1));
            Scene scene = new Scene(DefaultGeometries, lights, DefaultCamera);

            scene.Initialize();
            scene.GetImage(width, height, taskEndEventHandler, 8, false, 3);
        }
示例#5
0
        public static void TestManyLights(int width, int height, EventHandler taskEndEventHandler)
        {
            UnionLight lights = new UnionLight();

            for (int x = 10; x <= 30; x += 4)
            {
                for (int z = 20; z <= 40; z += 4)
                {
                    lights.Add(new PointLight(Model.Color.White * 80, new Vector3(x, 50, z)));
                }
            }
            DirectionalLight fillLight = new DirectionalLight(Model.Color.White * 0.25, new Vector3(1.5, 1, 0.5), false);

            lights.Add(fillLight);
            Scene scene = new Scene(DefaultGeometries, lights, DefaultCamera);

            scene.Initialize();
            scene.GetImage(width, height, taskEndEventHandler, 8, false, 3);
        }
示例#6
0
        public static void TestMtl(int width, int height, EventHandler taskEndEventHandler)
        {
            UnionGeometry geometries = new UnionGeometry();

            geometries.Add(new Plane(new Vector3(0, 1, 0), 0, FloorMaterial));
            geometries.Add(new Plane(new Vector3(1, 0, 1).Normalize(), -40, WallMaterial));
            geometries.Add(new Plane(new Vector3(-1, 0, 1).Normalize(), -40, WallMaterial));
            ObjModel objModel = new ObjModel("models/male02/male02.obj");
            Octree   octree   = new Octree(objModel.Triangles);

            geometries.Add(octree);
            Vector3           eye    = new Vector3(-223.999146, 162.986465, 305.502930);
            Vector3           front  = new Vector3(0.575724, -0.184038, -0.796663);
            Vector3           up     = new Vector3(0.106187, 0.982921, -0.150301);
            PerspectiveCamera camera = new PerspectiveCamera(eye, front, up, 30);
            UnionLight        lights = new UnionLight();

            lights.Add(new DirectionalLight(Model.Color.White, new Vector3(0, -1, -1), false));
            lights.Add(new PointLight(Model.Color.White * 1000, new Vector3(100, 200, 50)));
            Scene scene = new Scene(geometries, lights, camera);

            scene.Initialize();
            scene.GetImage(width, height, taskEndEventHandler, 8, false, 3);
        }
示例#7
0
 public Scene(UnionGeometry geometries, UnionLight lights, PerspectiveCamera camera)
 {
     this.geometries = geometries;
     this.lights     = lights;
     this.camera     = camera;
 }