Skip to content

Commit 88d09c8

Browse files
authored
Implement scissor (#1243)
Implements scissors. See BabylonJS/Babylon.js#13960 for changes required on the JS side.
1 parent da9bfc0 commit 88d09c8

File tree

14 files changed

+220
-72
lines changed

14 files changed

+220
-72
lines changed
940 KB
Loading
940 KB
Loading
940 KB
Loading
940 KB
Loading
1.13 MB
Loading
417 KB
Loading

Apps/Playground/Scripts/config.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,42 @@
237237
"playgroundId": "#BCYE7J#31",
238238
"referenceImage": "multiCamerasOutputRenderTarget.png"
239239
},
240+
{
241+
"title": "Multi camera rendering with scissors",
242+
"playgroundId": "#1LK70I#35",
243+
"referenceImage": "multiCameraRenderingWithScissors.png"
244+
},
245+
{
246+
"title": "Scissor test",
247+
"renderCount": 10,
248+
"playgroundId": "#W7E7CF#29",
249+
"referenceImage": "scissor-test.png",
250+
"comments": "Reset playgroundId to #W7E7CF#12 when d3d12 mip-map issue is fixed"
251+
},
252+
{
253+
"title": "Scissor test with 0.9 hardware scaling",
254+
"renderCount": 10,
255+
"playgroundId": "#W7E7CF#30",
256+
"referenceImage": "scissorTestWith0.9HardwareScaling.png",
257+
"comments": "Reset playgroundId to #W7E7CF#27 when d3d12 mip-map issue is fixed"
258+
},
259+
{
260+
"title": "Scissor test with 1.5 hardware scaling",
261+
"renderCount": 10,
262+
"playgroundId": "#W7E7CF#31",
263+
"referenceImage": "scissorTestWith1.5HardwareScaling.png",
264+
"comments": "Reset playgroundId to #W7E7CF#28 when d3d12 mip-map issue is fixed"
265+
},
266+
{
267+
"title": "Scissor test with negative x and y",
268+
"playgroundId": "#3L5BCD#2",
269+
"referenceImage": "scissorTestNegativeXandY.png"
270+
},
271+
{
272+
"title": "Scissor test with out of bounds width and height",
273+
"playgroundId": "#3L5BCD#3",
274+
"referenceImage": "scissorTestOobWidthAndHeight.png"
275+
},
240276
{
241277
"title": "setParent",
242278
"playgroundId": "#JD49CT#2",

Apps/Playground/Scripts/validation_native.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,22 @@ function compare(test, renderData, referenceImage, threshold, errorRatio) {
4444

4545
let error = (differencesCount * 100) / (size / 4) > errorRatio;
4646

47+
const width = testWidth / engine.getHardwareScalingLevel();
48+
const height = testHeight / engine.getHardwareScalingLevel();
49+
4750
if (error) {
48-
TestUtils.writePNG(referenceData, testWidth, testHeight, TestUtils.getOutputDirectory() + "/Errors/" + test.referenceImage);
51+
TestUtils.writePNG(referenceData, width, height, TestUtils.getOutputDirectory() + "/Errors/" + test.referenceImage);
4952
}
5053
if (saveResult || error) {
51-
TestUtils.writePNG(renderData, testWidth, testHeight, TestUtils.getOutputDirectory() + "/Results/" + test.referenceImage);
54+
TestUtils.writePNG(renderData, width, height, TestUtils.getOutputDirectory() + "/Results/" + test.referenceImage);
5255
}
5356
return error;
5457
}
5558

5659
function saveRenderedResult(test, renderData) {
57-
TestUtils.writePNG(renderData, testWidth, testHeight, TestUtils.getOutputDirectory() + "/Results/" + test.referenceImage);
60+
const width = testWidth / engine.getHardwareScalingLevel();
61+
const height = testHeight / engine.getHardwareScalingLevel();
62+
TestUtils.writePNG(renderData, width, height, TestUtils.getOutputDirectory() + "/Results/" + test.referenceImage);
5863
return false; // no error
5964
}
6065

Apps/package-lock.json

Lines changed: 43 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Apps/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
"getNightly": "node scripts/getNightly.js"
77
},
88
"dependencies": {
9-
"babylonjs": "^6.4.1",
10-
"babylonjs-gui": "^6.4.1",
11-
"babylonjs-loaders": "^6.4.1",
12-
"babylonjs-materials": "^6.4.1",
9+
"babylonjs": "^6.12.0",
10+
"babylonjs-gltf2interface": "^6.12.0",
11+
"babylonjs-gui": "^6.12.0",
12+
"babylonjs-loaders": "^6.12.0",
13+
"babylonjs-materials": "^6.12.0",
1314
"chai": "^4.3.4",
1415
"jsc-android": "^241213.1.0",
1516
"mocha": "^9.2.2",

0 commit comments

Comments
 (0)