<commit_before>package com.shade.shadows;

import java.util.LinkedList;

import org.newdawn.slick.Color;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.geom.Shape;
import org.newdawn.slick.geom.Vector2f;
import org.newdawn.slick.state.StateBasedGame;

import com.shade.base.Animatable;
import com.shade.crash.Body;
import com.shade.shadows.ShadowEntity.ShadowIntensity;
import com.shade.shadows.ShadowLevel.DayLightStatus;

/**
 * A collection of shadow casters. Their shadows are combined to construct the
 * shadowscape.
 * 
 * Generally, the player or mushroom are OK when contained by the shadowscape
 * and are in danger when not.
 * 
 * The shadow casters and shadowscape can be rendered in separate passes for
 * convenience.
 * 
 * This class is implemented under the assumption that its bodies don't need
 * access to the level, that they are just dumb obstacles which are not added or
 * removed dynamically.
 * 
 * @author <NAME><<EMAIL>>
 */
class Shadowscape implements Animatable {

    private static final Color SHADOW_COLOR = new Color(0, 0, 0, .5f);
    private LinkedList<ShadowCaster> casters;
    private LinkedList<Shape> shadows;

    /**
     * The direction and height of the light source.
     */
    private float direction, depth;
    private boolean updated;
    private DayLightStatus daylight;
    
    public Shadowscape(DayLightStatus daylight, float direction, float depth) {
        setDayLight(daylight);
        setDirection(direction);
        setDepth(depth);
        casters = new LinkedList<ShadowCaster>();
        shadows = new LinkedList<Shape>();
    }

    public void setDirection(float d) {
        direction = d;
        updated = true;
    }

    public void setDepth(float d) {
        depth = d;
        updated = true;
    }

    public void setDayLight(DayLightStatus d) {
        daylight = d;
    }

    public void add(ShadowCaster s) {
        casters.add(s);
    }

    public void renderShadowscape(StateBasedGame game, Graphics g) {
        Color c = g.getColor();
        g.setColor(SHADOW_COLOR);
        for (Shape s : shadows) {
            g.fill(s);
        }
        g.setColor(c);
    }

    public void renderShadowCasters(StateBasedGame game, Graphics g) {
        for (ShadowCaster s : casters) {
            s.render(game, g);
        }
    }

    /**<commit_msg>turned back on anti aliasing for shadows<commit_after>package com.shade.shadows;

import java.util.LinkedList;

import org.newdawn.slick.Color;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.geom.Shape;
import org.newdawn.slick.geom.Vector2f;
import org.newdawn.slick.state.StateBasedGame;

import com.shade.base.Animatable;
import com.shade.crash.Body;
import com.shade.shadows.ShadowEntity.ShadowIntensity;
import com.shade.shadows.ShadowLevel.DayLightStatus;

/**
 * A collection of shadow casters. Their shadows are combined to construct the
 * shadowscape.
 * 
 * Generally, the player or mushroom are OK when contained by the shadowscape
 * and are in danger when not.
 * 
 * The shadow casters and shadowscape can be rendered in separate passes for
 * convenience.
 * 
 * This class is implemented under the assumption that its bodies don't need
 * access to the level, that they are just dumb obstacles which are not added or
 * removed dynamically.
 * 
 * @author <NAME><<EMAIL>>
 */
class Shadowscape implements Animatable {

    private static final Color SHADOW_COLOR = new Color(0, 0, 0, .5f);
    private LinkedList<ShadowCaster> casters;
    private LinkedList<Shape> shadows;

    /**
     * The direction and height of the light source.
     */
    private float direction, depth;
    private boolean updated;
    private DayLightStatus daylight;
    
    public Shadowscape(DayLightStatus daylight, float direction, float depth) {
        setDayLight(daylight);
        setDirection(direction);
        setDepth(depth);
        casters = new LinkedList<ShadowCaster>();
        shadows = new LinkedList<Shape>();
    }

    public void setDirection(float d) {
        direction = d;
        updated = true;
    }

    public void setDepth(float d) {
        depth = d;
        updated = true;
    }

    public void setDayLight(DayLightStatus d) {
        daylight = d;
    }

    public void add(ShadowCaster s) {
        casters.add(s);
    }

    public void renderShadowscape(StateBasedGame game, Graphics g) {
        Color c = g.getColor();
        g.setColor(SHADOW_COLOR);
        g.setAntiAlias(true);
        for (Shape s : shadows) {
            g.fill(s);
        }
        g.setAntiAlias(false);
        g.setColor(c);
    }

    public void renderShadowCasters(StateBasedGame game, Graphics g) {
        for (ShadowCaster s : casters) {
            s.render(game, g);
        }
    }

    /**
{'fraction_non_alphanumeric': 0.0902632678646051, 'fraction_numerical': 0.002089427496865859, 'mean_word_length': 2.826538768984812, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1198866', 'n_tokens_mistral': 1443, 'n_tokens_neox': 1387, 'n_words': 420}