               smoothFactor = paletteColor.reflection.smoothFactor or 0
 
               # Average the normal.
-              @_averageNormal.set 0, 0, 0
+              _averageNormal.set 0, 0, 0
 
               for offsetX in [-smoothFactor..smoothFactor]
                 for offsetY in [-smoothFactor..smoothFactor]
                   if sampleNormal = layer._pixelMap[pixel.x + offsetX]?[pixel.y + offsetY]?.normal
-                    @_averageNormal.add sampleNormal
-
-              @_averageNormal.normalize()
-              @_averageNormal.x *= -1 if flippedHorizontal
-
-              averageNormalLightProduct = THREE.Math.clamp @_averageNormal.dot(inverseLightDirection), 0, 1
+                    _averageNormal.add sampleNormal
+
+              _averageNormal.normalize()
+              _averageNormal.x *= -1 if flippedHorizontal
+
+              averageNormalLightProduct = THREE.Math.clamp _averageNormal.dot(inverseLightDirection), 0, 1
 
               # Calculate the perfectly reflected ray.
-              reflection = @_averageNormal.clone().multiplyScalar(2 * averageNormalLightProduct).sub inverseLightDirection
+              reflection = _averageNormal.clone().multiplyScalar(2 * averageNormalLightProduct).sub inverseLightDirection
 
               # We assume the inverse view direction to be (0, 0, 1).
               # Dot product is then the equivalent of the z coordinate.
               reflectionViewProduct = THREE.Math.clamp reflection.z, 0, 1
 
               lightFactor = Math.pow(reflectionViewProduct, shininess) * lightSpecularCoefficient * materialSpecularCoefficient
-              @_lightColor.set(0xffffff).multiplyScalar lightFactor
-
-              shadedColor.add @_lightColor
+              _lightColor.set(0xffffff).multiplyScalar lightFactor
+
+              shadedColor.add _lightColor
 
             if palette
               # Find the nearest color from the palette to represent the shaded color.


            # Calculate diffuse lighting.
            if pixel.normal
              @_normal.copy pixel.normal
              @_normal.x *= -1 if flippedHorizontal

            else
              @_normal.set 0, 0, 1

            normalLightProduct = THREE.Math.clamp @_normal.dot(inverseLightDirection), 0, 1

            lightDiffuseCoefficient = 0.6
            materialDiffuseCoefficient = 1

AM = Artificial.Mirage
LOI = LandsOfIllusions

# Create temporary objects and constants.
_normal = new THREE.Vector3
_backward = new THREE.Vector3 0, 0, 1
_color = new THREE.Color
_lightColor = new THREE.Color
_averageNormal = new THREE.Vector3

class LOI.Assets.Engine.Sprite
  constructor: (@options) ->
