Shader graph: Clamp is the Output's default edge, and the sheet's own mode is a constant of its own (#81)
game-maker / suite (push) Successful in 9m16s
game-maker / suite (push) Successful in 9m16s
The default of the Edge param and the address mode the shared sheet physically
carries were the same constant; changing the value would have turned every
sentinel with it and given each shader sprite a full copy of its texture.
SHEET_EDGE ('mirror', what TextureLibrary uploads) is now separate from
DEFAULT_EDGE ('clamp'). A graph whose Sample reads nothing but its own pixel
draws with the plain sheet whatever the Edge says, so the common shader costs
no second copy.
Without a shader the quad's coordinates never leave 0..1, and mirror-repeat
reads like clamp within a texel - so clamp is what a sprite shows anyway.
This commit is contained in:
1 parent
03c4323794
commit
e0c459ce92
7 files changed
+74
-20
No files matched your search
@@ -614,6 +614,24 @@ export async function shader(t) {
|
||||
colourDistance(mirror.left, RIGHT) < 12 && colourDistance(mirror.right, RIGHT) < 12,
|
||||
mirror,
|
||||
);
|
||||
// u + 0.5 cannot tell Clamp from Mirror: both hold green past the border. u + 0.8 puts the near
|
||||
// half on 1.6, where Mirror is already back in the far half and Clamp still holds the last texel.
|
||||
const scrolledFar = async (outParams) => {
|
||||
await sampleAt(
|
||||
[node('far', 'ShaderAdd', { b: 0.8 }, 260, 0)],
|
||||
[edge('uv', 'u', 'far', 'a'), edge('far', 'result', 'sample', 'u')],
|
||||
outParams,
|
||||
);
|
||||
await sleep(400);
|
||||
return pixel(0.3, -0.3);
|
||||
};
|
||||
const byDefault = await scrolledFar({});
|
||||
const byMirror = await scrolledFar({ edge: 'mirror' });
|
||||
check(
|
||||
'with nothing set on the Output the edge is Clamp: at u + 0.8 the border texel goes on, where Mirror shows the near half again',
|
||||
colourDistance(byDefault, RIGHT) < 12 && colourDistance(byMirror, LEFT) < 12,
|
||||
{ byDefault, byMirror },
|
||||
);
|
||||
await evaluate("__gm.showTab('shader')");
|
||||
await sleep(300);
|
||||
await shot('28-shader-scroll-graph');
|
||||
|
||||
Reference in new issue
Block a user