Exemplo n.º 1
0
        public void Plot(int x, int y, Color3 color, bool gammaCorrection)
        {
            if (float.IsNaN(color.R)) return;

            var oldColor = _acc[x, y];
            var newColor = (oldColor*NumSamples + color)/(NumSamples + 1);
            _acc[x, y] = newColor;
            _screen.Plot(x, y, newColor.ToArgb(gammaCorrection));
        }
Exemplo n.º 2
0
 public Accumulator(Surface screen)
 {
     _screen = screen;
     _acc = new Color3[screen.Width, screen.Height];
     for(int y = 0; y < screen.Height; y++)
         for (int x = 0; x < screen.Width; x++)
         {
             _acc[x,y] = new Color3(0,0,0);
         }
 }
Exemplo n.º 3
0
 public SingleColorSkybox(Color3 color)
 {
     _color = color;
 }
Exemplo n.º 4
0
 public PointLight(Vector3 position, Color3 color, float intensity)
 {
     Position = position;
     Color = color;
     Intensity = intensity;
 }
Exemplo n.º 5
0
Arquivo: game.cs Projeto: tincann/AGR
        public Color3 TraceRay(int x, int y, RNG rng)
        {
            float v = (float)y / Screen.Height;
            float u = (float)x / Screen.Width;

            Color3 color = new Color3(0,0,0);
           
            var strat = new Stratifier(rng, _sampleSizeX, _sampleSizeY);
            for (int i = 0; i < SampleSize; i++)
            {
                var pos = strat.GetRandomPointInStratum(i);
                var dx = pos.X / Screen.Width;
                var dy = pos.Y / Screen.Height;
                var r = _camera.CreatePrimaryRay(u + dx, v + dy);
                color += _scene.Sample(r, rng, false);
            }

            color /= SampleSize;
            return color;
        }