Minor fixes
This commit is contained in:
parent
68b24effde
commit
ebabaf6ee5
6 changed files with 21 additions and 21 deletions
|
|
@ -9,10 +9,14 @@ fn main(
|
|||
return;
|
||||
}
|
||||
|
||||
let position = vec2(
|
||||
hash(id) * state.size.x,
|
||||
hash(id * id) * state.size.y,
|
||||
let random = textureSampleLevel(
|
||||
noise,
|
||||
noiseSampler,
|
||||
vec2(f32(id % 1999) / 2000, f32(id) / 1999 / 2000),
|
||||
0
|
||||
);
|
||||
|
||||
let position = random.xy * state.size;
|
||||
let center = state.size / 2.0;
|
||||
let direction = position - center;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { getWorkgroupCounts } from '../../../utils/graphics/get-workgroup-counts';
|
||||
import random from '../../../utils/graphics/random.wgsl';
|
||||
import { smartCompile } from '../../../utils/graphics/smart-compile';
|
||||
import { CommonState } from '../../common-state/common-state';
|
||||
import { AGENT_SIZE_IN_BYTES } from './agent';
|
||||
|
|
@ -107,7 +106,6 @@ export class AgentGenerationPipeline {
|
|||
module: smartCompile(
|
||||
device,
|
||||
CommonState.shaderCode,
|
||||
random,
|
||||
agentSchema,
|
||||
firstGenerationShader
|
||||
),
|
||||
|
|
@ -120,13 +118,7 @@ export class AgentGenerationPipeline {
|
|||
bindGroupLayouts: [commonState.bindGroupLayout, this.bindGroupLayout],
|
||||
}),
|
||||
compute: {
|
||||
module: smartCompile(
|
||||
device,
|
||||
CommonState.shaderCode,
|
||||
random,
|
||||
agentSchema,
|
||||
countingShader
|
||||
),
|
||||
module: smartCompile(device, CommonState.shaderCode, agentSchema, countingShader),
|
||||
entryPoint: 'main',
|
||||
},
|
||||
});
|
||||
|
|
@ -135,7 +127,7 @@ export class AgentGenerationPipeline {
|
|||
public get maxAgentCount(): number {
|
||||
return Math.min(
|
||||
this.maxAgentCountUpperLimit,
|
||||
Math.floor(this.device.limits.maxBufferSize / AGENT_SIZE_IN_BYTES),
|
||||
Math.floor(this.device.limits.maxBufferSize / AGENT_SIZE_IN_BYTES) - 1,
|
||||
this.device.limits.maxComputeWorkgroupsPerDimension ** 3
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { getWorkgroupCounts } from '../../utils/graphics/get-workgroup-counts';
|
||||
import random from '../../utils/graphics/random.wgsl';
|
||||
import { smartCompile } from '../../utils/graphics/smart-compile';
|
||||
import { CommonState } from '../common-state/common-state';
|
||||
import agentSchme from './agent-generation/agent-schema.wgsl';
|
||||
|
|
@ -33,7 +32,7 @@ export class AgentPipeline {
|
|||
bindGroupLayouts: [commonState.bindGroupLayout, this.bindGroupLayout],
|
||||
}),
|
||||
compute: {
|
||||
module: smartCompile(device, CommonState.shaderCode, random, agentSchme, shader),
|
||||
module: smartCompile(device, CommonState.shaderCode, agentSchme, shader),
|
||||
entryPoint: 'main',
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
struct Settings {
|
||||
brushTrailWeight: f32,
|
||||
moveRate: f32,
|
||||
|
||||
turnRate: f32,
|
||||
|
||||
sensorAngle: f32,
|
||||
|
||||
sensorOffset: f32,
|
||||
evenGenerationAggression: f32,
|
||||
|
||||
evenGenerationAggression: f32,
|
||||
oddGenerationAggression: f32,
|
||||
nextGenerationId: f32,
|
||||
|
||||
|
|
@ -62,7 +61,13 @@ fn main(
|
|||
return;
|
||||
}
|
||||
|
||||
let random = hash(id + u32(state.time % 107 * 1673.7));
|
||||
let random = textureSampleLevel(
|
||||
noise,
|
||||
noiseSampler,
|
||||
vec2(f32(id) % 23647 / 2000,
|
||||
state.time % 6294 / 2000),
|
||||
0
|
||||
).a;
|
||||
|
||||
let isFromEvenGeneration = agent.generation % 2 == 0;
|
||||
let isFromNextGeneration = agent.generation == settings.nextGenerationId;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { generateNoise } from '../../utils/graphics/noise/noise';
|
||||
import { generateNoise } from '../../utils/graphics/noise';
|
||||
|
||||
import { vec2 } from 'gl-matrix';
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue