InstancedBufferAttribute.js 952 B

1234567891011121314151617181920212223242526272829
  1. /**
  2. * @author simonThiele / https://github.com/simonThiele
  3. */
  4. module( "InstancedBufferAttribute" );
  5. test( "can be created", function() {
  6. var instance = new THREE.InstancedBufferAttribute(new Float32Array(10), 2);
  7. ok( instance.meshPerAttribute === 1, "ok" );
  8. instance = new THREE.InstancedBufferAttribute(new Float32Array(10), 2, 123);
  9. ok( instance.meshPerAttribute === 123, "ok" );
  10. });
  11. test( "copy", function() {
  12. var array = new Float32Array( [1, 2, 3, 7, 8, 9] );
  13. var instance = new THREE.InstancedBufferAttribute( array, 2, 123 );
  14. var copiedInstance = instance.copy( instance );
  15. ok( copiedInstance instanceof THREE.InstancedBufferAttribute, "the clone has the correct type" );
  16. ok( copiedInstance.itemSize === 2, "itemSize was copied" );
  17. ok( copiedInstance.meshPerAttribute === 123, "meshPerAttribute was copied" );
  18. for (var i = 0; i < array.length; i++) {
  19. ok( copiedInstance.array[i] === array[i], "array was copied" );
  20. }
  21. });