MCPcopy Create free account
hub / github.com/esengine/esengine / execute

Method execute

packages/procgen/src/nodes/ProcGenNodes.ts:88–110  ·  view source on GitHub ↗
(node: BlueprintNode, context: unknown)

Source from the content-addressed store, hash-verified

86
87export class SampleNoise2DExecutor implements INodeExecutor {
88 execute(node: BlueprintNode, context: unknown): ExecutionResult {
89 const ctx = context as ProcGenContext;
90 const x = ctx.evaluateInput(node.id, 'x', 0) as number;
91 const y = ctx.evaluateInput(node.id, 'y', 0) as number;
92 const seed = ctx.evaluateInput(node.id, 'seed', 0) as number;
93 const noiseType = ctx.evaluateInput(node.id, 'noiseType', 'perlin') as string;
94
95 let value = 0;
96 switch (noiseType.toLowerCase()) {
97 case 'simplex':
98 value = getSimplexNoise(seed).noise2D(x, y);
99 break;
100 case 'worley':
101 value = getWorleyNoise(seed).noise2D(x, y);
102 break;
103 case 'perlin':
104 default:
105 value = getPerlinNoise(seed).noise2D(x, y);
106 break;
107 }
108
109 return { outputs: { value } };
110 }
111}
112
113// =============================================================================

Callers

nothing calls this directly

Calls 5

getSimplexNoiseFunction · 0.85
getWorleyNoiseFunction · 0.85
getPerlinNoiseFunction · 0.85
evaluateInputMethod · 0.65
noise2DMethod · 0.65

Tested by

no test coverage detected