12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- /**
- * @author benaadams / https://twitter.com/ben_a_adams
- */
- THREE.InstancedBufferGeometry = function () {
- THREE.BufferGeometry.call( this );
- this.type = 'InstancedBufferGeometry';
- this.maxInstancedCount = undefined;
- };
- THREE.InstancedBufferGeometry.prototype = Object.create( THREE.BufferGeometry.prototype );
- THREE.InstancedBufferGeometry.prototype.constructor = THREE.InstancedBufferGeometry;
- THREE.InstancedBufferGeometry.prototype.addGroup = function ( start, count, instances ) {
- this.groups.push( {
- start: start,
- count: count,
- instances: instances
- } );
- };
- THREE.InstancedBufferGeometry.prototype.copy = function ( source ) {
- var index = source.index;
- if ( index !== null ) {
- this.setIndex( index.clone() );
- }
- var attributes = source.attributes;
- for ( var name in attributes ) {
- var attribute = attributes[ name ];
- this.addAttribute( name, attribute.clone() );
- }
- var groups = source.groups;
- for ( var i = 0, l = groups.length; i < l; i ++ ) {
- var group = groups[ i ];
- this.addGroup( group.start, group.count, group.instances );
- }
- return this;
- };
- THREE.EventDispatcher.prototype.apply( THREE.InstancedBufferGeometry.prototype );
|