Enhance advanced rendering tests and add anti-aliasing validation to scene document validation
This commit is contained in:
@@ -115,6 +115,10 @@ vi.mock("postprocessing", () => {
|
|||||||
constructor() {}
|
constructor() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class MockFXAAEffect {
|
||||||
|
constructor() {}
|
||||||
|
}
|
||||||
|
|
||||||
class MockSMAAEffect {
|
class MockSMAAEffect {
|
||||||
constructor() {}
|
constructor() {}
|
||||||
}
|
}
|
||||||
@@ -125,6 +129,7 @@ vi.mock("postprocessing", () => {
|
|||||||
DepthOfFieldEffect: MockDepthOfFieldEffect,
|
DepthOfFieldEffect: MockDepthOfFieldEffect,
|
||||||
EffectComposer: MockEffectComposer,
|
EffectComposer: MockEffectComposer,
|
||||||
EffectPass: MockEffectPass,
|
EffectPass: MockEffectPass,
|
||||||
|
FXAAEffect: MockFXAAEffect,
|
||||||
NormalPass: MockNormalPass,
|
NormalPass: MockNormalPass,
|
||||||
Pass: MockPass,
|
Pass: MockPass,
|
||||||
RenderPass: MockRenderPass,
|
RenderPass: MockRenderPass,
|
||||||
@@ -189,6 +194,28 @@ import {
|
|||||||
} from "../../src/rendering/whitebox-bevel-material";
|
} from "../../src/rendering/whitebox-bevel-material";
|
||||||
import { resolveWorldBackgroundSkyColorState } from "../../src/rendering/world-background-renderer";
|
import { resolveWorldBackgroundSkyColorState } from "../../src/rendering/world-background-renderer";
|
||||||
|
|
||||||
|
function resetPostprocessingState() {
|
||||||
|
postprocessingState.composerOptions.length = 0;
|
||||||
|
postprocessingState.composerPasses.length = 0;
|
||||||
|
postprocessingState.normalPassTextures.length = 0;
|
||||||
|
postprocessingState.ssaoCalls.length = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getLastEffectPassEffectNames() {
|
||||||
|
const effectPasses = postprocessingState.composerPasses.filter(
|
||||||
|
(pass) => (pass as { name?: string }).name === "EffectPass"
|
||||||
|
);
|
||||||
|
const lastEffectPass = effectPasses.at(-1) as
|
||||||
|
| { effects: unknown[] }
|
||||||
|
| undefined;
|
||||||
|
|
||||||
|
return (
|
||||||
|
lastEffectPass?.effects.map(
|
||||||
|
(effect) => (effect as { constructor: { name: string } }).constructor.name
|
||||||
|
) ?? []
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
describe("resolveBoxVolumeRenderPaths", () => {
|
describe("resolveBoxVolumeRenderPaths", () => {
|
||||||
it("uses authored fog and water paths when advanced rendering is enabled", () => {
|
it("uses authored fog and water paths when advanced rendering is enabled", () => {
|
||||||
const settings = createDefaultWorldSettings().advancedRendering;
|
const settings = createDefaultWorldSettings().advancedRendering;
|
||||||
|
|||||||
@@ -1847,6 +1847,11 @@ describe("validateSceneDocument", () => {
|
|||||||
mode: "filmic",
|
mode: "filmic",
|
||||||
exposure: 0
|
exposure: 0
|
||||||
},
|
},
|
||||||
|
antiAliasing: {
|
||||||
|
...document.world.advancedRendering.antiAliasing,
|
||||||
|
enabled: "yes",
|
||||||
|
mode: "temporal"
|
||||||
|
},
|
||||||
fogPath: "high",
|
fogPath: "high",
|
||||||
waterPath: "ultra",
|
waterPath: "ultra",
|
||||||
depthOfField: {
|
depthOfField: {
|
||||||
@@ -1958,6 +1963,14 @@ describe("validateSceneDocument", () => {
|
|||||||
code: "invalid-advanced-rendering-tone-mapping-exposure",
|
code: "invalid-advanced-rendering-tone-mapping-exposure",
|
||||||
path: "world.advancedRendering.toneMapping.exposure"
|
path: "world.advancedRendering.toneMapping.exposure"
|
||||||
}),
|
}),
|
||||||
|
expect.objectContaining({
|
||||||
|
code: "invalid-advanced-rendering-anti-aliasing-enabled",
|
||||||
|
path: "world.advancedRendering.antiAliasing.enabled"
|
||||||
|
}),
|
||||||
|
expect.objectContaining({
|
||||||
|
code: "invalid-advanced-rendering-anti-aliasing-mode",
|
||||||
|
path: "world.advancedRendering.antiAliasing.mode"
|
||||||
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
code: "invalid-advanced-rendering-dof-focal-length",
|
code: "invalid-advanced-rendering-dof-focal-length",
|
||||||
path: "world.advancedRendering.depthOfField.focalLength"
|
path: "world.advancedRendering.depthOfField.focalLength"
|
||||||
|
|||||||
Reference in New Issue
Block a user