Add cancer

This commit is contained in:
Andras Schmelczer 2023-05-21 13:51:09 +01:00
commit 3414f38c3a
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
14 changed files with 246 additions and 149 deletions

View file

@ -8,7 +8,7 @@ import shader from './agent.wgsl';
export class AgentPipeline {
private static readonly WORKGROUP_SIZE = 64;
private static readonly UNIFORM_COUNT = 6;
private static readonly UNIFORM_COUNT = 8;
private readonly bindGroupLayout: GPUBindGroupLayout;
private readonly pipeline: GPUComputePipeline;
@ -47,8 +47,14 @@ export class AgentPipeline {
turnSpeed,
sensorOffsetAngle,
sensorOffsetDistance,
nextGenerationAggression,
}: AgentSettings & { nextGenerationAggression: number }) {
evenGenerationAggression,
oddGenerationAggression,
nextGenerationId,
}: AgentSettings & {
evenGenerationAggression: number;
oddGenerationAggression: number;
nextGenerationId: number;
}) {
this.device.queue.writeBuffer(
this.uniforms,
0,
@ -58,7 +64,9 @@ export class AgentPipeline {
turnSpeed,
(sensorOffsetAngle * Math.PI) / 180,
sensorOffsetDistance,
nextGenerationAggression,
evenGenerationAggression,
oddGenerationAggression,
nextGenerationId,
])
);
}