Exemple #1
0
 public ViewModel(int arrayLength, Point center, WriteableBitmap wbmap)
 {
     wbm               = wbmap;
     this.center       = center;
     BitmapArraySource = new byte[arrayLength];
     Polygon           = new Polygon();
     ArrayLenght       = arrayLength;
     Polygons          = new List <Polygon>();
     IlluminationModel = new IlluminationModel(center);
     Coefficient       = 1;
 }
Exemple #2
0
        private void FillPolygon(WriteableBitmap wbm, Polygon polygon, Color color)
        {
            List <Edge>            pixelPairs      = Scanline.GetLinesToFill(polygon);
            List <List <Color> >   colors          = polygon.GetColorLists(pixelPairs);
            List <List <Point3D> > normalMapColors = polygon.GetNormalMapLists(pixelPairs);

            for (int i = 0; i < pixelPairs.Count; i++)
            {
                int            y            = (int)pixelPairs[i].Vertices[0].GetY();
                List <Point3D> normalColors = normalMapColors?[i];
                IlluminationModel.ApplyIllumination(pixelPairs[i], colors[i], normalColors);
                wbm.DrawBresenhamLine((int)pixelPairs[i].Vertices[0].GetX(), y, (int)pixelPairs[i].Vertices[1].GetX(), y, colors[i]);
            }
        }