 
   drawScanLine: (x1, x2, y, z, color) ->
     [x1, x2] = [x2, x1] if x1 > x2
+
+    if AHHHHH
+      color[2] = color[2] * Math.cos(y % 10 + tick / 2) + 0.3
+      color[1] = color[1] * Math.sin((x1 + x2) / 2 + tick / 8)
+
+      # x1 += Math.tan(Math.floor(y/10 % 2) + tick / 10) * 8
+      # x2 += Math.tan(Math.floor(y/10 % 2) + tick / 10) * 8
+
     for x in [(x1 | 0)..(x2 | 0)] by 1
       @drawPoint(Vec3.fromValues(x, y, z), color)
 

  # Z
  # mesh.rotation[2] += 0.01

  device.render(camera, meshes)
  device.present()


Mat4 = require 'gl-matrix-mat4'
Teapot = require 'teapot'

POINTS = location.search == '?points'
WIREFRAME = location.search == '?wireframe'
SOLID = location.search == '?solid'
AHHHHH = location.search == '?AHHHHH'

# http://blogs.msdn.com/b/davrous/archive/2013/06/13/tutorial-series-learning-how-to-write-a-3d-soft-engine-from-scratch-in-c-typescript-or-javascript.aspx

