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
import { defaultValue } from "../Source/Cesium.js";
import { GeographicProjection } from "../Source/Cesium.js";
import { JulianDate } from "../Source/Cesium.js";
import { Camera } from "../Source/Cesium.js";
import { CreditDisplay } from "../Source/Cesium.js";
import { FrameState } from "../Source/Cesium.js";
import { JobScheduler } from "../Source/Cesium.js";
 
function createFrameState(context, camera, frameNumber, time) {
  // Mock frame-state for testing.
  var frameState = new FrameState(
    context,
    new CreditDisplay(
      document.createElement("div"),
      undefined,
      document.createElement("div")
    ),
    new JobScheduler()
  );
 
  var projection = new GeographicProjection();
  frameState.mapProjection = projection;
  frameState.frameNumber = defaultValue(frameNumber, 1.0);
  frameState.time = defaultValue(
    time,
    JulianDate.fromDate(new Date("January 1, 2011 12:00:00 EST"))
  );
 
  camera = defaultValue(
    camera,
    new Camera({
      drawingBufferWidth: 1,
      drawingBufferHeight: 1,
      mapProjection: projection,
    })
  );
  frameState.camera = camera;
  frameState.cullingVolume = camera.frustum.computeCullingVolume(
    camera.position,
    camera.direction,
    camera.up
  );
 
  frameState.terrainExaggeration = 1.0;
  frameState.terrainExaggerationRelativeHeight = 0.0;
 
  frameState.passes.render = true;
  frameState.passes.pick = false;
 
  frameState.minimumDisableDepthTestDistance = 0.0;
 
  return frameState;
}
export default createFrameState;