<commit_before># Enlightenment

A simple yet fast light engine for Phaser (WebGL render).

# Example

![Screenshot](http://i.imgur.com/74vkxas.jpg)

# Demo

Check out the demo [here](https://and3rson.github.io/enlightenment/).

# Usage

Enlightenment consists of 3 main classes:

## `LightSystem` class

This is the main class that you need to instantiate in order to spawn necessary shaders & render images.

    var lightSystem = new LightSystem(WIDTH, HEIGHT, DEBUG);
    // - WIDTH, HEIGHT: size of the off-screen image used to render the light map.
    // The higher the resolution - the better the quality. I recommend using 256x256 as larger values have significant impact on the performance.
    // - DEBUG: set to true to draw debug stuff.

    // Call this in your `update` method:
    lightSystem.update();

    // You *must* call this every time you add/move/remove lights or objects:
    lightSystem.updateUniforms();

## `LightSource` class

Represents a source of light. Has color, radius and strength.

    var lightSource1 = new LightSource(new Phaser.Point(X, Y), RADIUS, INTENSITY, [RED, GREEN, BLUE, ALPHA]);
    // - X, Y: position of light source.
    // - RADIUS: radius of image.
    // - INTENSITY: how intensive is the light. 0 < INTENSITY <= 1
    // - RED, GREEN, BLUE, ALPHA - color of the light.<commit_msg>C'mon, gh-pages, build!<commit_after># Enlightenment

A simple yet fast light engine for Phaser (WebGL render).

# Example

![Screenshot](http://i.imgur.com/74vkxas.jpg)

# Demo

Check out the demo [here](https://and3rson.github.io/enlightenment/)!

# Usage

Enlightenment consists of 3 main classes:

## `LightSystem` class

This is the main class that you need to instantiate in order to spawn necessary shaders & render images.

    var lightSystem = new LightSystem(WIDTH, HEIGHT, DEBUG);
    // - WIDTH, HEIGHT: size of the off-screen image used to render the light map.
    // The higher the resolution - the better the quality. I recommend using 256x256 as larger values have significant impact on the performance.
    // - DEBUG: set to true to draw debug stuff.

    // Call this in your `update` method:
    lightSystem.update();

    // You *must* call this every time you add/move/remove lights or objects:
    lightSystem.updateUniforms();

## `LightSource` class

Represents a source of light. Has color, radius and strength.

    var lightSource1 = new LightSource(new Phaser.Point(X, Y), RADIUS, INTENSITY, [RED, GREEN, BLUE, ALPHA]);
    // - X, Y: position of light source.
    // - RADIUS: radius of image.
    // - INTENSITY: how intensive is the light. 0 < INTENSITY <= 1
    // - RED, GREEN, BLUE, ALPHA - color of the light.
{'fraction_non_alphanumeric': 0.10171385991058123, 'fraction_numerical': 0.009687034277198211, 'mean_word_length': 3.241706161137441, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '3153970', 'n_tokens_mistral': 854, 'n_tokens_neox': 792, 'n_words': 331}