🔧 Pass testMode flag to shaders
This commit is contained in:
+16
-16
@@ -46,23 +46,23 @@ var Doom = class {
|
||||
shader._uPixelSize = shader.get_uniform_location('uPixelSize');
|
||||
|
||||
// Write all uniform values at the start of each animation.
|
||||
shader.connect('begin-animation', (shader, settings, forOpening, actor) => {
|
||||
// For this effect, we scale the actor vertically so that it covers the entire
|
||||
// screen. This ensures that the melted window will not be cut off.
|
||||
let actorScale = 2.0 * Math.max(1.0, global.stage.height / actor.height);
|
||||
shader.connect(
|
||||
'begin-animation', (shader, settings, forOpening, testMode, actor) => {
|
||||
// For this effect, we scale the actor vertically so that it covers the entire
|
||||
// screen. This ensures that the melted window will not be cut off.
|
||||
let actorScale = 2.0 * Math.max(1.0, global.stage.height / actor.height);
|
||||
|
||||
// If we are currently performing integration test, nothing will be visible in the
|
||||
// test images as the animation has passed the center of the window already. To
|
||||
// fix this, we set the actor scale to a fixed low value when performing tests.
|
||||
const testMode = settings.get_boolean('test-mode');
|
||||
|
||||
// clang-format off
|
||||
shader.set_uniform_float(shader._uActorScale, 1, [testMode ? 1.0 : actorScale]);
|
||||
shader.set_uniform_float(shader._uHorizontalScale, 1, [testMode ? 50.0 :settings.get_double('doom-horizontal-scale')]);
|
||||
shader.set_uniform_float(shader._uVerticalScale, 1, [testMode ? 150.0 : settings.get_double('doom-vertical-scale')]);
|
||||
shader.set_uniform_float(shader._uPixelSize, 1, [settings.get_int('doom-pixel-size')]);
|
||||
// clang-format on
|
||||
});
|
||||
// If we are currently performing integration test, nothing will be visible in
|
||||
// the test images as the animation has passed the center of the window already.
|
||||
// To fix this, we set the actor scale to a fixed low value when performing
|
||||
// tests.
|
||||
// clang-format off
|
||||
shader.set_uniform_float(shader._uActorScale, 1, [testMode ? 1.0 : actorScale]);
|
||||
shader.set_uniform_float(shader._uHorizontalScale, 1, [testMode ? 50.0 :settings.get_double('doom-horizontal-scale')]);
|
||||
shader.set_uniform_float(shader._uVerticalScale, 1, [testMode ? 150.0 : settings.get_double('doom-vertical-scale')]);
|
||||
shader.set_uniform_float(shader._uPixelSize, 1, [settings.get_int('doom-pixel-size')]);
|
||||
// clang-format on
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user