Shader graph: Abs node, the distance from 0 per channel
game-maker / suite (push) Failing after 8m10s
game-maker / suite (push) Failing after 8m10s
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
a399795772
commit
28c0789b19
4 files changed
+59
-1
No files matched your search
@@ -470,6 +470,27 @@ describe('compileShader', () => {
|
||||
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\)\);/);
|
||||
});
|
||||
|
||||
it('writes Abs as the GLSL call, per channel for a colour', () => {
|
||||
const f = makeProject();
|
||||
const s = shaderEditor(f, 'Fold');
|
||||
const uv = s.add(SHADER_UV);
|
||||
const centred = s.add('ShaderSubtract', { b: 0.5 });
|
||||
const folded = s.add('ShaderAbs');
|
||||
const tint = s.add('ShaderColor', { value: 0xff8000 });
|
||||
const magnitude = s.add('ShaderAbs');
|
||||
const output = s.add(SHADER_OUTPUT);
|
||||
s.link(uv, 'u', centred, 'a');
|
||||
s.link(centred, 'result', folded, 'value');
|
||||
s.link(folded, 'result', output, 'alpha');
|
||||
s.link(tint, 'color', magnitude, 'value');
|
||||
s.link(magnitude, 'result', output, 'color');
|
||||
const build = compileShader(s.asset().graph);
|
||||
expect(build.problems).toEqual({});
|
||||
const { fragment } = build.compiled!;
|
||||
expect(fragment).toMatch(/float n\d+_result = abs\(n\d+_result\);/);
|
||||
expect(fragment).toMatch(/vec3 n\d+_result = abs\(n\d+_color\);/);
|
||||
});
|
||||
});
|
||||
|
||||
describe('a sprite wearing a shader', () => {
|
||||
|
||||
Reference in new issue
Block a user