Skip to content

DO NOT MERGE: Make Firefox work by whatever means necessary #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 30 additions & 30 deletions docs/assets/index-BeB41sTJ.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/app/shaders/BlitShader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const BLIT_FRAGMENT_SHADER_SRC = /* wgsl */ `
@group(0) @binding(3) var<uniform> time: f32;
@group(0) @binding(4) var<uniform> revealFactor: f32;

@must_use

fn ACESFilm(x: vec3f) -> vec3f {
let v = x;
let a = 2.51f;
Expand Down
4 changes: 2 additions & 2 deletions src/app/shaders/PointLightsRenderShader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const PARTICLES_RENDER_SHADER_SRC = /* wgsl */ `
if (mask < 0.2) {
discard;
}
let lightColor = light.color;
return vec4f(light.color * mask * 0.8, 1);
let lightColor = (*light).color;
return vec4f((*light).color * mask * 0.8, 1);
}
`
44 changes: 22 additions & 22 deletions src/app/shaders/PointLightsUpdateShader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ export const POINT_LIGHTS_UPDATE_SHADER_SRC = /* wgsl */ `
override CURVE_PARTICLES_COUNT: u32;
override CURVE_POSITIONS_COUNT: u32;

@must_use

fn noise(p: vec3f) -> f32 {
return fract(
sin(dot(p, vec3f(12.9898, 78.233, 45.164))) * 43758.5453
);
}

@must_use

fn random(seed: f32) -> f32 {
return fract(sin(seed * 12.9898) * 43758.5453);
}
Expand Down Expand Up @@ -72,41 +72,41 @@ export const POINT_LIGHTS_UPDATE_SHADER_SRC = /* wgsl */ `
let particle = &particles[idx];
let light = &lights[idx + ANIMATED_PARTICLES_OFFSET_START];

particle.life += particle.lifeSpeed * simSettings.timeDelta;
(*particle).life += (*particle).lifeSpeed * simSettings.timeDelta;

if (particle.life >= 1) {
particle.position = particle.origPosition;
particle.life = 0;
if ((*particle).life >= 1) {
(*particle).position = (*particle).origPosition;
(*particle).life = 0;
}

if (idx >= FIREWORK_PARTICLES_OFFSET && idx < FIREWORK_PARTICLES_COUNT) {
let turbulence = curlNoise(
particle.position * 0.05 +
(*particle).position * 0.05 +
vec3<f32>(0.0, simSettings.time * 0.05, 0.0)
) * 0.2;
particle.position += (particle.velocity + turbulence) * simSettings.timeDelta;
light.intensity = saturate((1 - particle.life) * fireParticlesRevealFactor);
particle.radius = 0.025 * fireParticlesRevealFactor;
// light.radius *= fireParticlesRevealFactor;
// light.intensity *= fireParticlesRevealFactor;
(*particle).position += ((*particle).velocity + turbulence) * simSettings.timeDelta;
(*light).intensity = saturate((1 - (*particle).life) * fireParticlesRevealFactor);
(*particle).radius = 0.025 * fireParticlesRevealFactor;
// (*light).radius *= fireParticlesRevealFactor;
// (*light).intensity *= fireParticlesRevealFactor;
}

if (idx >= CURVE_PARTICLES_OFFSET && idx < CURVE_PARTICLES_OFFSET + CURVE_PARTICLES_COUNT) {
particle.position = interpolateLinePoint(particle.life) + particle.velocity;
(*particle).position = interpolateLinePoint((*particle).life) + (*particle).velocity;
}

if (idx >= CURVE_PARTICLES_OFFSET + CURVE_PARTICLES_COUNT) {
particle.position = vec3f(
particle.life * 15 - 7.5,
cos(particle.life + particle.life * particle.velocity.y * 30) * 1.2 + 3.5,
sin(particle.life + particle.life * particle.velocity.y * 30) * 1.075 + particle.velocity.x
(*particle).position = vec3f(
(*particle).life * 15 - 7.5,
cos((*particle).life + (*particle).life * (*particle).velocity.y * 30) * 1.2 + 3.5,
sin((*particle).life + (*particle).life * (*particle).velocity.y * 30) * 1.075 + (*particle).velocity.x
);
let fadeIn = smoothstep(0.0, 0.1, particle.life);
let fadeOut = 1.0 - smoothstep(0.9, 1.0, particle.life);
light.intensity = 0.5 * fadeIn * fadeOut;
light.radius = 1 * fadeIn * fadeOut;
let fadeIn = smoothstep(0.0, 0.1, (*particle).life);
let fadeOut = 1.0 - smoothstep(0.9, 1.0, (*particle).life);
(*light).intensity = 0.5 * fadeIn * fadeOut;
(*light).radius = 1 * fadeIn * fadeOut;
}
light.position = particle.position;
(*light).position = (*particle).position;

}
`
24 changes: 12 additions & 12 deletions src/app/shaders/ReflectionShader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ export const getReflectionComputeShader = (
vReflectionDir.z
);

(*outMaxDistance) = select(-outSamplePosInTexSpace.x / outReflDirInTexSpace.x, (1 - outSamplePosInTexSpace.x) / outReflDirInTexSpace.x, outReflDirInTexSpace.x >= 0);
(*outMaxDistance) = min(*outMaxDistance, select((1 - outSamplePosInTexSpace.y) / outReflDirInTexSpace.y, -outSamplePosInTexSpace.y / outReflDirInTexSpace.y, outReflDirInTexSpace.y < 0));
(*outMaxDistance) = min(*outMaxDistance, select((1 - outSamplePosInTexSpace.z) / outReflDirInTexSpace.z, -outSamplePosInTexSpace.z / outReflDirInTexSpace.z, outReflDirInTexSpace.z < 0));
(*outMaxDistance) = select(-(*outSamplePosInTexSpace).x / (*outReflDirInTexSpace).x, (1 - (*outSamplePosInTexSpace).x) / (*outReflDirInTexSpace).x, (*outReflDirInTexSpace).x >= 0);
(*outMaxDistance) = min(*outMaxDistance, select((1 - (*outSamplePosInTexSpace).y) / (*outReflDirInTexSpace).y, -(*outSamplePosInTexSpace).y / (*outReflDirInTexSpace).y, (*outReflDirInTexSpace).y < 0));
(*outMaxDistance) = min(*outMaxDistance, select((1 - (*outSamplePosInTexSpace).z) / (*outReflDirInTexSpace).z, -(*outSamplePosInTexSpace).z / (*outReflDirInTexSpace).z, (*outReflDirInTexSpace).z < 0));
}

@must_use

fn FindIntersectionLinear(
samplePosInTexSpace: vec3f,
reflDirInTexSpace: vec3f,
Expand Down Expand Up @@ -139,22 +139,22 @@ export const getReflectionComputeShader = (
return select(0.0, 1.0, intersected);
}

@must_use

fn getCellCount(mipLevel: i32, depthTexture: texture_2d<f32>) -> vec2f {
return vec2f(textureDimensions(depthTexture, mipLevel));
}

@must_use

fn getCell(pos: vec2f, cell_count: vec2f) -> vec2f {
return vec2f(floor(pos * cell_count));
}

@must_use

fn intersectDepthPlane(o: vec3f, d: vec3f, z: f32) -> vec3f {
return o + d * z;
}

@must_use

fn intersectCellBoundary(
o: vec3f,
d: vec3f,
Expand All @@ -178,7 +178,7 @@ export const getReflectionComputeShader = (
return intersection;
}

@must_use

fn getMinimumDepthPlane(
p: vec2f,
mipLevel: i32,
Expand All @@ -187,12 +187,12 @@ export const getReflectionComputeShader = (
return textureLoad(depthTexture, vec2u(p), mipLevel).r;
}

@must_use

fn crossedCellBoundary(oldCellIndex: vec2f, newCellIndex: vec2f) -> bool {
return (oldCellIndex.x != newCellIndex.x) || (oldCellIndex.y != newCellIndex.y);
}

@must_use

fn FindIntersectionHiZ(
samplePosInTexSpace: vec3f,
reflDirInTexSpace: vec3f,
Expand Down Expand Up @@ -277,7 +277,7 @@ export const getReflectionComputeShader = (
return intensity;
}

@must_use

fn ComputeReflectionColor(
intensity: f32,
intersection: vec3f,
Expand Down
Loading