Advertisement
Serafim

Untitled

Oct 16th, 2013
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. namespace Boo:Primitive:
  2.   class Mesh
  3.     constructor: (@coord) ->
  4.       @cam = 1
  5.  
  6.     draw: (ctx) ->
  7.       ctx.beginPath()
  8.  
  9.       ctx.moveTo @cnv(@coord[2], 0), @cnv(@coord[2], 1)
  10.       for i in [0..2]
  11.         ctx.lineTo @cnv(@coord[i], 0), @cnv(@coord[i], 1)
  12.       ctx.stroke()
  13.  
  14.       ctx.closePath()
  15.  
  16.     cnv: (elem, num) ->
  17.       fov = 4 - num
  18.       4 * elem[num] / (elem[2] - @cam)
  19.  
  20.  
  21.  
  22. Ioc::bind Boo.Primitive.Mesh
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement