example/stencil-transition.js
function centerMesh (mesh) {
  var bb = boundingBox(mesh.positions)

  var _translate = [
    -0.5 * (bb[0][0] + bb[1][0]),
    -0.5 * (bb[0][1] + bb[1][1]),
    -0.5 * (bb[0][2] + bb[1][2])
  ]
  var translate = mat4.create()
  mat4.translate(translate, translate, _translate)
  mesh.positions = tform(mesh.positions, translate)
}
function centerMesh (mesh) {
  var bb = boundingBox(mesh.positions)

  var _translate = [
    -0.5 * (bb[0][0] + bb[1][0]),
    -0.5 * (bb[0][1] + bb[1][1]),
    -0.5 * (bb[0][2] + bb[1][2])
  ]
  var translate = mat4.create()
  mat4.translate(translate, translate, _translate)
  mesh.positions = tform(mesh.positions, translate)
}
function centerMesh ( mesh ) { var bb = boundingBox ( mesh . positions ) var _translate = [ - 0.5 * ( bb [ 0 ] [ 0 ] + bb [ 1 ] [ 0 ] ) , - 0.5 * ( bb [ 0 ] [ 1 ] + bb [ 1 ] [ 1 ] ) , - 0.5 * ( bb [ 0 ] [ 2 ] + bb [ 1 ] [ 2 ] ) ] var translate = mat4 . create ( ) mat4 . translate ( translate , translate , _translate ) mesh . positions = tform ( mesh . positions , translate ) }
center the rabbit mesh to the origin.
center the rabbit mesh to the origin .