<commit_before>import {vertex} from '@tools/fragments';
import perlin from './perlin.frag';
import main from './main.frag';

/**
* GordayFilter, {@link https://codepen.io/alaingalvan originally} by <NAME>
*
*
*
* ![original](../tools/screenshots/dist/original.png)![filter](../tools/screenshots/dist/godray.gif)
* @class
* @extends PIXI.Filter
* @memberof PIXI.filters
*
* @example
*  displayObject.filters = [new GodrayFilter()];
* @param {number} [angle=30] Angle of the rays.
* @param {number} [gain=0.5] General intensity of the effect.
* @param {number} [lacunrity=2.5] The density of the fractal noise.
* @param {number} [time=0] The current time position.
*/
export default class GodrayFilter extends PIXI.Filter {

    constructor(angle = 30, gain = 0.5, lacunarity = 2.5, time = 0) {
        super(vertex, main.replace('${perlin}', perlin));

        this.angle = angle;

        this.gain = gain;

        this.lacunarity = lacunarity;

        /**
         * The current time.
         *
         * @member {number}
         */
        this.time = time;
    }

    /**
     * Applies the filter.
     * @private
     * @param {PIXI.FilterManager} filterManager - The manager.
     * @param {PIXI.RenderTarget} input - The input target.
     * @param {PIXI.RenderTarget} output - The output target.
     */
    apply(filterManager, input, output, clear) {

        this.uniforms.time = this.time;

        // draw the filter...
        filterManager.applyFilter(this, input, output, clear);
    }

    /**
     * The angle of the rays in degrees. For instance, a value of 0 is vertical rays,
     * values of 90 or -90 produce horizontal rays.
     *
     * @member {number}
     * @default 30
     */
    get angle() {
        return this._angle;
    }
    set angle(value) {
        const radians = this.angle * PIXI.DEG_TO_RAD;

        const cos = Math.cos(radians);
        const sin = Math.sin(radians);
        const d = Math.sqrt(cos * cos + sin * sin);
        const dir = this.uniforms.angleDir;
        dir[0] = cos / d;
        dir[1] = sin / d;<commit_msg>fix the bug about `angle`<commit_after>import {vertex} from '@tools/fragments';
import perlin from './perlin.frag';
import main from './main.frag';

/**
* GordayFilter, {@link https://codepen.io/alaingalvan originally} by <NAME>
*
*
*
* ![original](../tools/screenshots/dist/original.png)![filter](../tools/screenshots/dist/godray.gif)
* @class
* @extends PIXI.Filter
* @memberof PIXI.filters
*
* @example
*  displayObject.filters = [new GodrayFilter()];
* @param {number} [angle=30] Angle of the rays.
* @param {number} [gain=0.5] General intensity of the effect.
* @param {number} [lacunrity=2.5] The density of the fractal noise.
* @param {number} [time=0] The current time position.
*/
export default class GodrayFilter extends PIXI.Filter {

    constructor(angle = 30, gain = 0.5, lacunarity = 2.5, time = 0) {
        super(vertex, main.replace('${perlin}', perlin));

        this.angle = angle;

        this.gain = gain;

        this.lacunarity = lacunarity;

        /**
         * The current time.
         *
         * @member {number}
         */
        this.time = time;
    }

    /**
     * Applies the filter.
     * @private
     * @param {PIXI.FilterManager} filterManager - The manager.
     * @param {PIXI.RenderTarget} input - The input target.
     * @param {PIXI.RenderTarget} output - The output target.
     */
    apply(filterManager, input, output, clear) {

        this.uniforms.time = this.time;

        // draw the filter...
        filterManager.applyFilter(this, input, output, clear);
    }

    /**
     * The angle of the rays in degrees. For instance, a value of 0 is vertical rays,
     * values of 90 or -90 produce horizontal rays.
     *
     * @member {number}
     * @default 30
     */
    get angle() {
        return this._angle;
    }
    set angle(value) {
        const radians = value * PIXI.DEG_TO_RAD;

        const cos = Math.cos(radians);
        const sin = Math.sin(radians);
        const dir = this.uniforms.angleDir;
        dir[0] = cos;
        dir[1] = sin;
{'fraction_non_alphanumeric': 0.13958587088915955, 'fraction_numerical': 0.01120584652862363, 'mean_word_length': 2.3961952026468154, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '2344552', 'n_tokens_mistral': 1378, 'n_tokens_neox': 1310, 'n_words': 359}