|
@@ -30,6 +30,7 @@
|
|
|
|
|
|
import WebGPUStorageBuffer from './jsm/renderers/webgpu/WebGPUStorageBuffer.js';
|
|
import WebGPUStorageBuffer from './jsm/renderers/webgpu/WebGPUStorageBuffer.js';
|
|
import WebGPUUniformBuffer from './jsm/renderers/webgpu/WebGPUUniformBuffer.js';
|
|
import WebGPUUniformBuffer from './jsm/renderers/webgpu/WebGPUUniformBuffer.js';
|
|
|
|
+ import * as WebGPUBufferUtils from './jsm/renderers/webgpu/WebGPUBufferUtils.js';
|
|
import WebGPUUniformsGroup from './jsm/renderers/webgpu/WebGPUUniformsGroup.js';
|
|
import WebGPUUniformsGroup from './jsm/renderers/webgpu/WebGPUUniformsGroup.js';
|
|
import { Vector2Uniform } from './jsm/renderers/webgpu/WebGPUUniform.js';
|
|
import { Vector2Uniform } from './jsm/renderers/webgpu/WebGPUUniform.js';
|
|
|
|
|
|
@@ -80,7 +81,9 @@
|
|
const particleBuffer = new WebGPUStorageBuffer( 'particle', new THREE.BufferAttribute( particleArray, 3 ) );
|
|
const particleBuffer = new WebGPUStorageBuffer( 'particle', new THREE.BufferAttribute( particleArray, 3 ) );
|
|
const velocityBuffer = new WebGPUStorageBuffer( 'velocity', new THREE.BufferAttribute( velocityArray, 3 ) );
|
|
const velocityBuffer = new WebGPUStorageBuffer( 'velocity', new THREE.BufferAttribute( velocityArray, 3 ) );
|
|
|
|
|
|
- scaleUniformBuffer = new WebGPUUniformBuffer( 'scaleUniform', new Float32Array( 3 ) ); // single vector3
|
|
|
|
|
|
+ const scaleUniformLength = WebGPUBufferUtils.getVectorLength( 2, 3 ); // two vector3 for array
|
|
|
|
+
|
|
|
|
+ scaleUniformBuffer = new WebGPUUniformBuffer( 'scaleUniform', new Float32Array( scaleUniformLength ) );
|
|
|
|
|
|
pointer = new THREE.Vector2( - 10.0, - 10.0 ); // Out of bounds first
|
|
pointer = new THREE.Vector2( - 10.0, - 10.0 ); // Out of bounds first
|
|
|
|
|
|
@@ -114,7 +117,7 @@
|
|
} velocity;
|
|
} velocity;
|
|
|
|
|
|
layout(set = 0, binding = 2) uniform Scale {
|
|
layout(set = 0, binding = 2) uniform Scale {
|
|
- vec3 value;
|
|
|
|
|
|
+ vec3 value[2];
|
|
} scaleUniform;
|
|
} scaleUniform;
|
|
|
|
|
|
layout(set = 0, binding = 3) uniform MouseUniforms {
|
|
layout(set = 0, binding = 3) uniform MouseUniforms {
|
|
@@ -161,9 +164,9 @@
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- particle.particle[ index * 3 + 0 ] = position.x * scaleUniform.value.x;
|
|
|
|
- particle.particle[ index * 3 + 1 ] = position.y * scaleUniform.value.y;
|
|
|
|
- particle.particle[ index * 3 + 2 ] = position.z * scaleUniform.value.z;
|
|
|
|
|
|
+ particle.particle[ index * 3 + 0 ] = position.x * scaleUniform.value[0].x;
|
|
|
|
+ particle.particle[ index * 3 + 1 ] = position.y * scaleUniform.value[0].y;
|
|
|
|
+ particle.particle[ index * 3 + 2 ] = position.z * scaleUniform.value[0].z;
|
|
|
|
|
|
}
|
|
}
|
|
`;
|
|
`;
|