Skip to content

Commit 7cd3f35

Browse files
committed
test(actor2d): testing for vtkActor2D layer number
1 parent a85de03 commit 7cd3f35

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

Sources/Rendering/Core/Actor2D/test/testActor2D.js

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,27 @@ test.onlyIfWebGL('Test Actor2D', (t) => {
4343
actor2D.getProperty().setOpacity(0.3);
4444
actor2D.getProperty().setDisplayLocation(DisplayLocation.FOREGROUND);
4545
actor2D.getProperty().setRepresentation(Representation.SURFACE);
46+
actor2D.setLayerNumber(2);
4647
renderer.addActor2D(actor2D);
4748
const actor2D1 = gc.registerResource(vtkActor2D.newInstance());
4849
actor2D1.getProperty().setColor([0.1, 0.8, 0.5]);
4950
actor2D1.getProperty().setDisplayLocation(DisplayLocation.BACKGROUND);
5051
actor2D1.getProperty().setRepresentation(Representation.SURFACE);
5152
renderer.addActor2D(actor2D1);
53+
actor2D1.setLayerNumber(1);
54+
const actor2D2 = gc.registerResource(vtkActor2D.newInstance());
55+
actor2D2.getProperty().setColor([0.8, 0.4, 0.4]);
56+
actor2D2.getProperty().setOpacity(1.0);
57+
actor2D2.getProperty().setDisplayLocation(DisplayLocation.FOREGROUND);
58+
actor2D2.getProperty().setRepresentation(Representation.SURFACE);
59+
actor2D2.setLayerNumber(1);
60+
renderer.addActor2D(actor2D2);
5261

5362
const mapper = gc.registerResource(vtkMapper.newInstance());
5463
actor.setMapper(mapper);
5564
const mapper2D = gc.registerResource(vtkMapper2D.newInstance());
5665
const mapper2D1 = gc.registerResource(vtkMapper2D.newInstance());
66+
const mapper2D2 = gc.registerResource(vtkMapper2D.newInstance());
5767
const c = vtkCoordinate.newInstance();
5868
c.setCoordinateSystemToWorld();
5969
mapper2D.setTransformCoordinate(c);
@@ -62,21 +72,30 @@ test.onlyIfWebGL('Test Actor2D', (t) => {
6272
mapper2D1.setTransformCoordinate(c);
6373
mapper2D1.setScalarVisibility(false);
6474
actor2D1.setMapper(mapper2D1);
75+
mapper2D2.setTransformCoordinate(c);
76+
mapper2D2.setScalarVisibility(false);
77+
actor2D2.setMapper(mapper2D2);
6578

6679
const cubeSource = gc.registerResource(vtkCubeSource.newInstance());
6780
mapper.setInputConnection(cubeSource.getOutputPort());
6881
const sphereSource = gc.registerResource(vtkSphereSource.newInstance());
6982
sphereSource.setCenter(-0.5, 0.0, 0.0);
70-
sphereSource.setRadius(0.3);
83+
sphereSource.setRadius(0.35);
7184
sphereSource.setThetaResolution(25);
7285
sphereSource.setPhiResolution(25);
7386
mapper2D.setInputConnection(sphereSource.getOutputPort());
7487
const sphereSource1 = gc.registerResource(vtkSphereSource.newInstance());
75-
sphereSource1.setCenter(0.5, -0.3, 0.0);
76-
sphereSource1.setRadius(0.3);
88+
sphereSource1.setCenter(0, -0.5, 0.0);
89+
sphereSource1.setRadius(0.45);
7790
sphereSource1.setThetaResolution(30);
7891
sphereSource1.setPhiResolution(30);
7992
mapper2D1.setInputConnection(sphereSource1.getOutputPort());
93+
const sphereSource2 = gc.registerResource(vtkSphereSource.newInstance());
94+
sphereSource2.setCenter(-0.2, -0.3, 0.0);
95+
sphereSource2.setRadius(0.35);
96+
sphereSource2.setThetaResolution(30);
97+
sphereSource2.setPhiResolution(30);
98+
mapper2D2.setInputConnection(sphereSource2.getOutputPort());
8099

81100
renderer.getActiveCamera().azimuth(25);
82101
renderer.getActiveCamera().roll(25);
1.09 KB
Loading

0 commit comments

Comments
 (0)