@@ -77,15 +77,11 @@ describe('3d fish example', () => {
7777 fish_data_1[x] = data;
7878 }
7979
80- struct mainCompute_Input {
81- @builtin(global_invocation_id) id: vec3u,
82- }
83-
84- @compute @workgroup_size(256, 1, 1) fn mainCompute(in: mainCompute_Input) {
85- if (any(in.id >= sizeUniform)) {
80+ @compute @workgroup_size(256, 1, 1) fn mainCompute(@builtin(global_invocation_id) id: vec3u) {
81+ if (any(id >= sizeUniform)) {
8682 return;
8783 }
88- wrappedCallback(in. id.x, in. id.y, in. id.z);
84+ wrappedCallback(id.x, id.y, id.z);
8985 }
9086
9187 @group(0) @binding(0) var<uniform> sizeUniform: vec3u;
@@ -229,15 +225,11 @@ describe('3d fish example', () => {
229225 (*nextFishData_1).direction = direction;
230226 }
231227
232- struct mainCompute_Input {
233- @builtin(global_invocation_id) id: vec3u,
234- }
235-
236- @compute @workgroup_size(256, 1, 1) fn mainCompute(in: mainCompute_Input) {
237- if (any(in.id >= sizeUniform)) {
228+ @compute @workgroup_size(256, 1, 1) fn mainCompute(@builtin(global_invocation_id) id: vec3u) {
229+ if (any(id >= sizeUniform)) {
238230 return;
239231 }
240- simulate(in. id.x, in. id.y, in. id.z);
232+ simulate(id.x, id.y, id.z);
241233 }
242234
243235 struct ModelData {
@@ -293,18 +285,11 @@ describe('3d fish example', () => {
293285 @location(5) @interpolate(flat) applySeaDesaturation: u32,
294286 }
295287
296- struct vertexShader_Input {
297- @location(0) modelPosition: vec3f,
298- @location(1) modelNormal: vec3f,
299- @location(2) textureUV: vec2f,
300- @builtin(instance_index) instanceIndex: u32,
301- }
302-
303- @vertex fn vertexShader(input: vertexShader_Input) -> vertexShader_Output {
304- let currentModelData = (&modelData[input.instanceIndex]);
305- var wavedVertex = PosAndNormal(input.modelPosition, input.modelNormal);
288+ @vertex fn vertexShader(@location(0) _arg_modelPosition: vec3f, @location(1) _arg_modelNormal: vec3f, @location(2) _arg_textureUV: vec2f, @builtin(instance_index) _arg_instanceIndex: u32) -> vertexShader_Output {
289+ let currentModelData = (&modelData[_arg_instanceIndex]);
290+ var wavedVertex = PosAndNormal(_arg_modelPosition, _arg_modelNormal);
306291 if (((*currentModelData).applySinWave == 1u)) {
307- wavedVertex = applySinWave(input.instanceIndex , PosAndNormal(input.modelPosition, input.modelNormal ), currentTime);
292+ wavedVertex = applySinWave(_arg_instanceIndex , PosAndNormal(_arg_modelPosition, _arg_modelNormal ), currentTime);
308293 }
309294 var direction = normalize((*currentModelData).direction);
310295 let yaw = (-(atan2(direction.z, direction.x)) + 3.141592653589793f);
@@ -317,7 +302,16 @@ describe('3d fish example', () => {
317302 var worldNormal = normalize(((yawMatrix * pitchMatrix) * vec4f(wavedVertex.normal, 1f)).xyz);
318303 let worldPositionUniform = (&worldPosition);
319304 var canvasPosition = ((camera.projection * camera.view) * (*worldPositionUniform));
320- return vertexShader_Output(worldPosition.xyz, worldNormal, canvasPosition, (*currentModelData).variant, input.textureUV, (*currentModelData).applySeaFog, (*currentModelData).applySeaDesaturation);
305+ return vertexShader_Output(worldPosition.xyz, worldNormal, canvasPosition, (*currentModelData).variant, _arg_textureUV, (*currentModelData).applySeaFog, (*currentModelData).applySeaDesaturation);
306+ }
307+
308+ struct fragmentShader_Input {
309+ @location(0) worldPosition: vec3f,
310+ @location(1) worldNormal: vec3f,
311+ @location(2) variant: f32,
312+ @location(3) textureUV: vec2f,
313+ @location(4) @interpolate(flat) applySeaFog: u32,
314+ @location(5) @interpolate(flat) applySeaDesaturation: u32,
321315 }
322316
323317 @group(0) @binding(1) var modelTexture: texture_2d<f32>;
@@ -424,39 +418,29 @@ describe('3d fish example', () => {
424418 return vec3f(r, g, b);
425419 }
426420
427- struct fragmentShader_Input {
428- @location(0) worldPosition: vec3f,
429- @location(1) worldNormal: vec3f,
430- @builtin(position) canvasPosition: vec4f,
431- @location(2) variant: f32,
432- @location(3) textureUV: vec2f,
433- @location(4) @interpolate(flat) applySeaFog: u32,
434- @location(5) @interpolate(flat) applySeaDesaturation: u32,
435- }
436-
437- @fragment fn fragmentShader(input: fragmentShader_Input) -> @location(0) vec4f {
438- var textureColorWithAlpha = textureSample(modelTexture, sampler_1, input.textureUV);
421+ @fragment fn fragmentShader(_arg_0: fragmentShader_Input) -> @location(0) vec4f {
422+ var textureColorWithAlpha = textureSample(modelTexture, sampler_1, _arg_0.textureUV);
439423 var textureColor = textureColorWithAlpha.rgb;
440424 var ambient = ((0.5f * textureColor) * vec3f(0.800000011920929, 0.800000011920929, 1));
441- let cosTheta = dot(input .worldNormal, vec3f(-0.2357022613286972, 0.9428090453147888, -0.2357022613286972));
425+ let cosTheta = dot(_arg_0 .worldNormal, vec3f(-0.2357022613286972, 0.9428090453147888, -0.2357022613286972));
442426 var diffuse = ((max(0f, cosTheta) * textureColor) * vec3f(0.800000011920929, 0.800000011920929, 1));
443- var viewSource = normalize((camera.position.xyz - input .worldPosition));
444- var reflectSource = normalize(reflect(vec3f(0.2357022613286972, -0.9428090453147888, 0.2357022613286972), input .worldNormal));
427+ var viewSource = normalize((camera.position.xyz - _arg_0 .worldPosition));
428+ var reflectSource = normalize(reflect(vec3f(0.2357022613286972, -0.9428090453147888, 0.2357022613286972), _arg_0 .worldNormal));
445429 let specularStrength = pow(max(0f, dot(viewSource, reflectSource)), 16f);
446430 var specular = (specularStrength * vec3f(0.800000011920929, 0.800000011920929, 1));
447431 var lightedColor = ((ambient + diffuse) + specular);
448- let distanceFromCamera = length((camera.position.xyz - input .worldPosition));
432+ let distanceFromCamera = length((camera.position.xyz - _arg_0 .worldPosition));
449433 var desaturatedColor = lightedColor;
450- if ((input .applySeaDesaturation == 1u)) {
434+ if ((_arg_0 .applySeaDesaturation == 1u)) {
451435 let desaturationFactor = (-(atan2(((distanceFromCamera - 5f) / 10f), 1f)) / 3f);
452436 var hsv = rgbToHsv(desaturatedColor);
453437 hsv.y += (desaturationFactor / 2f);
454438 hsv.z += desaturationFactor;
455- hsv.x += ((input .variant - 0.5f) * 0.2f);
439+ hsv.x += ((_arg_0 .variant - 0.5f) * 0.2f);
456440 desaturatedColor = hsvToRgb(hsv);
457441 }
458442 var foggedColor = desaturatedColor;
459- if ((input .applySeaFog == 1u)) {
443+ if ((_arg_0 .applySeaFog == 1u)) {
460444 let fogParameter = max(0f, ((distanceFromCamera - 1.5f) * 0.2f));
461445 let fogFactor = (fogParameter / (1f + fogParameter));
462446 foggedColor = mix(foggedColor, vec3f(0, 0.47843137383461, 0.800000011920929), fogFactor);
0 commit comments