<commit_before>###*
(Module) The <code>Shadows</code> module provides a lighting extension to the Engine. Objects that have
an illuminate method will add light to the scene. Objects that have an true opaque attribute will cast
shadows.

@name Shadows
@fieldOf Engine
###
Engine.Shadows = (I, self) ->
  shadowCanvas = $("<canvas width=640 height=480 />").powerCanvas()

  self.bind "draw", (canvas) ->
    if I.ambientLight < 1
      shadowCanvas.compositeOperation "source-over"
      shadowCanvas.clear()
      # Fill with shadows
      shadowCanvas.fill("rgba(0, 0, 0, #{1 - I.ambientLight})")

      # Etch out the light from each light source
      shadowCanvas.compositeOperation "destination-out"
      shadowCanvas.withTransform I.cameraTransform, (shadowCanvas) ->
        I.objects.each (object, i) ->
          if object.illuminate
            shadowCanvas.globalAlpha 1
            object.illuminate(shadowCanvas)

      shadows = shadowCanvas.element()
      canvas.drawImage(shadows, 0, 0, shadows.width, shadows.height, 0, 0, shadows.width, shadows.height)

  return {}

<commit_msg>adding module tag for docs<commit_after>###*
The <code>Shadows</code> module provides a lighting extension to the Engine. Objects that have
an illuminate method will add light to the scene. Objects that have an true opaque attribute will cast
shadows.

@name Shadows
@fieldOf Engine
@module

@param {Object} I Instance variables
@param {Object} self Reference to the engine
###
Engine.Shadows = (I, self) ->
  shadowCanvas = $("<canvas width=640 height=480 />").powerCanvas()

  self.bind "draw", (canvas) ->
    if I.ambientLight < 1
      shadowCanvas.compositeOperation "source-over"
      shadowCanvas.clear()
      # Fill with shadows
      shadowCanvas.fill("rgba(0, 0, 0, #{1 - I.ambientLight})")

      # Etch out the light from each light source
      shadowCanvas.compositeOperation "destination-out"
      shadowCanvas.withTransform I.cameraTransform, (shadowCanvas) ->
        I.objects.each (object, i) ->
          if object.illuminate
            shadowCanvas.globalAlpha 1
            object.illuminate(shadowCanvas)

      shadows = shadowCanvas.element()
      canvas.drawImage(shadows, 0, 0, shadows.width, shadows.height, 0, 0, shadows.width, shadows.height)

  return {}


{'fraction_non_alphanumeric': 0.10781318201658664, 'fraction_numerical': 0.013967699694456569, 'mean_word_length': 3.340909090909091, 'pattern_counts': {'":': 0, '<': 11, '<?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': '4089381', 'n_tokens_mistral': 679, 'n_tokens_neox': 645, 'n_words': 208}