             paletteColor = pixel.paletteColor
             
           if paletteColor
-            @_destinationColor =
+            destinationColor =
               r: paletteColor.ramp / 255
               g: paletteColor.shade / 255
               b: paletteColor.dither or 0
             
           else
-            @_destinationColor = r: 255, g: 255, b: 255, a: 0
+            destinationColor = r: 1, g: 1, b: 1, a: 0
 
         else
           paletteColor = null

    # On the server we need to manually request pixel maps.
    spriteData.requirePixelMaps() if Meteor.isServer

    palette = @palette()

    # Build a new canvas if needed.
    unless @_canvas?.width is spriteData.bounds.width and @_canvas?.height is spriteData.bounds.height


class LOI.Assets.Engine.Sprite
  constructor: (@options) ->
    @ready = new ComputedField =>
      return unless spriteData = @options.spriteData()
      return unless spriteData.layers?.length and spriteData.bounds
      return unless spriteData.customPalette or LOI.Assets.Palette.documents.findOne(spriteData.palette?._id) or @options.visualizeNormals?()

      true

    # 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

