yzt
2023-05-26 de4278af2fd46705a40bac58ec01122db6b7f3d7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import { PointCloudShading } from "../../Source/Cesium.js";
import createScene from "../createScene.js";
 
describe("Scene/PointCloudShading", function () {
  it("creates expected instance from raw assignment and construction", function () {
    var pointCloudShading = new PointCloudShading();
    expect(pointCloudShading.attenuation).toEqual(false);
    expect(pointCloudShading.geometricErrorScale).toEqual(1.0);
    expect(pointCloudShading.maximumAttenuation).not.toBeDefined();
    expect(pointCloudShading.baseResolution).not.toBeDefined();
    expect(pointCloudShading.eyeDomeLighting).toEqual(true);
    expect(pointCloudShading.eyeDomeLightingStrength).toEqual(1.0);
    expect(pointCloudShading.eyeDomeLightingRadius).toEqual(1.0);
    expect(pointCloudShading.backFaceCulling).toEqual(false);
    expect(pointCloudShading.normalShading).toEqual(true);
 
    var options = {
      geometricErrorScale: 2.0,
      maximumAttenuation: 16,
      baseResolution: 0.1,
      eyeDomeLightingStrength: 0.1,
      eyeDomeLightingRadius: 2.0,
      backFaceCulling: true,
      normalShading: false,
    };
    pointCloudShading = new PointCloudShading(options);
    expect(pointCloudShading.attenuation).toEqual(false);
    expect(pointCloudShading.geometricErrorScale).toEqual(
      options.geometricErrorScale
    );
    expect(pointCloudShading.maximumAttenuation).toEqual(
      options.maximumAttenuation
    );
    expect(pointCloudShading.baseResolution).toEqual(options.baseResolution);
    expect(pointCloudShading.eyeDomeLighting).toEqual(true);
    expect(pointCloudShading.eyeDomeLightingStrength).toEqual(
      options.eyeDomeLightingStrength
    );
    expect(pointCloudShading.eyeDomeLightingRadius).toEqual(
      options.eyeDomeLightingRadius
    );
    expect(pointCloudShading.backFaceCulling).toEqual(options.backFaceCulling);
    expect(pointCloudShading.normalShading).toEqual(options.normalShading);
  });
 
  it("provides a method for checking if point cloud shading is supported", function () {
    var scene = createScene();
    var context = scene.context;
    var expectedSupport =
      context.floatingPointTexture &&
      context.drawBuffers &&
      context.fragmentDepth;
    expect(PointCloudShading.isSupported(scene)).toEqual(expectedSupport);
    scene.destroyForSpecs();
  });
});