File size: 862 Bytes
2b7aae2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { BufferAttribute } from './BufferAttribute.js';

class InstancedBufferAttribute extends BufferAttribute {
	constructor(array, itemSize, normalized, meshPerAttribute = 1) {
		if (typeof normalized === 'number') {
			meshPerAttribute = normalized;

			normalized = false;

			console.error('THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.');
		}

		super(array, itemSize, normalized);

		this.meshPerAttribute = meshPerAttribute;
	}

	copy(source) {
		super.copy(source);

		this.meshPerAttribute = source.meshPerAttribute;

		return this;
	}

	toJSON() {
		const data = super.toJSON();

		data.meshPerAttribute = this.meshPerAttribute;

		data.isInstancedBufferAttribute = true;

		return data;
	}
}

InstancedBufferAttribute.prototype.isInstancedBufferAttribute = true;

export { InstancedBufferAttribute };