Ejemplo n.º 1
0
        public static void PaintRadiationEdges(PaintedHillsMod mymod, Colorer colorer, int tile_x, int tile_y, IDictionary <float, float> ray_rads_and_lengths)
        {
            Vector2 tile_origin = new Vector2(tile_x, tile_y);
            Vector2 beg_pos     = Vector2.Zero;
            Vector2 end_pos     = Vector2.Zero;

            SortedSet <float> keys = new SortedSet <float>(ray_rads_and_lengths.Keys);

            for (int i = 0; i < 60; i++)
            {
                float curr_rad = RayPainter.GetRadianAt(i % 60);
                float next_rad = RayPainter.GetRadianAt((i + 1) % 60);

                beg_pos = tile_origin + (Vector2.UnitX.RotatedBy(curr_rad) * ray_rads_and_lengths[curr_rad]);
                end_pos = tile_origin + (Vector2.UnitX.RotatedBy(next_rad) * ray_rads_and_lengths[next_rad]);

                double add_rad = Math.Atan2(end_pos.Y - beg_pos.Y, end_pos.X - beg_pos.X);
                end_pos += Vector2.UnitX.RotatedBy(add_rad) * 2f;

                colorer.ColorTileLine(mymod, (int)beg_pos.X, (int)beg_pos.Y, (int)end_pos.X, (int)end_pos.Y);
//ErrorLogger.Log( "PaintRadiationEdges x:"+tile_x+", y:"+tile_y+", rad:"+rad+", len:"+ray_rads_and_lengths[rad]+", offset:"+curr_tile_offset.ToString());
            }
        }