Пример #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 TestObjModelOctreeMultiThread(int width, int height, EventHandler taskEndEventHandler)
        {
            UnionGeometry geometries = new UnionGeometry();
            ObjModel      objModel   = new ObjModel("models/dinosaur.2k.obj");
            Octree        octree     = new Octree(objModel.Triangles);

            geometries.Add(octree);
            Scene scene = new Scene(geometries, DefaultLight, ObjCamera);

            scene.Initialize();
            scene.GetImage(width, height, taskEndEventHandler, 8, false, 3);
        }
Пример #5
0
        public static void TestRayTracing(int width, int height, EventHandler taskEndEventHandler)
        {
            UnionGeometry geometries = new UnionGeometry();

            geometries.Add(new Plane(new Vector3(0, 1, 0), 0, new CheckerMaterial(0.1, 0.5)));
            geometries.Add(new Sphere(new Vector3(-10, 10, -10), 10, new PhongMaterial(Model.Color.Black, Model.Color.Red, Model.Color.White, 16, 0.25)));
            geometries.Add(new Sphere(new Vector3(10, 10, -10), 10, new PhongMaterial(Model.Color.Black, Model.Color.Blue, Model.Color.White, 16, 0.25)));
            PerspectiveCamera camera = new PerspectiveCamera(new Vector3(0, 5, 15), new Vector3(0, 0, -1), new Vector3(0, 1, 0), 90);
            Scene             scene  = new Scene(geometries, DefaultLight, camera);

            scene.Initialize();
            scene.GetImage(width, height, taskEndEventHandler, 8, false, 3);
        }
Пример #6
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);
        }
Пример #7
0
        public static void TestObjModel(int width, int height, EventHandler taskEndEventHandler)
        {
            UnionGeometry geometries = new UnionGeometry();
            ObjModel      objModel   = new ObjModel("models/dinosaur.2k.obj");

            foreach (var triangle in objModel.Triangles)
            {
                geometries.Add(triangle);
            }
            Scene scene = new Scene(geometries, DefaultLight, ObjCamera);

            scene.Initialize();
            scene.GetImage(width, height, taskEndEventHandler, 8, false, 3);
        }
Пример #8
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);
        }
Пример #9
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);
        }