Skip to content

Commit

Permalink
Making better use of runtime-sized arrays.
Browse files Browse the repository at this point in the history
  • Loading branch information
iwoplaza committed Nov 4, 2024
1 parent 5f59c2c commit b7644d8
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions apps/example/src/ComputeBoids/Shaders.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const triangleAmount = 1000;
const triangleSize = 0.03;

export const renderCode = /* wgsl */ `
Expand Down Expand Up @@ -80,7 +79,7 @@ export const computeCode = /* wgsl */ `
var alignmentCount = 0u;
var cohesion = vec2(0.0, 0.0);
var cohesionCount = 0u;
for (var i = 0u; i < ${triangleAmount}; i = i + 1) {
for (var i = 0u; i < arrayLength(&currentTrianglePos); i = i + 1) {
if (i == index) {
continue;
}
Expand Down

0 comments on commit b7644d8

Please sign in to comment.