mesh.js
function facetAO(a00, a01, a02,
                 a10,      a12,
                 a20, a21, a22) {
  var s00 = (a00&OPAQUE_BIT) ? 1 : 0
    , s01 = (a01&OPAQUE_BIT) ? 1 : 0
    , s02 = (a02&OPAQUE_BIT) ? 1 : 0
    , s10 = (a10&OPAQUE_BIT) ? 1 : 0
    , s12 = (a12&OPAQUE_BIT) ? 1 : 0
    , s20 = (a20&OPAQUE_BIT) ? 1 : 0
    , s21 = (a21&OPAQUE_BIT) ? 1 : 0
    , s22 = (a22&OPAQUE_BIT) ? 1 : 0
  return (vertexAO(s10, s01, s00)<< AO_SHIFT) +
         (vertexAO(s01, s12, s02)<<(AO_SHIFT+AO_BITS)) +
         (vertexAO(s12, s21, s22)<<(AO_SHIFT+2*AO_BITS)) +
         (vertexAO(s21, s10, s20)<<(AO_SHIFT+3*AO_BITS))
}
function facetAO(a00, a01, a02,
                 a10,      a12,
                 a20, a21, a22) {
  var s00 = (a00&OPAQUE_BIT) ? 1 : 0
    , s01 = (a01&OPAQUE_BIT) ? 1 : 0
    , s02 = (a02&OPAQUE_BIT) ? 1 : 0
    , s10 = (a10&OPAQUE_BIT) ? 1 : 0
    , s12 = (a12&OPAQUE_BIT) ? 1 : 0
    , s20 = (a20&OPAQUE_BIT) ? 1 : 0
    , s21 = (a21&OPAQUE_BIT) ? 1 : 0
    , s22 = (a22&OPAQUE_BIT) ? 1 : 0
  return (vertexAO(s10, s01, s00)<< AO_SHIFT) +
         (vertexAO(s01, s12, s02)<<(AO_SHIFT+AO_BITS)) +
         (vertexAO(s12, s21, s22)<<(AO_SHIFT+2*AO_BITS)) +
         (vertexAO(s21, s10, s20)<<(AO_SHIFT+3*AO_BITS))
}
function facetAO ( a00 , a01 , a02 , a10 , a12 , a20 , a21 , a22 ) { var s00 = ( a00 & OPAQUE_BIT ) ? 1 : 0 , s01 = ( a01 & OPAQUE_BIT ) ? 1 : 0 , s02 = ( a02 & OPAQUE_BIT ) ? 1 : 0 , s10 = ( a10 & OPAQUE_BIT ) ? 1 : 0 , s12 = ( a12 & OPAQUE_BIT ) ? 1 : 0 , s20 = ( a20 & OPAQUE_BIT ) ? 1 : 0 , s21 = ( a21 & OPAQUE_BIT ) ? 1 : 0 , s22 = ( a22 & OPAQUE_BIT ) ? 1 : 0 return ( vertexAO ( s10 , s01 , s00 ) << AO_SHIFT ) + ( vertexAO ( s01 , s12 , s02 ) << ( AO_SHIFT + AO_BITS ) ) + ( vertexAO ( s12 , s21 , s22 ) << ( AO_SHIFT + 2 * AO_BITS ) ) + ( vertexAO ( s21 , s10 , s20 ) << ( AO_SHIFT + 3 * AO_BITS ) ) }
Calculates the ambient occlusion bit mask for a facet
Calculates the ambient occlusion bit mask for a facet