예제 #1
0
 public RayTracer(IAccelerator acc, Light[] lights, EnvironmentSettings settings)
 {
     this.acc = acc;
     this.maxDepth = settings.RecursionDepth;
     this.rayCache = new Ray[maxDepth+0x01];
     for(int i = 0x00; i < this.maxDepth+0x01; i++) {
         this.rayCache[i] = new Ray(0.0d, 0.0d, 0.0d, 0.0d, 0.0d, 0.0d);
     }
     this.lights = lights;
     this.ambientColor = settings.AmbientColor.Color;
     this.EnvironmentMap = EnvironmentMaps.GetOrBlack(settings.EnvironmentMap);
     this.lightTest = settings.LightTest;
     this.sr = new Ray(new Point3(0.0d, 0.0d, 0.0d), dis);
     this.distanceUnit = settings.DistanceUnit;
 }
예제 #2
0
        static void Main(string[] args)
        {
            ICamera camera = new PerspectiveCamera(45);
            Film film = new Film(500, 500);

            Scene scene = new Scene();
            Light light = new Light(new Color(10, 10, 10));
            light.Transform(new Transformation().Translate(1.5f, 0, -1.5f));
            scene.Lights.Add(light);
            Image texImage = Image.FromFile(@"C:\Users\tom.swedlund\Documents\src\images\test-image2.png");
            IShape shape = new SphereShape(0.2f, new LambertianBRDF(), new ImageTexture(texImage));
            shape.Transform(new Transformation().Translate(0.2f, -0.2f, 0.4f));
            scene.Shapes.Add(shape);
            shape = new PlaneShape(new LambertianBRDF(), null);
            shape.Transform(new Transformation().Scale(1.2f, 1.2f, 1.2f).Translate(0, 0, 1).Rotate(45, 1, 0, 0));
            scene.Shapes.Add(shape);

            Image image = Renderer.Render(scene, camera, film);
            image.Save(@"image.bmp");
        }
예제 #3
0
파일: Camera.cs 프로젝트: KommuSoft/MoRen
		public Camera (int w, int h, double screenDistance, double foVH, IAccelerator acc, Light[] lights, EnvironmentSettings settings, List<CameraPostProcessor> postprocessors = null) {
			this.raster = new Texture(w, h);
			this.foVH = foVH;
			this.acc = acc;
			this.Lights = lights;
			this.antialiasSqrt = settings.AntiAliasingSqrt;
			this.dispersion = settings.Dispersion;
			this.dispersionAntialiasSqrt = settings.DispersingAntiAliasingSqrt;
			this.settings = settings;
			if(postprocessors != null) {
				this.postProcessors = postprocessors;
			}
			else {
				this.postProcessors = new List<CameraPostProcessor>();
			}
		}