Skip to content

Commit

Permalink
feat(model): add mod + mod combiner to fragment shader
Browse files Browse the repository at this point in the history
  • Loading branch information
fallenoak committed Jan 22, 2024
1 parent 664ab41 commit 714dda3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib/model/shader/fragment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ void combineOpaqueMod2x(inout vec4 color, in vec4 tex0, in vec4 tex1) {
void combineOpaqueMod2xNa(inout vec4 color, in vec4 tex0, in vec4 tex1) {
color.rgb = (color.rgb * tex0.rgb) * tex1.rgb * 2.0;
}
void combineModMod(inout vec4 color, in vec4 tex0, in vec4 tex1) {
color.rgb = (color.rgb * tex0.rgb) * tex1.rgb;
color.a = (color.a * tex0.a) * tex1.a;
}
`;

const FRAGMENT_SHADER_MAIN_ALPHATEST = `
Expand Down Expand Up @@ -175,6 +180,7 @@ const FRAGMENT_SHADER = {
[M2_FRAGMENT_SHADER.FRAGMENT_OPAQUE_MOD2XNA]: createFragmentShader(2, 'combineOpaqueMod2xNa'),
[M2_FRAGMENT_SHADER.FRAGMENT_OPAQUE_ADDNA]: createFragmentShader(2, 'combineOpaqueAddNa'),
[M2_FRAGMENT_SHADER.FRAGMENT_OPAQUE_MOD]: createFragmentShader(2, 'combineOpaqueMod'),
[M2_FRAGMENT_SHADER.FRAGMENT_MOD_MOD]: createFragmentShader(2, 'combineModMod'),
[M2_FRAGMENT_SHADER.FRAGMENT_UNKNOWN]: createFragmentShader(0, ''),
};

Expand Down

0 comments on commit 714dda3

Please sign in to comment.