public Renderer(WriteableBitmap baseBitmap, BaseLighting lighting) { bmp = new Bgr24Bitmap(baseBitmap); zBuf = new ZBuffer(baseBitmap.PixelWidth, baseBitmap.PixelHeight); // 4 stands for RGBA backBuffer = new byte[baseBitmap.PixelWidth * baseBitmap.PixelHeight * 4]; this.lighting = lighting; if (lighting.AmbientColor != null) { bgColor = lighting.AmbientColor.ToColor(); } else { lighting.AmbientColor = bgColor.ToVector3(); } }