Shader graph: Pow node, base held at 0, exponent broadcast for colours (#80)
game-maker / suite (push) Failing after 8m13s
game-maker / suite (push) Failing after 8m13s
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
102a649a35
commit
a399795772
4 files changed
+70
-1
No files matched your search
@@ -451,6 +451,25 @@ describe('compileShader', () => {
|
||||
expect(fragment).toMatch(/vec3 n\d+_result = floor\(n\d+_color\);/);
|
||||
expect(fragment).toMatch(/float alpha = clamp\(n\d+_result, 0\.0, 1\.0\);/);
|
||||
});
|
||||
|
||||
it('writes Pow as the GLSL call with the base held at 0, the exponent broadcast for a colour', () => {
|
||||
const f = makeProject();
|
||||
const s = shaderEditor(f, 'Gamma');
|
||||
const uv = s.add(SHADER_UV);
|
||||
const eased = s.add('ShaderPow', { exponent: 2 });
|
||||
const tint = s.add('ShaderColor', { value: 0xff8000 });
|
||||
const gamma = s.add('ShaderPow', { exponent: 2.2 });
|
||||
const output = s.add(SHADER_OUTPUT);
|
||||
s.link(uv, 'u', eased, 'value');
|
||||
s.link(eased, 'result', output, 'alpha');
|
||||
s.link(tint, 'color', gamma, 'value');
|
||||
s.link(gamma, 'result', output, 'color');
|
||||
const build = compileShader(s.asset().graph);
|
||||
expect(build.problems).toEqual({});
|
||||
const { fragment } = build.compiled!;
|
||||
expect(fragment).toMatch(/float n\d+_result = pow\(max\(n\d+_u, 0\.0\), 2\.0\);/);
|
||||
expect(fragment).toMatch(/vec3 n\d+_result = pow\(max\(n\d+_color, 0\.0\), vec3\(2\.2\)\);/);
|
||||
});
|
||||
});
|
||||
|
||||
describe('a sprite wearing a shader', () => {
|
||||
|
||||
Reference in new issue
Block a user