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
import { defined } from "../Source/Cesium.js";
import { destroyObject } from "../Source/Cesium.js";
import { Pass } from "../Source/Cesium.js";
import { RenderState } from "../Source/Cesium.js";
 
var ViewportPrimitive = function (fragmentShader) {
  this._fs = fragmentShader;
  this._command = undefined;
};
 
ViewportPrimitive.prototype.update = function (frameState) {
  if (!defined(this._command)) {
    this._command = frameState.context.createViewportQuadCommand(this._fs, {
      renderState: RenderState.fromCache(),
      pass: Pass.OPAQUE,
    });
  }
  frameState.commandList.push(this._command);
};
 
ViewportPrimitive.prototype.isDestroyed = function () {
  return false;
};
 
ViewportPrimitive.prototype.destroy = function () {
  if (defined(this._command)) {
    this._command.shaderProgram =
      this._command.shaderProgram && this._command.shaderProgram.destroy();
  }
  return destroyObject(this);
};
export default ViewportPrimitive;