Ejemplo n.º 1
0
test('update rotation', function (t) {
  var result = shape(gl, {complex: bunny, position: [0, 0, 0]})
  allclose(t)(result.attributes.model, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])
  result.rotation(Math.PI, [0, 0, 1])
  allclose(t)(result.attributes.model, [-1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])
  t.end()
})
Ejemplo n.º 2
0
test('construction', function (t) {
  var result = shape(gl, {complex: bunny, position: [0, 0, 0]})
  t.ok(result.attributes.geometry, 'geometry defined')
  allclose(t)(result.attributes.model, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])
  allclose(t)(result.attributes.modelNormal, [1, 0, 0, 0, 1, 0, 0, 0, 1])
  t.end()
})
Ejemplo n.º 3
0
test('update scale', function (t) {
  var result = shape(gl, {complex: bunny, position: [0, 0, 0]})
  allclose(t)(result.attributes.model, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])
  result.scale([1, 2, 3])
  allclose(t)(result.attributes.model, [1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1])
  t.end()
})
Ejemplo n.º 4
0
test('all', function (t) {
  var result = shape(gl, {complex: bunny, position: [1, 2, 3], scale: [1, 2, 3], rotation: {theta: Math.PI, axis: [0, 0, 1]}})
  allclose(t)(result.attributes.model, [-1, 0, 0, 0, 0, -2, 0, 0, 0, 0, 3, 0, 1, 2, 3, 1])
  t.end()
})
Ejemplo n.º 5
0
test('rotation', function (t) {
  var result = shape(gl, {complex: bunny, rotation: {theta: Math.PI, axis: [0, 0, 1]}})
  allclose(t)(result.attributes.model, [-1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])
  t.end()
})
Ejemplo n.º 6
0
test('scale', function (t) {
  var result = shape(gl, {complex: bunny, scale: [1, 2, 3]})
  allclose(t)(result.attributes.model, [1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1])
  t.end()
})
Ejemplo n.º 7
0
test('position', function (t) {
  var result = shape(gl, {complex: bunny, position: [1, 2, 3]})
  allclose(t)(result.attributes.model, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 2, 3, 1])
  t.end()
})