     
     view = vec3.scale @direction, forward
     right = vec3.scale @right, strafe
-    vec3.set @position, dest
+    GLMatrix.vec3.copy dest, @position
     vec3.add view, dest, dest
     vec3.add right, dest, dest
     return dest

  @define 'position',
    get: -> @_position
    set: (x) ->
      vec3.set x, @_position
      # no need to completely invalidate, just force matrices and
      # frustum to update, that way we skip the overhead of
      # recalculating view, right and up vectors, which won't change.


class Jax.Camera
  @include Jax.EventEmitter
  LOCAL_VIEW  = GLMatrix.vec3.clone [0, 0,-1]
  LOCAL_RIGHT = GLMatrix.vec3.clone [1, 0, 0]
  LOCAL_UP    = GLMatrix.vec3.clone [0, 1, 0]
  
  constructor: (options) ->
    @rotation = GLMatrix.quat.identity GLMatrix.quat.create()
    @_position = GLMatrix.vec3.create()
    @matrices =
      mv:  GLMatrix.mat4.identity GLMatrix.mat4.create()
      imv: GLMatrix.mat4.identity GLMatrix.mat4.create()
      p:   GLMatrix.mat4.identity GLMatrix.mat4.create()
      n:   GLMatrix.mat3.identity GLMatrix.mat3.create()
    @reset()
    @setFixedYawAxis true, vec3.UNIT_Y
    
    @_isValid = false
    @_viewVector = GLMatrix.vec3.create()
    @_upVector   = GLMatrix.vec3.create()
    @_rightVector= GLMatrix.vec3.create()
    if options
      @_position = options.position if options.position
      @direction = options.direction if options.direction
