Cesium版本升级webgl问题,glsl代码关键字修改

简介
  Cesium 从1.102.0 开始,Cesium 默认使用 WebGL2 上下文。一些webgl特效代码在webgl1中支持,但是在版本升级后,运行会报各种glsl代码错误。现在有两种解决方案。详细办法描述如下所示。

1、修改配置使用WebGL1

 地球初始化配置如下:requestWebgl1: true

var viewer = new Cesium.Viewer("cesiumContainer", {geocoder: false, // 是否显示geocoder小器件,右上角查询按钮homeButton: false, // 是否显示Home按钮infoBox: false, // 点击要素之后显示的信息,默认trueselectionIndicator: false, // 是否显示 entity 选中标识sceneModePicker: false, // 是否显示3D/2D选择器navigationHelpButton: false, // 是否显示右上角的帮助按钮animation: false, // 是否创建动画小器件,左下角仪表timeline: false, // 是否显示时间轴vrButton: false, // 是否显示虚拟按钮fullscreenButton: true, // 是否显示全屏按钮contextOptions: {// cesium状态下允许canvas转图片convertToImagewebgl: {alpha: true,depth: false,stencil: true,antialias: true,premultipliedAlpha: true,preserveDrawingBuffer: true,//通过canvas.toDataURL()实现截图需要将该项设置为truefailIfMajorPerformanceCaveat: false, },allowTextureFilterAnisotropic: true,requestWebgl1: true, //设置使用Webgl1}});

2、修改glsl代码使用webgl2

  需要修改的关键字为: varying attribute texture2D gl_FragColor

  其中 texture2D  修改为 texture

   gl_FragColor    修改为    out_FragColor

而   varying attribute 修改为 out in 需要看glsl代码上下文。例如下文中varying声明参数v_st使用时在=右边,意味着需要参数输入,所以修改为in。

假如声明参数只在=左边使用,则需要修改为out。


参考链接:https://blog.csdn.net/Zk9509/article/details/132076491

接下来实战:

解决报错

着色器报错:

ERROR: 0:11: 'assign' : l-value required (can't modify an input "v_position")

说明 in vec4 v_position; v_position = vec3(position) 应该为out vec4 v_position; v_position = vec3(position) ; 因为后面代码v_position在=号左边。

ERROR: 0:124: 'ql_FragColor' : undeclared identifier

    将 gl_FragColor    修改为    out_FragColor。

总之有什么报错解决什么问题。不一一列举。

相控阵雷达适配1.102版本

接下来放个new-CesiumGraph 适配cesium1.102后版本的代码。

CesiumGeometry.js

(function webpackUniversalModuleDefinition(root, factory) {if (typeof exports === 'object' && typeof module === 'object')module.exports = factory();else if (typeof define === 'function' && define.amd)define([], factory);else if (typeof exports === 'object')exports["CesiumGeometry"] = factory();elseroot["CesiumGeometry"] = factory();
})(typeof self !== 'undefined' ? self : this, function() {return /******/ (function(modules) { // webpackBootstrap/******/ // The module cache/******/var installedModules = {};/******//******/ // The require function/******/function __webpack_require__(moduleId) {/******//******/ // Check if module is in cache/******/if (installedModules[moduleId]) {/******/return installedModules[moduleId].exports;/******/}/******/ // Create a new module (and put it into the cache)/******/var module = installedModules[moduleId] = {/******/i: moduleId,/******/l: false,/******/exports: {}/******/};/******//******/ // Execute the module function/******/modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);/******//******/ // Flag the module as loaded/******/module.l = true;/******//******/ // Return the exports of the module/******/return module.exports;/******/}/******//******//******/ // expose the modules object (__webpack_modules__)/******/__webpack_require__.m = modules;/******//******/ // expose the module cache/******/__webpack_require__.c = installedModules;/******//******/ // define getter function for harmony exports/******/__webpack_require__.d = function(exports, name, getter) {/******/if (!__webpack_require__.o(exports, name)) {/******/Object.defineProperty(exports, name, {/******/configurable: false,/******/enumerable: true,/******/get: getter/******/});/******/}/******/};/******//******/ // getDefaultExport function for compatibility with non-harmony modules/******/__webpack_require__.n = function(module) {/******/var getter = module && module.__esModule ?/******/function getDefault() { return module['default']; } :/******/function getModuleExports() { return module; };/******/__webpack_require__.d(getter, 'a', getter);/******/return getter;/******/};/******//******/ // Object.prototype.hasOwnProperty.call/******/__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };/******//******/ // __webpack_public_path__/******/__webpack_require__.p = "";/******//******/ // Load entry module and return exports/******/return __webpack_require__(__webpack_require__.s = 4);/******/})/************************************************************************//******/([/* 0 *//***/(function(module, exports, __webpack_require__) {"use strict";Object.defineProperty(exports, "__esModule", {value: true});exports.RectangularSensorPrimitive = undefined;var _RectangularSensorVS = __webpack_require__(6);var _RectangularSensorVS2 = _interopRequireDefault(_RectangularSensorVS);var _RectangularSensorFS = __webpack_require__(7);var _RectangularSensorFS2 = _interopRequireDefault(_RectangularSensorFS);var _RectangularSensor = __webpack_require__(8);var _RectangularSensor2 = _interopRequireDefault(_RectangularSensor);var _RectangularSensorScanPlaneFS = __webpack_require__(9);var _RectangularSensorScanPlaneFS2 = _interopRequireDefault(_RectangularSensorScanPlaneFS);function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var BoundingSphere = Cesium.BoundingSphere;var Cartesian3 = Cesium.Cartesian3;var Color = Cesium.Color;var combine = Cesium.combine;var ComponentDatatype = Cesium.ComponentDatatype;var defaultValue = Cesium.defaultValue;var defined = Cesium.defined;var defineProperties = Object.defineProperties;var destroyObject = Cesium.destroyObject;var DeveloperError = Cesium.DeveloperError;var Matrix4 = Cesium.Matrix4;var PrimitiveType = Cesium.PrimitiveType;var Buffer = Cesium.Buffer;var BufferUsage = Cesium.BufferUsage;var DrawCommand = Cesium.DrawCommand;var Pass = Cesium.Pass;var RenderState = Cesium.RenderState;var ShaderProgram = Cesium.ShaderProgram;var ShaderSource = Cesium.ShaderSource;var VertexArray = Cesium.VertexArray;var BlendingState = Cesium.BlendingState;var CullFace = Cesium.CullFace;var Material = Cesium.Material;var SceneMode = Cesium.SceneMode;var VertexFormat = Cesium.VertexFormat;var CesiumMath = Cesium.Math;var Matrix3 = Cesium.Matrix3;var Matrix4 = Cesium.Matrix4;var JulianDate = Cesium.JulianDate;var BoxGeometry = Cesium.BoxGeometry;var EllipsoidGeometry = Cesium.EllipsoidGeometry;var sin = Math.sin;var cos = Math.cos;var tan = Math.tan;var atan = Math.atan;var asin = Math.asin;var attributeLocations = {position: 0,normal: 1};function RectangularSensorPrimitive(options) {var self = this;options = defaultValue(options, defaultValue.EMPTY_OBJECT);/*** 是否显示*/this.show = defaultValue(options.show, true);/*** 切分程度*/this.slice = defaultValue(options.slice, 32);/*** 传感器的模型矩阵*/this.modelMatrix = Matrix4.clone(options.modelMatrix, new Matrix4());this._modelMatrix = new Matrix4();this._computedModelMatrix = new Matrix4();this._computedScanPlaneModelMatrix = new Matrix4();/*** 传感器的半径*/this.radius = defaultValue(options.radius, Number.POSITIVE_INFINITY);this._radius = undefined;/*** 传感器水平半角*/this.xHalfAngle = defaultValue(options.xHalfAngle, 0);this._xHalfAngle = undefined;/*** 传感器垂直半角*/this.yHalfAngle = defaultValue(options.yHalfAngle, 0);this._yHalfAngle = undefined;/*** 线的颜色*/this.lineColor = defaultValue(options.lineColor, Color.WHITE);/*** 是否显示扇面的线*/this.showSectorLines = defaultValue(options.showSectorLines, true);/*** 是否显示扇面和圆顶面连接的线*/this.showSectorSegmentLines = defaultValue(options.showSectorSegmentLines, true);/*** 是否显示侧面*/this.showLateralSurfaces = defaultValue(options.showLateralSurfaces, true);/*** 目前用的统一材质* @type {Material}*/this.material = defined(options.material) ? options.material : Material.fromType(Material.ColorType);this._material = undefined;this._translucent = undefined;/*** 侧面材质* @type {Material}*/this.lateralSurfaceMaterial = defined(options.lateralSurfaceMaterial) ? options.lateralSurfaceMaterial : Material.fromType(Material.ColorType);this._lateralSurfaceMaterial = undefined;this._lateralSurfaceTranslucent = undefined;/*** 是否显示圆顶表面*/this.showDomeSurfaces = defaultValue(options.showDomeSurfaces, true);/*** 圆顶表面材质* @type {Material}*/this.domeSurfaceMaterial = defined(options.domeSurfaceMaterial) ? options.domeSurfaceMaterial : Material.fromType(Material.ColorType);this._domeSurfaceMaterial = undefined;/*** 是否显示圆顶面线*/this.showDomeLines = defaultValue(options.showDomeLines, true);/*** 是否显示与地球相交的线*/this.showIntersection = defaultValue(options.showIntersection, true);/*** 与地球相交的线的颜色*/this.intersectionColor = defaultValue(options.intersectionColor, Color.WHITE);/*** 与地球相交的线的宽度(像素)*/this.intersectionWidth = defaultValue(options.intersectionWidth, 5.0);/*** 是否穿过地球*/this.showThroughEllipsoid = defaultValue(options.showThroughEllipsoid, false);this._showThroughEllipsoid = undefined;/*** 是否显示扫描面*/this.showScanPlane = defaultValue(options.showScanPlane, true);/*** 扫描面颜色*/this.scanPlaneColor = defaultValue(options.scanPlaneColor, Color.WHITE);/*** 扫描面模式 垂直vertical/水平horizontal*/this.scanPlaneMode = defaultValue(options.scanPlaneMode, 'horizontal');/*** 扫描速率*/this.scanPlaneRate = defaultValue(options.scanPlaneRate, 10);this._scanePlaneXHalfAngle = 0;this._scanePlaneYHalfAngle = 0;//时间计算的起点this._time = JulianDate.now();this._boundingSphere = new BoundingSphere();this._boundingSphereWC = new BoundingSphere();//扇面 sectorthis._sectorFrontCommand = new DrawCommand({owner: this,primitiveType: PrimitiveType.TRIANGLES,boundingVolume: this._boundingSphereWC});this._sectorBackCommand = new DrawCommand({owner: this,primitiveType: PrimitiveType.TRIANGLES,boundingVolume: this._boundingSphereWC});this._sectorVA = undefined;//扇面边线 sectorLinethis._sectorLineCommand = new DrawCommand({owner: this,primitiveType: PrimitiveType.LINES,boundingVolume: this._boundingSphereWC});this._sectorLineVA = undefined;//扇面分割线 sectorSegmentLinethis._sectorSegmentLineCommand = new DrawCommand({owner: this,primitiveType: PrimitiveType.LINES,boundingVolume: this._boundingSphereWC});this._sectorSegmentLineVA = undefined;//弧面 domethis._domeFrontCommand = new DrawCommand({owner: this,primitiveType: PrimitiveType.TRIANGLES,boundingVolume: this._boundingSphereWC});this._domeBackCommand = new DrawCommand({owner: this,primitiveType: PrimitiveType.TRIANGLES,boundingVolume: this._boundingSphereWC});this._domeVA = undefined;//弧面线 domeLinethis._domeLineCommand = new DrawCommand({owner: this,primitiveType: PrimitiveType.LINES,boundingVolume: this._boundingSphereWC});this._domeLineVA = undefined;//扫描面 scanPlane/scanRadialthis._scanPlaneFrontCommand = new DrawCommand({owner: this,primitiveType: PrimitiveType.TRIANGLES,boundingVolume: this._boundingSphereWC});this._scanPlaneBackCommand = new DrawCommand({owner: this,primitiveType: PrimitiveType.TRIANGLES,boundingVolume: this._boundingSphereWC});this._scanRadialCommand = undefined;this._colorCommands = [];this._frontFaceRS = undefined;this._backFaceRS = undefined;this._sp = undefined;this._uniforms = {u_type: function u_type() {return 0; //面},u_xHalfAngle: function u_xHalfAngle() {return self.xHalfAngle;},u_yHalfAngle: function u_yHalfAngle() {return self.yHalfAngle;},u_radius: function u_radius() {return self.radius;},u_showThroughEllipsoid: function u_showThroughEllipsoid() {return self.showThroughEllipsoid;},u_showIntersection: function u_showIntersection() {return self.showIntersection;},u_intersectionColor: function u_intersectionColor() {return self.intersectionColor;},u_intersectionWidth: function u_intersectionWidth() {return self.intersectionWidth;},u_normalDirection: function u_normalDirection() {return 1.0;},u_lineColor: function u_lineColor() {return self.lineColor;}};this._scanUniforms = {u_xHalfAngle: function u_xHalfAngle() {return self._scanePlaneXHalfAngle;},u_yHalfAngle: function u_yHalfAngle() {return self._scanePlaneYHalfAngle;},u_radius: function u_radius() {return self.radius;},u_color: function u_color() {return self.scanPlaneColor;},u_showThroughEllipsoid: function u_showThroughEllipsoid() {return self.showThroughEllipsoid;},u_showIntersection: function u_showIntersection() {return self.showIntersection;},u_intersectionColor: function u_intersectionColor() {return self.intersectionColor;},u_intersectionWidth: function u_intersectionWidth() {return self.intersectionWidth;},u_normalDirection: function u_normalDirection() {return 1.0;},u_lineColor: function u_lineColor() {return self.lineColor;}};}RectangularSensorPrimitive.prototype.isDestroyed = function() { return false }RectangularSensorPrimitive.prototype.destroy = function() {}RectangularSensorPrimitive.prototype.update = function(frameState) {var mode = frameState.mode;if (!this.show || mode !== SceneMode.SCENE3D) {return;}var createVS = false;var createRS = false;var createSP = false;var xHalfAngle = this.xHalfAngle;var yHalfAngle = this.yHalfAngle;if (xHalfAngle < 0.0 || yHalfAngle < 0.0) {throw new DeveloperError('halfAngle must be greater than or equal to zero.');}if (xHalfAngle == 0.0 || yHalfAngle == 0.0) {return;}if (this._xHalfAngle !== xHalfAngle || this._yHalfAngle !== yHalfAngle) {this._xHalfAngle = xHalfAngle;this._yHalfAngle = yHalfAngle;createVS = true;}var radius = this.radius;if (radius < 0.0) {throw new DeveloperError('this.radius must be greater than or equal to zero.');}var radiusChanged = false;if (this._radius !== radius) {radiusChanged = true;this._radius = radius;this._boundingSphere = new BoundingSphere(Cartesian3.ZERO, this.radius);}var modelMatrixChanged = !Matrix4.equals(this.modelMatrix, this._modelMatrix);if (modelMatrixChanged || radiusChanged) {Matrix4.clone(this.modelMatrix, this._modelMatrix);Matrix4.multiplyByUniformScale(this.modelMatrix, this.radius, this._computedModelMatrix);BoundingSphere.transform(this._boundingSphere, this.modelMatrix, this._boundingSphereWC);}var showThroughEllipsoid = this.showThroughEllipsoid;if (this._showThroughEllipsoid !== this.showThroughEllipsoid) {this._showThroughEllipsoid = showThroughEllipsoid;createRS = true;}var material = this.material;if (this._material !== material) {this._material = material;createRS = true;createSP = true;}var translucent = material.isTranslucent();if (this._translucent !== translucent) {this._translucent = translucent;createRS = true;}if (this.showScanPlane) {var time = frameState.time;var timeDiff = JulianDate.secondsDifference(time, this._time);if (timeDiff < 0) {this._time = JulianDate.clone(time, this._time);}var percentage = Math.max(timeDiff % this.scanPlaneRate / this.scanPlaneRate, 0);var angle;if (this.scanPlaneMode == 'horizontal') {angle = 2 * yHalfAngle * percentage - yHalfAngle;var cosYHalfAngle = cos(angle);var tanXHalfAngle = tan(xHalfAngle);var maxX = atan(cosYHalfAngle * tanXHalfAngle);this._scanePlaneXHalfAngle = maxX;this._scanePlaneYHalfAngle = angle;Cesium.Matrix3.fromRotationX(this._scanePlaneYHalfAngle, matrix3Scratch);} else {angle = 2 * xHalfAngle * percentage - xHalfAngle;var tanYHalfAngle = tan(yHalfAngle);var cosXHalfAngle = cos(angle);var maxY = atan(cosXHalfAngle * tanYHalfAngle);this._scanePlaneXHalfAngle = angle;this._scanePlaneYHalfAngle = maxY;Cesium.Matrix3.fromRotationY(this._scanePlaneXHalfAngle, matrix3Scratch);}Cesium.Matrix4.multiplyByMatrix3(this.modelMatrix, matrix3Scratch, this._computedScanPlaneModelMatrix);Matrix4.multiplyByUniformScale(this._computedScanPlaneModelMatrix, this.radius, this._computedScanPlaneModelMatrix);}if (createVS) {createVertexArray(this, frameState);}if (createRS) {createRenderState(this, showThroughEllipsoid, translucent);}if (createSP) {createShaderProgram(this, frameState, material);}if (createRS || createSP) {createCommands(this, translucent);}var commandList = frameState.commandList;var passes = frameState.passes;var colorCommands = this._colorCommands;if (passes.render) {for (var i = 0, len = colorCommands.length; i < len; i++) {var colorCommand = colorCommands[i];commandList.push(colorCommand);}}};var matrix3Scratch = new Matrix3();var nScratch = new Cartesian3();//region -- VertexArray --/*** 计算zoy面和zoy面单位扇形位置* @param primitive* @returns {{zoy: Array, zox: Array}}*/function computeUnitPosiiton(primitive, xHalfAngle, yHalfAngle) {var slice = primitive.slice;//以中心为角度var cosYHalfAngle = cos(yHalfAngle);var tanYHalfAngle = tan(yHalfAngle);var cosXHalfAngle = cos(xHalfAngle);var tanXHalfAngle = tan(xHalfAngle);var maxY = atan(cosXHalfAngle * tanYHalfAngle);var maxX = atan(cosYHalfAngle * tanXHalfAngle);//ZOY面单位圆var zoy = [];for (var i = 0; i < slice; i++) {var phi = 2 * maxY * i / (slice - 1) - maxY;zoy.push(new Cartesian3(0, sin(phi), cos(phi)));}//zox面单位圆var zox = [];for (var i = 0; i < slice; i++) {var phi = 2 * maxX * i / (slice - 1) - maxX;zox.push(new Cartesian3(sin(phi), 0, cos(phi)));}return {zoy: zoy,zox: zox};}/*** 计算扇面的位置* @param unitPosition* @returns {Array}*/function computeSectorPositions(primitive, unitPosition) {var xHalfAngle = primitive.xHalfAngle,yHalfAngle = primitive.yHalfAngle,zoy = unitPosition.zoy,zox = unitPosition.zox;var positions = [];//zoy面沿y轴逆时针转xHalfAnglevar matrix3 = Matrix3.fromRotationY(xHalfAngle, matrix3Scratch);positions.push(zoy.map(function(p) {return Matrix3.multiplyByVector(matrix3, p, new Cesium.Cartesian3());}));//zox面沿x轴顺时针转yHalfAnglevar matrix3 = Matrix3.fromRotationX(-yHalfAngle, matrix3Scratch);positions.push(zox.map(function(p) {return Matrix3.multiplyByVector(matrix3, p, new Cesium.Cartesian3());}).reverse());//zoy面沿y轴顺时针转xHalfAnglevar matrix3 = Matrix3.fromRotationY(-xHalfAngle, matrix3Scratch);positions.push(zoy.map(function(p) {return Matrix3.multiplyByVector(matrix3, p, new Cesium.Cartesian3());}).reverse());//zox面沿x轴逆时针转yHalfAnglevar matrix3 = Matrix3.fromRotationX(yHalfAngle, matrix3Scratch);positions.push(zox.map(function(p) {return Matrix3.multiplyByVector(matrix3, p, new Cesium.Cartesian3());}));return positions;}/*** 创建扇面顶点* @param context* @param positions* @returns {*}*/function createSectorVertexArray(context, positions) {var planeLength = Array.prototype.concat.apply([], positions).length - positions.length;var vertices = new Float32Array(2 * 3 * 3 * planeLength);var k = 0;for (var i = 0, len = positions.length; i < len; i++) {var planePositions = positions[i];var n = Cartesian3.normalize(Cartesian3.cross(planePositions[0], planePositions[planePositions.length - 1], nScratch), nScratch);for (var j = 0, planeLength = planePositions.length - 1; j < planeLength; j++) {vertices[k++] = 0.0;vertices[k++] = 0.0;vertices[k++] = 0.0;vertices[k++] = -n.x;vertices[k++] = -n.y;vertices[k++] = -n.z;vertices[k++] = planePositions[j].x;vertices[k++] = planePositions[j].y;vertices[k++] = planePositions[j].z;vertices[k++] = -n.x;vertices[k++] = -n.y;vertices[k++] = -n.z;vertices[k++] = planePositions[j + 1].x;vertices[k++] = planePositions[j + 1].y;vertices[k++] = planePositions[j + 1].z;vertices[k++] = -n.x;vertices[k++] = -n.y;vertices[k++] = -n.z;}}var vertexBuffer = Buffer.createVertexBuffer({context: context,typedArray: vertices,usage: BufferUsage.STATIC_DRAW});var stride = 2 * 3 * Float32Array.BYTES_PER_ELEMENT;var attributes = [{index: attributeLocations.position,vertexBuffer: vertexBuffer,componentsPerAttribute: 3,componentDatatype: ComponentDatatype.FLOAT,offsetInBytes: 0,strideInBytes: stride}, {index: attributeLocations.normal,vertexBuffer: vertexBuffer,componentsPerAttribute: 3,componentDatatype: ComponentDatatype.FLOAT,offsetInBytes: 3 * Float32Array.BYTES_PER_ELEMENT,strideInBytes: stride}];return new VertexArray({context: context,attributes: attributes});}/*** 创建扇面边线顶点* @param context* @param positions* @returns {*}*/function createSectorLineVertexArray(context, positions) {var planeLength = positions.length;var vertices = new Float32Array(3 * 3 * planeLength);var k = 0;for (var i = 0, len = positions.length; i < len; i++) {var planePositions = positions[i];vertices[k++] = 0.0;vertices[k++] = 0.0;vertices[k++] = 0.0;vertices[k++] = planePositions[0].x;vertices[k++] = planePositions[0].y;vertices[k++] = planePositions[0].z;}var vertexBuffer = Buffer.createVertexBuffer({context: context,typedArray: vertices,usage: BufferUsage.STATIC_DRAW});var stride = 3 * Float32Array.BYTES_PER_ELEMENT;var attributes = [{index: attributeLocations.position,vertexBuffer: vertexBuffer,componentsPerAttribute: 3,componentDatatype: ComponentDatatype.FLOAT,offsetInBytes: 0,strideInBytes: stride}];return new VertexArray({context: context,attributes: attributes});}/*** 创建扇面圆顶面连接线顶点* @param context* @param positions* @returns {*}*/function createSectorSegmentLineVertexArray(context, positions) {var planeLength = Array.prototype.concat.apply([], positions).length - positions.length;var vertices = new Float32Array(3 * 3 * planeLength);var k = 0;for (var i = 0, len = positions.length; i < len; i++) {var planePositions = positions[i];for (var j = 0, planeLength = planePositions.length - 1; j < planeLength; j++) {vertices[k++] = planePositions[j].x;vertices[k++] = planePositions[j].y;vertices[k++] = planePositions[j].z;vertices[k++] = planePositions[j + 1].x;vertices[k++] = planePositions[j + 1].y;vertices[k++] = planePositions[j + 1].z;}}var vertexBuffer = Buffer.createVertexBuffer({context: context,typedArray: vertices,usage: BufferUsage.STATIC_DRAW});var stride = 3 * Float32Array.BYTES_PER_ELEMENT;var attributes = [{index: attributeLocations.position,vertexBuffer: vertexBuffer,componentsPerAttribute: 3,componentDatatype: ComponentDatatype.FLOAT,offsetInBytes: 0,strideInBytes: stride}];return new VertexArray({context: context,attributes: attributes});}/*** 创建圆顶面顶点* @param context*/function createDomeVertexArray(context) {var geometry = Cesium.EllipsoidGeometry.createGeometry(new Cesium.EllipsoidGeometry({vertexFormat: VertexFormat.POSITION_ONLY,stackPartitions: 32,slicePartitions: 32}));var vertexArray = VertexArray.fromGeometry({context: context,geometry: geometry,attributeLocations: attributeLocations,bufferUsage: BufferUsage.STATIC_DRAW,interleave: false});return vertexArray;}/*** 创建圆顶面连线顶点* @param context*/function createDomeLineVertexArray(context) {var geometry = Cesium.EllipsoidOutlineGeometry.createGeometry(new Cesium.EllipsoidOutlineGeometry({vertexFormat: VertexFormat.POSITION_ONLY,stackPartitions: 32,slicePartitions: 32}));var vertexArray = VertexArray.fromGeometry({context: context,geometry: geometry,attributeLocations: attributeLocations,bufferUsage: BufferUsage.STATIC_DRAW,interleave: false});return vertexArray;}/*** 创建扫描面顶点* @param context* @param positions* @returns {*}*/function createScanPlaneVertexArray(context, positions) {var planeLength = positions.length - 1;var vertices = new Float32Array(3 * 3 * planeLength);var k = 0;for (var i = 0; i < planeLength; i++) {vertices[k++] = 0.0;vertices[k++] = 0.0;vertices[k++] = 0.0;vertices[k++] = positions[i].x;vertices[k++] = positions[i].y;vertices[k++] = positions[i].z;vertices[k++] = positions[i + 1].x;vertices[k++] = positions[i + 1].y;vertices[k++] = positions[i + 1].z;}var vertexBuffer = Buffer.createVertexBuffer({context: context,typedArray: vertices,usage: BufferUsage.STATIC_DRAW});var stride = 3 * Float32Array.BYTES_PER_ELEMENT;var attributes = [{index: attributeLocations.position,vertexBuffer: vertexBuffer,componentsPerAttribute: 3,componentDatatype: ComponentDatatype.FLOAT,offsetInBytes: 0,strideInBytes: stride}];return new VertexArray({context: context,attributes: attributes});}function createVertexArray(primitive, frameState) {var context = frameState.context;var unitSectorPositions = computeUnitPosiiton(primitive, primitive.xHalfAngle, primitive.yHalfAngle);var positions = computeSectorPositions(primitive, unitSectorPositions);//显示扇面if (primitive.showLateralSurfaces) {primitive._sectorVA = createSectorVertexArray(context, positions);}//显示扇面线if (primitive.showSectorLines) {primitive._sectorLineVA = createSectorLineVertexArray(context, positions);}//显示扇面圆顶面的交线if (primitive.showSectorSegmentLines) {primitive._sectorSegmentLineVA = createSectorSegmentLineVertexArray(context, positions);}//显示弧面if (primitive.showDomeSurfaces) {primitive._domeVA = createDomeVertexArray(context);}//显示弧面线if (primitive.showDomeLines) {primitive._domeLineVA = createDomeLineVertexArray(context);}//显示扫描面if (primitive.showScanPlane) {if (primitive.scanPlaneMode == 'horizontal') {var unitScanPlanePositions = computeUnitPosiiton(primitive, CesiumMath.PI_OVER_TWO, 0);primitive._scanPlaneVA = createScanPlaneVertexArray(context, unitScanPlanePositions.zox);} else {var unitScanPlanePositions = computeUnitPosiiton(primitive, 0, CesiumMath.PI_OVER_TWO);primitive._scanPlaneVA = createScanPlaneVertexArray(context, unitScanPlanePositions.zoy);}}}//endregion//region -- ShaderProgram --function createCommonShaderProgram(primitive, frameState, material) {var context = frameState.context;var vs = _RectangularSensorVS2.default;var fs = new ShaderSource({sources: [_RectangularSensor2.default, material.shaderSource, _RectangularSensorFS2.default]});primitive._sp = ShaderProgram.replaceCache({context: context,shaderProgram: primitive._sp,vertexShaderSource: vs,fragmentShaderSource: fs,attributeLocations: attributeLocations});var pickFS = new ShaderSource({sources: [_RectangularSensor2.default, material.shaderSource, _RectangularSensorFS2.default],pickColorQualifier: 'uniform'});primitive._pickSP = ShaderProgram.replaceCache({context: context,shaderProgram: primitive._pickSP,vertexShaderSource: vs,fragmentShaderSource: pickFS,attributeLocations: attributeLocations});}function createScanPlaneShaderProgram(primitive, frameState, material) {var context = frameState.context;var vs = _RectangularSensorVS2.default;var fs = new ShaderSource({sources: [_RectangularSensor2.default, material.shaderSource, _RectangularSensorScanPlaneFS2.default]});primitive._scanePlaneSP = ShaderProgram.replaceCache({context: context,shaderProgram: primitive._scanePlaneSP,vertexShaderSource: vs,fragmentShaderSource: fs,attributeLocations: attributeLocations});}function createShaderProgram(primitive, frameState, material) {createCommonShaderProgram(primitive, frameState, material);if (primitive.showScanPlane) {createScanPlaneShaderProgram(primitive, frameState, material);}}//endregion//region -- RenderState --function createRenderState(primitive, showThroughEllipsoid, translucent) {if (translucent) {primitive._frontFaceRS = RenderState.fromCache({depthTest: {enabled: !showThroughEllipsoid},depthMask: false,blending: BlendingState.ALPHA_BLEND,cull: {enabled: true,face: CullFace.BACK}});primitive._backFaceRS = RenderState.fromCache({depthTest: {enabled: !showThroughEllipsoid},depthMask: false,blending: BlendingState.ALPHA_BLEND,cull: {enabled: true,face: CullFace.FRONT}});primitive._pickRS = RenderState.fromCache({depthTest: {enabled: !showThroughEllipsoid},depthMask: false,blending: BlendingState.ALPHA_BLEND});} else {primitive._frontFaceRS = RenderState.fromCache({depthTest: {enabled: !showThroughEllipsoid},depthMask: true});primitive._pickRS = RenderState.fromCache({depthTest: {enabled: true},depthMask: true});}}//endregion//region -- Command --function createCommand(primitive, frontCommand, backCommand, frontFaceRS, backFaceRS, sp, va, uniforms, modelMatrix, translucent, pass, isLine) {if (translucent && backCommand) {backCommand.vertexArray = va;backCommand.renderState = backFaceRS;backCommand.shaderProgram = sp;backCommand.uniformMap = combine(uniforms, primitive._material._uniforms);backCommand.uniformMap.u_normalDirection = function() {return -1.0;};backCommand.pass = pass;backCommand.modelMatrix = modelMatrix;primitive._colorCommands.push(backCommand);}frontCommand.vertexArray = va;frontCommand.renderState = frontFaceRS;frontCommand.shaderProgram = sp;frontCommand.uniformMap = combine(uniforms, primitive._material._uniforms);if (isLine) {frontCommand.uniformMap.u_type = function() {return 1;};}frontCommand.pass = pass;frontCommand.modelMatrix = modelMatrix;primitive._colorCommands.push(frontCommand);}function createCommands(primitive, translucent) {primitive._colorCommands.length = 0;var pass = translucent ? Pass.TRANSLUCENT : Pass.OPAQUE;//显示扇面if (primitive.showLateralSurfaces) {createCommand(primitive, primitive._sectorFrontCommand, primitive._sectorBackCommand, primitive._frontFaceRS, primitive._backFaceRS, primitive._sp, primitive._sectorVA, primitive._uniforms, primitive._computedModelMatrix, translucent, pass);}//显示扇面线if (primitive.showSectorLines) {createCommand(primitive, primitive._sectorLineCommand, undefined, primitive._frontFaceRS, primitive._backFaceRS, primitive._sp, primitive._sectorLineVA, primitive._uniforms, primitive._computedModelMatrix, translucent, pass, true);}//显示扇面交接线if (primitive.showSectorSegmentLines) {createCommand(primitive, primitive._sectorSegmentLineCommand, undefined, primitive._frontFaceRS, primitive._backFaceRS, primitive._sp, primitive._sectorSegmentLineVA, primitive._uniforms, primitive._computedModelMatrix, translucent, pass, true);}//显示弧面if (primitive.showDomeSurfaces) {createCommand(primitive, primitive._domeFrontCommand, primitive._domeBackCommand, primitive._frontFaceRS, primitive._backFaceRS, primitive._sp, primitive._domeVA, primitive._uniforms, primitive._computedModelMatrix, translucent, pass);}//显示弧面线if (primitive.showDomeLines) {createCommand(primitive, primitive._domeLineCommand, undefined, primitive._frontFaceRS, primitive._backFaceRS, primitive._sp, primitive._domeLineVA, primitive._uniforms, primitive._computedModelMatrix, translucent, pass, true);}//显示扫描面if (primitive.showScanPlane) {createCommand(primitive, primitive._scanPlaneFrontCommand, primitive._scanPlaneBackCommand, primitive._frontFaceRS, primitive._backFaceRS, primitive._scanePlaneSP, primitive._scanPlaneVA, primitive._scanUniforms, primitive._computedScanPlaneModelMatrix, translucent, pass);}}//endregionexports.RectangularSensorPrimitive = RectangularSensorPrimitive;/***/}),/* 1 *//***/(function(module, exports, __webpack_require__) {"use strict";Object.defineProperty(exports, "__esModule", {value: true});var BoundingSphere = Cesium.BoundingSphere,Cartesian3 = Cesium.Cartesian3,Check = Cesium.Check,ComponentDatatype = Cesium.ComponentDatatype,defaultValue = Cesium.defaultValue,defined = Cesium.defined,Geometry = Cesium.Geometry,GeometryAttribute = Cesium.GeometryAttribute,GeometryAttributes = Cesium.GeometryAttributes,PrimitiveType = Cesium.PrimitiveType,VertexFormat = Cesium.VertexFormat,CesiumMath = Cesium.Math,GeometryPipeline = Cesium.GeometryPipeline,IndexDatatype = Cesium.IndexDatatype,Ellipsoid = Cesium.Ellipsoid;var cos = Math.cos;var sin = Math.sin;function ConicArcSensorGeometry(options) {options = defaultValue(options, defaultValue.EMPTY_OBJECT);var angle = options.angle;var radius = options.radius;var stackPartitions = Math.round(defaultValue(options.stackPartitions, 12));var slicePartitions = Math.round(defaultValue(options.slicePartitions, 64));//>>includeStart('debug', pragmas.debug);Check.typeOf.number('angle', angle);Check.typeOf.number('radius', radius);//>>includeEnd('debug');var vertexFormat = defaultValue(options.vertexFormat, VertexFormat.DEFAULT);this._angle = angle;this._radius = radius;this._stackPartitions = stackPartitions;this._slicePartitions = slicePartitions;this._vertexFormat = vertexFormat;}ConicArcSensorGeometry.fromDimensions = function(options) {options = defaultValue(options, defaultValue.EMPTY_OBJECT);var angle = options.angle;var radius = options.radius;var stackPartitions = options.stackPartitions;var slicePartitions = options.slicePartitions;//>>includeStart('debug', pragmas.debug);Check.typeOf.number('angle', angle);Check.typeOf.number('radius', radius);Check.typeOf.number.greaterThanOrEquals('angle', angle, 0);Check.typeOf.number.greaterThanOrEquals('height', height, 0);//>>includeEnd('debug');return new ConicArcSensorGeometry({angle: angle,radius: radius,stackPartitions: stackPartitions,slicePartitions: slicePartitions,vertexFormat: options.vertexFormat});};ConicArcSensorGeometry.createGeometry = function(conicSensorGeometry) {console.time('createGeometry');var angle = conicSensorGeometry._angle;var radius = conicSensorGeometry._radius;var stackPartitions = conicSensorGeometry._stackPartitions + 1;var slicePartitions = conicSensorGeometry._slicePartitions + 1;var vertexFormat = conicSensorGeometry._vertexFormat;var attributes = new GeometryAttributes();var bottomIndex;var numIndices = 3 * (slicePartitions - 1) + 6 * (slicePartitions - 1) * (stackPartitions - 2) + (slicePartitions - 1) * 1 * 3;var vertexCount = stackPartitions * slicePartitions;var indices = IndexDatatype.createTypedArray(vertexCount, numIndices);var positions = new Float64Array(vertexCount * 3 + (slicePartitions - 1) * 3 * 3);if (vertexFormat.position) {var positionIndex = 0;//bottom platvar cosTheta = new Array(slicePartitions);var sinTheta = new Array(slicePartitions);for (var i = 0; i < slicePartitions; i++) {var theta = CesiumMath.TWO_PI * i / (slicePartitions - 1);cosTheta[i] = cos(theta);sinTheta[i] = sin(theta);positions[positionIndex++] = 0.0;positions[positionIndex++] = 0.0;positions[positionIndex++] = -radius;}for (i = 1; i < stackPartitions; i++) {var phi = angle * i / (stackPartitions - 1);var sinPhi = sin(phi);var xSinPhi = radius * sinPhi;var ySinPhi = radius * sinPhi;var zCosPhi = radius * cos(phi);for (var j = 0; j < slicePartitions; j++) {positions[positionIndex++] = cosTheta[j] * xSinPhi;positions[positionIndex++] = sinTheta[j] * ySinPhi;positions[positionIndex++] = -zCosPhi;}}//side platbottomIndex = positionIndex;for (var i = 0; i < slicePartitions - 1; i++) {positions[positionIndex++] = 0;positions[positionIndex++] = 0;positions[positionIndex++] = 0;positions[positionIndex++] = positions[bottomIndex - (slicePartitions - i - 1) * 3];positions[positionIndex++] = positions[bottomIndex - (slicePartitions - i - 1) * 3 + 1];positions[positionIndex++] = positions[bottomIndex - (slicePartitions - i - 1) * 3 + 2];positions[positionIndex++] = positions[bottomIndex - (slicePartitions - i) * 3];positions[positionIndex++] = positions[bottomIndex - (slicePartitions - i) * 3 + 1];positions[positionIndex++] = positions[bottomIndex - (slicePartitions - i) * 3 + 2];}attributes.position = new GeometryAttribute({componentDatatype: ComponentDatatype.DOUBLE,componentsPerAttribute: 3,values: positions});}var indicesIndex = 0;//bottom platfor (var j = 0; j < slicePartitions - 1; j++) {indices[indicesIndex++] = slicePartitions + j;indices[indicesIndex++] = slicePartitions + j + 1;indices[indicesIndex++] = j + 1;}var topOffset;var bottomOffset;for (var i = 1; i < stackPartitions - 1; i++) {topOffset = i * slicePartitions;bottomOffset = (i + 1) * slicePartitions;for (j = 0; j < slicePartitions - 1; j++) {indices[indicesIndex++] = bottomOffset + j;indices[indicesIndex++] = bottomOffset + j + 1;indices[indicesIndex++] = topOffset + j + 1;indices[indicesIndex++] = bottomOffset + j;indices[indicesIndex++] = topOffset + j + 1;indices[indicesIndex++] = topOffset + j;}}//side platfor (var i = 0, len = (slicePartitions - 1) * 3; i < len; i++) {indices[indicesIndex++] = i + bottomIndex / 3;}var geometry = new Geometry({attributes: attributes,indices: indices,primitiveType: PrimitiveType.TRIANGLES,boundingSphere: new BoundingSphere(Cartesian3.ZERO, radius)});geometry = GeometryPipeline.computeNormal(geometry);console.timeEnd('createGeometry');return geometry;};exports.ConicArcSensorGeometry = ConicArcSensorGeometry;/***/}),/* 2 *//***/(function(module, exports, __webpack_require__) {"use strict";Object.defineProperty(exports, "__esModule", {value: true});var BoundingSphere = Cesium.BoundingSphere,Cartesian3 = Cesium.Cartesian3,ComponentDatatype = Cesium.ComponentDatatype,defaultValue = Cesium.defaultValue,defined = Cesium.defined,DeveloperError = Cesium.DeveloperError,Ellipsoid = Cesium.Ellipsoid,Geometry = Cesium.Geometry,GeometryAttribute = Cesium.GeometryAttribute,GeometryAttributes = Cesium.GeometryAttributes,IndexDatatype = Cesium.IndexDatatype,CesiumMath = Cesium.Math,PrimitiveType = Cesium.PrimitiveType;var defaultRadii = new Cartesian3(1.0, 1.0, 1.0);var cos = Math.cos;var sin = Math.sin;function ConicArcSensorOutlineGeometry(options) {options = defaultValue(options, defaultValue.EMPTY_OBJECT);var angle = options.angle;var radius = options.radius;var stackPartitions = Math.round(defaultValue(options.stackPartitions, 10));var slicePartitions = Math.round(defaultValue(options.slicePartitions, 8));var subdivisions = Math.round(defaultValue(options.subdivisions, 128));//>>includeStart('debug', pragmas.debug);if (stackPartitions < 1) {throw new DeveloperError('options.stackPartitions cannot be less than 1');}if (slicePartitions < 0) {throw new DeveloperError('options.slicePartitions cannot be less than 0');}if (subdivisions < 0) {throw new DeveloperError('options.subdivisions must be greater than or equal to zero.');}//>>includeEnd('debug');this._angle = angle;this._radius = radius;this._stackPartitions = stackPartitions;this._slicePartitions = slicePartitions;this._subdivisions = subdivisions;}ConicArcSensorOutlineGeometry.createGeometry = function(conicSensorGeometry) {var angle = conicSensorGeometry._angle;var radius = conicSensorGeometry._radius;if (radius <= 0 || angle <= 0) {return;}var stackPartitions = conicSensorGeometry._stackPartitions;var slicePartitions = conicSensorGeometry._slicePartitions;var subdivisions = conicSensorGeometry._subdivisions;var indicesSize = subdivisions * (stackPartitions + slicePartitions - 1);var positionSize = indicesSize - slicePartitions + 2;var positions = new Float64Array(positionSize * 3);var indices = IndexDatatype.createTypedArray(positionSize, indicesSize * 2);var i;var j;var theta;var phi;var cosPhi;var sinPhi;var index = 0;var cosTheta = new Array(subdivisions);var sinTheta = new Array(subdivisions);for (i = 0; i < subdivisions; i++) {theta = CesiumMath.TWO_PI * i / subdivisions;cosTheta[i] = cos(theta);sinTheta[i] = sin(theta);}for (i = 1; i < stackPartitions; i++) {phi = angle * i / (stackPartitions - 1);cosPhi = cos(phi);sinPhi = sin(phi);for (j = 0; j < subdivisions; j++) {positions[index++] = radius * cosTheta[j] * sinPhi;positions[index++] = radius * sinTheta[j] * sinPhi;positions[index++] = -radius * cosPhi;}}cosTheta.length = slicePartitions;sinTheta.length = slicePartitions;for (i = 0; i < slicePartitions; i++) {theta = CesiumMath.TWO_PI * i / slicePartitions;cosTheta[i] = cos(theta);sinTheta[i] = sin(theta);}positions[index++] = 0;positions[index++] = 0;positions[index++] = -radius;for (i = 1; i < subdivisions; i++) {phi = angle * i / subdivisions;cosPhi = cos(phi);sinPhi = sin(phi);for (j = 0; j < slicePartitions; j++) {positions[index++] = radius * cosTheta[j] * sinPhi;positions[index++] = radius * sinTheta[j] * sinPhi;positions[index++] = -radius * cosPhi;}}/*positions[index++] = 0;positions[index++] = 0;positions[index++] = -radii.z;*/index = 0;for (i = 0; i < stackPartitions - 1; ++i) {var topRowOffset = i * subdivisions;for (j = 0; j < subdivisions - 1; ++j) {indices[index++] = topRowOffset + j;indices[index++] = topRowOffset + j + 1;}indices[index++] = topRowOffset + subdivisions - 1;indices[index++] = topRowOffset;}var sliceOffset = subdivisions * (stackPartitions - 1);for (j = 1; j < slicePartitions + 1; ++j) {indices[index++] = sliceOffset;indices[index++] = sliceOffset + j;}for (i = 0; i < subdivisions - 2; ++i) {var topOffset = i * slicePartitions + 1 + sliceOffset;var bottomOffset = (i + 1) * slicePartitions + 1 + sliceOffset;for (j = 0; j < slicePartitions - 1; ++j) {indices[index++] = bottomOffset + j;indices[index++] = topOffset + j;}indices[index++] = bottomOffset + slicePartitions - 1;indices[index++] = topOffset + slicePartitions - 1;}/*var lastPosition = positions.length / 3 - 1;for (j = lastPosition - 1; j > lastPosition - slicePartitions - 1; --j) {indices[index++] = lastPosition;indices[index++] = j;}*/var attributes = new GeometryAttributes({position: new GeometryAttribute({componentDatatype: ComponentDatatype.DOUBLE,componentsPerAttribute: 3,values: positions})});return new Geometry({attributes: attributes,indices: indices,primitiveType: PrimitiveType.LINES,boundingSphere: new BoundingSphere(Cartesian3.ZERO, radius)});};exports.ConicArcSensorOutlineGeometry = ConicArcSensorOutlineGeometry;/***/}),/* 3 *//***/(function(module, exports, __webpack_require__) {"use strict";Object.defineProperty(exports, "__esModule", {value: true});var defaultValue = Cesium.defaultValue,defined = Cesium.defined,defineProperties = Object.defineProperties,DeveloperError = Cesium.DeveloperError,Event = Cesium.Event,createMaterialPropertyDescriptor = Cesium.createMaterialPropertyDescriptor,createPropertyDescriptor = Cesium.createPropertyDescriptor;function ConicArcSensorGraphics(options) {this._angle = undefined;this._angleSubscription = undefined;this._radius = undefined;this._radiusSubscription = undefined;this._stack = undefined;this._stackSubscription = undefined;this._slice = undefined;this._sliceSubscription = undefined;this._color = undefined;this._colorSubscription = undefined;this._show = undefined;this._showSubscription = undefined;this._fill = undefined;this._fillSubscription = undefined;this._color = undefined;this._colorSubscription = undefined;this._material = undefined;this._materialSubscription = undefined;this._outline = undefined;this._outlineSubscription = undefined;this._outlineColor = undefined;this._outlineColorSubscription = undefined;this._outlineWidth = undefined;this._outlineWidthSubscription = undefined;this._shadows = undefined;this._shadowsSubscription = undefined;this._distanceDisplayCondition = undefined;this._distanceDisplayConditionSubscription = undefined;this._definitionChanged = new Event();this._gaze = undefined;this._gazeSubscription = undefined;this.merge(defaultValue(options, defaultValue.EMPTY_OBJECT));}defineProperties(ConicArcSensorGraphics.prototype, {/*** Gets the event that is raised whenever a property or sub-property is changed or modified.* @memberof BoxGraphics.prototype* @type {Event}* @readonly*/definitionChanged: {get: function get() {return this._definitionChanged;}},/*** Gets or sets the boolean Property specifying the visibility of the box.* @memberof BoxGraphics.prototype* @type {Property}* @default true*/show: createPropertyDescriptor('show'),angle: createPropertyDescriptor('angle'),radius: createPropertyDescriptor('radius'),stack: createPropertyDescriptor('stack'),slice: createPropertyDescriptor('slice'),color: createPropertyDescriptor('color'),/*** Gets or sets the material used to fill the box.* @memberof BoxGraphics.prototype* @type {MaterialProperty}* @default Color.WHITE*/material: createMaterialPropertyDescriptor('material'),/*** Gets or sets the boolean Property specifying whether the box is filled with the provided material.* @memberof BoxGraphics.prototype* @type {Property}* @default true*/fill: createPropertyDescriptor('fill'),/*** Gets or sets the Property specifying whether the box is outlined.* @memberof BoxGraphics.prototype* @type {Property}* @default false*/outline: createPropertyDescriptor('outline'),/*** Gets or sets the Property specifying the {@link Color} of the outline.* @memberof BoxGraphics.prototype* @type {Property}* @default Color.BLACK*/outlineColor: createPropertyDescriptor('outlineColor'),/*** Gets or sets the numeric Property specifying the width of the outline.* @memberof BoxGraphics.prototype* @type {Property}* @default 1.0*/outlineWidth: createPropertyDescriptor('outlineWidth'),/*** Get or sets the enum Property specifying whether the box* casts or receives shadows from each light source.* @memberof BoxGraphics.prototype* @type {Property}* @default ShadowMode.DISABLED*/shadows: createPropertyDescriptor('shadows'),/*** Gets or sets the {@link DistanceDisplayCondition} Property specifying at what distance from the camera that this box will be displayed.* @memberof BoxGraphics.prototype* @type {Property}*/distanceDisplayCondition: createPropertyDescriptor('distanceDisplayCondition')});ConicArcSensorGraphics.prototype.clone = function(result) {if (!defined(result)) {return new ConicArcSensorGraphics(this);}result.angle = this.angle;result.radius = this.radius;result.stack = this.stack;result.slice = this.slice;result.show = this.show;result.material = this.material;result.color = this.color;result.fill = this.fill;result.outline = this.outline;result.outlineColor = this.outlineColor;result.outlineWidth = this.outlineWidth;result.shadows = this.shadows;result.distanceDisplayCondition = this.distanceDisplayCondition;result.gaze = this.gaze;return result;};ConicArcSensorGraphics.prototype.merge = function(source) {//>>includeStart('debug', pragmas.debug);if (!defined(source)) {throw new DeveloperError('source is required.');}//>>includeEnd('debug');this.angle = defaultValue(this.angle, source.angle);this.radius = defaultValue(this.radius, source.radius);this.stack = defaultValue(this.stack, source.stack);this.slice = defaultValue(this.slice, source.slice);this.show = defaultValue(this.show, source.show);this.color = defaultValue(this.color, source.color);this.material = defaultValue(this.material, source.material);this.fill = defaultValue(this.fill, source.fill);this.outline = defaultValue(this.outline, source.outline);this.outlineColor = defaultValue(this.outlineColor, source.outlineColor);this.outlineWidth = defaultValue(this.outlineWidth, source.outlineWidth);this.shadows = defaultValue(this.shadows, source.shadows);this.distanceDisplayCondition = defaultValue(this.distanceDisplayCondition, source.distanceDisplayCondition);this.gaze = defaultValue(this.gaze, source.gaze);};exports.ConicArcSensorGraphics = ConicArcSensorGraphics;/***/}),/* 4 *//***/(function(module, exports, __webpack_require__) {"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _index = __webpack_require__(5);Object.keys(_index).forEach(function(key) {if (key === "default" || key === "__esModule") return;Object.defineProperty(exports, key, {enumerable: true,get: function get() {return _index[key];}});});/***/}),/* 5 *//***/(function(module, exports, __webpack_require__) {"use strict";var _RectangularSensorPrimitive = __webpack_require__(0);var _RectangularSensorGraphics = __webpack_require__(10);var _RectangularSensorVisualizer = __webpack_require__(11);var _ConicArcSensorGeometry = __webpack_require__(1);var _ConicArcSensorOutlineGeometry = __webpack_require__(2);var _ConicArcSensorGraphics = __webpack_require__(3);var _ConicArcSensorCollection = __webpack_require__(12);//rectangularSensor//conicSensorCesium.RectangularSensorPrimitive = _RectangularSensorPrimitive.RectangularSensorPrimitive;Cesium.RectangularSensorGraphics = _RectangularSensorGraphics.RectangularSensorGraphics;Cesium.RectangularSensorVisualizer = _RectangularSensorVisualizer.RectangularSensorVisualizer;//conicSensorCesium.ConicArcSensorGeometry = _ConicArcSensorGeometry.ConicArcSensorGeometry;Cesium.ConicArcSensorOutlineGeometry = _ConicArcSensorOutlineGeometry.ConicArcSensorOutlineGeometry;Cesium.ConicArcSensorGraphics = _ConicArcSensorGraphics.ConicArcSensorGraphics;Cesium.ConicArcSensorCollection = _ConicArcSensorCollection.ConicArcSensorCollection;var DataSourceDisplay = Cesium.DataSourceDisplay;var originalDefaultVisualizersCallback = DataSourceDisplay.defaultVisualizersCallback;DataSourceDisplay.defaultVisualizersCallback = function(scene, entityCluster, dataSource) {var entities = dataSource.entities;var array = originalDefaultVisualizersCallback(scene, entityCluster, dataSource);return array.concat([new _RectangularSensorVisualizer.RectangularSensorVisualizer(scene, entities)]);};/***/}),/* 6 *//***/(function(module, exports) {module.exports = "in vec4 position;\r\nin vec3 normal;\r\n\r\nout vec3 v_position;\r\nout vec3 v_positionWC;\r\nout vec3 v_positionEC;\r\nout vec3 v_normalEC;\r\n\r\nvoid main()\r\n{\r\n    gl_Position = czm_modelViewProjection * position;\r\n    v_position = vec3(position);\r\n    v_positionWC = (czm_model * position).xyz;\r\n    v_positionEC = (czm_modelView * position).xyz;\r\n    v_normalEC = czm_normal * normal;\r\n}"/***/}),/* 7 *//***/(function(module, exports) {module.exports = "#ifdef GL_OES_standard_derivatives\r\n#extension GL_OES_standard_derivatives : enable\r\n#endif\r\n\r\nuniform bool u_showIntersection;\r\nuniform bool u_showThroughEllipsoid;\r\n\r\nuniform float u_radius;\r\nuniform float u_xHalfAngle;\r\nuniform float u_yHalfAngle;\r\nuniform float u_normalDirection;\r\nuniform float u_type;\r\n\r\nin vec3 v_position;\r\nin vec3 v_positionWC;\r\nin vec3 v_positionEC;\r\nin vec3 v_normalEC;\r\n\r\nvec4 getColor(float sensorRadius, vec3 pointEC)\r\n{\r\n    czm_materialInput materialInput;\r\n\r\n    vec3 pointMC = (czm_inverseModelView * vec4(pointEC, 1.0)).xyz;\r\n    materialInput.st = sensor2dTextureCoordinates(sensorRadius, pointMC);\r\n    materialInput.str = pointMC / sensorRadius;\r\n\r\n    vec3 positionToEyeEC = -v_positionEC;\r\n    materialInput.positionToEyeEC = positionToEyeEC;\r\n\r\n    vec3 normalEC = normalize(v_normalEC);\r\n    materialInput.normalEC = u_normalDirection * normalEC;\r\n\r\n    czm_material material = czm_getMaterial(materialInput);\r\n\r\n    return mix(czm_phong(normalize(positionToEyeEC), material,czm_lightDirectionEC), vec4(material.diffuse, material.alpha), 0.4);\r\n\r\n}\r\n\r\nbool isOnBoundary(float value, float epsilon)\r\n{\r\n    float width = getIntersectionWidth();\r\n    float tolerance = width * epsilon;\r\n\r\n#ifdef GL_OES_standard_derivatives\r\n    float delta = max(abs(dFdx(value)), abs(dFdy(value)));\r\n    float pixels = width * delta;\r\n    float temp = abs(value);\r\n    // There are a couple things going on here.\r\n    // First we test the value at the current fragment to see if it is within the tolerance.\r\n    // We also want to check if the value of an adjacent pixel is within the tolerance,\r\n    // but we don't want to admit points that are obviously not on the surface.\r\n    // For example, if we are looking for \"value\" to be close to 0, but value is 1 and the adjacent value is 2,\r\n    // then the delta would be 1 and \"temp - delta\" would be \"1 - 1\" which is zero even though neither of\r\n    // the points is close to zero.\r\n    return temp < tolerance && temp < pixels || (delta < 10.0 * tolerance && temp - delta < tolerance && temp < pixels);\r\n#else\r\n    return abs(value) < tolerance;\r\n#endif\r\n}\r\n\r\nvec4 shade(bool isOnBoundary)\r\n{\r\n    if (u_showIntersection && isOnBoundary)\r\n    {\r\n        return getIntersectionColor();\r\n    }\r\n    if(u_type == 1.0){\r\n        return getLineColor();\r\n    }\r\n    return getColor(u_radius, v_positionEC);\r\n}\r\n\r\nfloat ellipsoidSurfaceFunction(vec3 point)\r\n{\r\n    vec3 scaled = czm_ellipsoidInverseRadii * point;\r\n    return dot(scaled, scaled) - 1.0;\r\n}\r\n\r\nvoid main()\r\n{\r\n    vec3 sensorVertexWC = czm_model[3].xyz;      // (0.0, 0.0, 0.0) in model coordinates\r\n    vec3 sensorVertexEC = czm_modelView[3].xyz;  // (0.0, 0.0, 0.0) in model coordinates\r\n\r\n    //vec3 pixDir = normalize(v_position);\r\n    float positionX = v_position.x;\r\n    float positionY = v_position.y;\r\n    float positionZ = v_position.z;\r\n\r\n    vec3 zDir = vec3(0.0, 0.0, 1.0);\r\n    vec3 lineX = vec3(positionX, 0 ,positionZ);\r\n    vec3 lineY = vec3(0, positionY, positionZ);\r\n    float resX = dot(normalize(lineX), zDir);\r\n    if(resX < cos(u_xHalfAngle)-0.00001){\r\n        discard;\r\n    }\r\n    float resY = dot(normalize(lineY), zDir);\r\n    if(resY < cos(u_yHalfAngle)-0.00001){\r\n        discard;\r\n    }\r\n\r\n    float ellipsoidValue = ellipsoidSurfaceFunction(v_positionWC);\r\n\r\n    // Occluded by the ellipsoid?\r\n\tif (!u_showThroughEllipsoid)\r\n\t{\r\n\t    // Discard if in the ellipsoid\r\n\t    // PERFORMANCE_IDEA: A coarse check for ellipsoid intersection could be done on the CPU first.\r\n\t    if (ellipsoidValue < 0.0)\r\n\t    {\r\n            discard;\r\n\t    }\r\n\r\n\t    // Discard if in the sensor's shadow\r\n\t    if (inSensorShadow(sensorVertexWC, v_positionWC))\r\n\t    {\r\n\t        discard;\r\n\t    }\r\n    }\r\n\r\n    // Notes: Each surface functions should have an associated tolerance based on the floating point error.\r\n    bool isOnEllipsoid = isOnBoundary(ellipsoidValue, czm_epsilon3);\r\n    //isOnEllipsoid = false;\r\n    //if((resX >= 0.8 && resX <= 0.81)||(resY >= 0.8 && resY <= 0.81)){\r\n    \r\n    out_FragColor = shade(false);\r\n\r\n}"/***/}),/* 8 *//***/(function(module, exports) {module.exports = "uniform vec4 u_intersectionColor;\nuniform float u_intersectionWidth;\nuniform vec4 u_lineColor;\n\nbool inSensorShadow(vec3 coneVertexWC, vec3 pointWC)\n{\n    // Diagonal matrix from the unscaled ellipsoid space to the scaled space.    \n    vec3 D = czm_ellipsoidInverseRadii;\n\n    // Sensor vertex in the scaled ellipsoid space\n    vec3 q = D * coneVertexWC;\n    float qMagnitudeSquared = dot(q, q);\n    float test = qMagnitudeSquared - 1.0;\n    \n    // Sensor vertex to fragment vector in the ellipsoid's scaled space\n    vec3 temp = D * pointWC - q;\n    float d = dot(temp, q);\n    \n    // Behind silhouette plane and inside silhouette cone\n    return (d < -test) && (d / length(temp) < -sqrt(test));\n}\n\n///\n\nvec4 getLineColor()\n{\n    return u_lineColor;\n}\n\nvec4 getIntersectionColor()\n{\n    return u_intersectionColor;\n}\n\nfloat getIntersectionWidth()\n{\n    return u_intersectionWidth;\n}\n\nvec2 sensor2dTextureCoordinates(float sensorRadius, vec3 pointMC)\n{\n    // (s, t) both in the range [0, 1]\n    float t = pointMC.z / sensorRadius;\n    float s = 1.0 + (atan(pointMC.y, pointMC.x) / czm_twoPi);\n    s = s - floor(s);\n    \n    return vec2(s, t);\n}\n"/***/}),/* 9 *//***/(function(module, exports) {module.exports = "#ifdef GL_OES_standard_derivatives\r\n#extension GL_OES_standard_derivatives : enable\r\n#endif\r\n\r\nuniform bool u_showIntersection;\r\nuniform bool u_showThroughEllipsoid;\r\n\r\nuniform float u_radius;\r\nuniform float u_xHalfAngle;\r\nuniform float u_yHalfAngle;\r\nuniform float u_normalDirection;\r\nuniform vec4 u_color;\r\n\r\nin vec3 v_position;\r\nin vec3 v_positionWC;\r\nin vec3 v_positionEC;\r\nin vec3 v_normalEC;\r\n\r\nvec4 getColor(float sensorRadius, vec3 pointEC)\r\n{\r\n    czm_materialInput materialInput;\r\n\r\n    vec3 pointMC = (czm_inverseModelView * vec4(pointEC, 1.0)).xyz;\r\n    materialInput.st = sensor2dTextureCoordinates(sensorRadius, pointMC);\r\n    materialInput.str = pointMC / sensorRadius;\r\n\r\n    vec3 positionToEyeEC = -v_positionEC;\r\n    materialInput.positionToEyeEC = positionToEyeEC;\r\n\r\n    vec3 normalEC = normalize(v_normalEC);\r\n    materialInput.normalEC = u_normalDirection * normalEC;\r\n\r\n    czm_material material = czm_getMaterial(materialInput);\r\n\r\n    material.diffuse = u_color.rgb;\r\n    material.alpha = u_color.a;\r\n\r\n    return mix(czm_phong(normalize(positionToEyeEC), material,czm_lightDirectionEC), vec4(material.diffuse, material.alpha), 0.4);\r\n\r\n}\r\n\r\nbool isOnBoundary(float value, float epsilon)\r\n{\r\n    float width = getIntersectionWidth();\r\n    float tolerance = width * epsilon;\r\n\r\n#ifdef GL_OES_standard_derivatives\r\n    float delta = max(abs(dFdx(value)), abs(dFdy(value)));\r\n    float pixels = width * delta;\r\n    float temp = abs(value);\r\n    // There are a couple things going on here.\r\n    // First we test the value at the current fragment to see if it is within the tolerance.\r\n    // We also want to check if the value of an adjacent pixel is within the tolerance,\r\n    // but we don't want to admit points that are obviously not on the surface.\r\n    // For example, if we are looking for \"value\" to be close to 0, but value is 1 and the adjacent value is 2,\r\n    // then the delta would be 1 and \"temp - delta\" would be \"1 - 1\" which is zero even though neither of\r\n    // the points is close to zero.\r\n    return temp < tolerance && temp < pixels || (delta < 10.0 * tolerance && temp - delta < tolerance && temp < pixels);\r\n#else\r\n    return abs(value) < tolerance;\r\n#endif\r\n}\r\n\r\nvec4 shade(bool isOnBoundary)\r\n{\r\n    if (u_showIntersection && isOnBoundary)\r\n    {\r\n        return getIntersectionColor();\r\n    }\r\n    return getColor(u_radius, v_positionEC);\r\n}\r\n\r\nfloat ellipsoidSurfaceFunction(vec3 point)\r\n{\r\n    vec3 scaled = czm_ellipsoidInverseRadii * point;\r\n    return dot(scaled, scaled) - 1.0;\r\n}\r\n\r\nvoid main()\r\n{\r\n    vec3 sensorVertexWC = czm_model[3].xyz;      // (0.0, 0.0, 0.0) in model coordinates\r\n    vec3 sensorVertexEC = czm_modelView[3].xyz;  // (0.0, 0.0, 0.0) in model coordinates\r\n\r\n    //vec3 pixDir = normalize(v_position);\r\n    float positionX = v_position.x;\r\n    float positionY = v_position.y;\r\n    float positionZ = v_position.z;\r\n\r\n    vec3 zDir = vec3(0.0, 0.0, 1.0);\r\n    vec3 lineX = vec3(positionX, 0 ,positionZ);\r\n    vec3 lineY = vec3(0, positionY, positionZ);\r\n    float resX = dot(normalize(lineX), zDir);\r\n    if(resX < cos(u_xHalfAngle) - 0.0001){\r\n        discard;\r\n    }\r\n    float resY = dot(normalize(lineY), zDir);\r\n    if(resY < cos(u_yHalfAngle)- 0.0001){\r\n        discard;\r\n    }\r\n\r\n    float ellipsoidValue = ellipsoidSurfaceFunction(v_positionWC);\r\n\r\n    // Occluded by the ellipsoid?\r\n\tif (!u_showThroughEllipsoid)\r\n\t{\r\n\t    // Discard if in the ellipsoid\r\n\t    // PERFORMANCE_IDEA: A coarse check for ellipsoid intersection could be done on the CPU first.\r\n\t    if (ellipsoidValue < 0.0)\r\n\t    {\r\n            discard;\r\n\t    }\r\n\r\n\t    // Discard if in the sensor's shadow\r\n\t    if (inSensorShadow(sensorVertexWC, v_positionWC))\r\n\t    {\r\n\t        discard;\r\n\t    }\r\n    }\r\n\r\n    // Notes: Each surface functions should have an associated tolerance based on the floating point error.\r\n    bool isOnEllipsoid = isOnBoundary(ellipsoidValue, czm_epsilon3);\r\n    out_FragColor = shade(false);\r\n\r\n}"/***/}),/* 10 *//***/(function(module, exports, __webpack_require__) {"use strict";Object.defineProperty(exports, "__esModule", {value: true});var defaultValue = Cesium.defaultValue;var defined = Cesium.defined;var defineProperties = Object.defineProperties;var DeveloperError = Cesium.DeveloperError;var Event = Cesium.Event;var createMaterialPropertyDescriptor = Cesium.createMaterialPropertyDescriptor;var createPropertyDescriptor = Cesium.createPropertyDescriptor;function RectangularSensorGraphics(options) {this._show = undefined;this._radius = undefined;this._xHalfAngle = undefined;this._yHalfAngle = undefined;this._lineColor = undefined;this._showSectorLines = undefined;this._showSectorSegmentLines = undefined;this._showLateralSurfaces = undefined;this._material = undefined;this._showDomeSurfaces = undefined;this._showDomeLines = undefined;this._showIntersection = undefined;this._intersectionColor = undefined;this._intersectionWidth = undefined;this._showThroughEllipsoid = undefined;this._gaze = undefined;this._showScanPlane = undefined;this._scanPlaneColor = undefined;this._scanPlaneMode = undefined;this._scanPlaneRate = undefined;this._definitionChanged = new Event();this.merge(defaultValue(options, defaultValue.EMPTY_OBJECT));}defineProperties(RectangularSensorGraphics.prototype, {definitionChanged: {get: function get() {return this._definitionChanged;}},show: createPropertyDescriptor('show'),radius: createPropertyDescriptor('radius'),xHalfAngle: createPropertyDescriptor('xHalfAngle'),yHalfAngle: createPropertyDescriptor('yHalfAngle'),lineColor: createPropertyDescriptor('lineColor'),showSectorLines: createPropertyDescriptor('showSectorLines'),showSectorSegmentLines: createPropertyDescriptor('showSectorSegmentLines'),showLateralSurfaces: createPropertyDescriptor('showLateralSurfaces'),material: createMaterialPropertyDescriptor('material'),showDomeSurfaces: createPropertyDescriptor('showDomeSurfaces'),showDomeLines: createPropertyDescriptor('showDomeLines '),showIntersection: createPropertyDescriptor('showIntersection'),intersectionColor: createPropertyDescriptor('intersectionColor'),intersectionWidth: createPropertyDescriptor('intersectionWidth'),showThroughEllipsoid: createPropertyDescriptor('showThroughEllipsoid'),gaze: createPropertyDescriptor('gaze'),showScanPlane: createPropertyDescriptor('showScanPlane'),scanPlaneColor: createPropertyDescriptor('scanPlaneColor'),scanPlaneMode: createPropertyDescriptor('scanPlaneMode'),scanPlaneRate: createPropertyDescriptor('scanPlaneRate')});RectangularSensorGraphics.prototype.clone = function(result) {if (!defined(result)) {result = new RectangularSensorGraphics();}result.show = this.show;result.radius = this.radius;result.xHalfAngle = this.xHalfAngle;result.yHalfAngle = this.yHalfAngle;result.lineColor = this.lineColor;result.showSectorLines = this.showSectorLines;result.showSectorSegmentLines = this.showSectorSegmentLines;result.showLateralSurfaces = this.showLateralSurfaces;result.material = this.material;result.showDomeSurfaces = this.showDomeSurfaces;result.showDomeLines = this.showDomeLines;result.showIntersection = this.showIntersection;result.intersectionColor = this.intersectionColor;result.intersectionWidth = this.intersectionWidth;result.showThroughEllipsoid = this.showThroughEllipsoid;result.gaze = this.gaze;result.showScanPlane = this.showScanPlane;result.scanPlaneColor = this.scanPlaneColor;result.scanPlaneMode = this.scanPlaneMode;result.scanPlaneRate = this.scanPlaneRate;return result;};RectangularSensorGraphics.prototype.merge = function(source) {if (!defined(source)) {throw new DeveloperError('source is required.');}this.show = defaultValue(this.show, source.show);this.radius = defaultValue(this.radius, source.radius);this.xHalfAngle = defaultValue(this.xHalfAngle, source.xHalfAngle);this.yHalfAngle = defaultValue(this.yHalfAngle, source.yHalfAngle);this.lineColor = defaultValue(this.lineColor, source.lineColor);this.showSectorLines = defaultValue(this.showSectorLines, source.showSectorLines);this.showSectorSegmentLines = defaultValue(this.showSectorSegmentLines, source.showSectorSegmentLines);this.showLateralSurfaces = defaultValue(this.showLateralSurfaces, source.showLateralSurfaces);this.material = defaultValue(this.material, source.material);this.showDomeSurfaces = defaultValue(this.showDomeSurfaces, source.showDomeSurfaces);this.showDomeLines = defaultValue(this.showDomeLines, source.showDomeLines);this.showIntersection = defaultValue(this.showIntersection, source.showIntersection);this.intersectionColor = defaultValue(this.intersectionColor, source.intersectionColor);this.intersectionWidth = defaultValue(this.intersectionWidth, source.intersectionWidth);this.showThroughEllipsoid = defaultValue(this.showThroughEllipsoid, source.showThroughEllipsoid);this.gaze = defaultValue(this.gaze, source.gaze);this.showScanPlane = defaultValue(this.showScanPlane, source.showScanPlane);this.scanPlaneColor = defaultValue(this.scanPlaneColor, source.scanPlaneColor);this.scanPlaneMode = defaultValue(this.scanPlaneMode, source.scanPlaneMode);this.scanPlaneRate = defaultValue(this.scanPlaneRate, source.scanPlaneRate);};exports.RectangularSensorGraphics = RectangularSensorGraphics;/***/}),/* 11 *//***/(function(module, exports, __webpack_require__) {"use strict";Object.defineProperty(exports, "__esModule", {value: true});exports.RectangularSensorVisualizer = undefined;var _RectangularSensorPrimitive = __webpack_require__(0);var AssociativeArray = Cesium.AssociativeArray;var Cartesian3 = Cesium.Cartesian3;var Color = Cesium.Color;var defined = Cesium.defined;var destroyObject = Cesium.destroyObject;var DeveloperError = Cesium.DeveloperError;var Matrix3 = Cesium.Matrix3;var Matrix4 = Cesium.Matrix4;var Quaternion = Cesium.Quaternion;var MaterialProperty = Cesium.MaterialProperty;var Property = Cesium.Property;var matrix3Scratch = new Matrix3();var matrix4Scratch = new Matrix4();var cachedPosition = new Cartesian3();var cachedGazePosition = new Cartesian3();var cachedOrientation = new Quaternion();var diffVectorScratch = new Cartesian3();var orientationScratch = new Quaternion();function removePrimitive(entity, hash, primitives) {var data = hash[entity.id];if (defined(data)) {var primitive = data.primitive;primitives.remove(primitive);if (!primitive.isDestroyed()) {primitive.destroy();}delete hash[entity.id];}};var RectangularSensorVisualizer = function RectangularSensorVisualizer(scene, entityCollection) {// >>includeStart('debug', pragmas.debug);if (!defined(scene)) {throw new DeveloperError('scene is required.');}if (!defined(entityCollection)) {throw new DeveloperError('entityCollection is required.');}// >>includeEnd('debug');entityCollection.collectionChanged.addEventListener(RectangularSensorVisualizer.prototype._onCollectionChanged, this);this._scene = scene;this._primitives = scene.primitives;this._entityCollection = entityCollection;this._hash = {};this._entitiesToVisualize = new AssociativeArray();this._onCollectionChanged(entityCollection, entityCollection.values, [], []);};/*** Updates the primitives created by this visualizer to match their* Entity counterpart at the given time.** @param {JulianDate} time The time to update to.* @returns {Boolean} This function always returns true.*/RectangularSensorVisualizer.prototype.update = function(time) {// >>includeStart('debug', pragmas.debug);if (!defined(time)) {throw new DeveloperError('time is required.');}// >>includeEnd('debug');var entities = this._entitiesToVisualize.values;var hash = this._hash;var primitives = this._primitives;for (var i = 0, len = entities.length; i < len; i++) {var entity = entities[i];var rectangularSensorGraphics = entity._rectangularSensor;var position;var orientation;var radius;var xHalfAngle;var yHalfAngle;var data = hash[entity.id];var show = entity.isShowing && entity.isAvailable(time) && Property.getValueOrDefault(rectangularSensorGraphics._show, time, true);if (show) {position = Property.getValueOrUndefined(entity._position, time, cachedPosition);orientation = Property.getValueOrUndefined(entity._orientation, time, cachedOrientation);radius = Property.getValueOrUndefined(rectangularSensorGraphics._radius, time);xHalfAngle = Property.getValueOrUndefined(rectangularSensorGraphics._xHalfAngle, time);yHalfAngle = Property.getValueOrUndefined(rectangularSensorGraphics._yHalfAngle, time);show = defined(position) && defined(xHalfAngle) && defined(yHalfAngle);}if (!show) {// don't bother creating or updating anything elseif (defined(data)) {data.primitive.show = false;}continue;}var primitive = defined(data) ? data.primitive : undefined;if (!defined(primitive)) {primitive = new _RectangularSensorPrimitive.RectangularSensorPrimitive();primitive.id = entity;primitives.add(primitive);data = {primitive: primitive,position: undefined,orientation: undefined};hash[entity.id] = data;}var gaze = Property.getValueOrUndefined(rectangularSensorGraphics._gaze, time);if (defined(gaze)) {var targetPosition = Property.getValueOrUndefined(gaze._position, time, cachedGazePosition);if (!defined(position) || !defined(targetPosition)) {continue;}var diffVector = Cartesian3.subtract(position, targetPosition, diffVectorScratch);var rotate = Cartesian3.angleBetween(Cesium.Cartesian3.UNIT_Z, diffVector);var cross = Cartesian3.cross(Cesium.Cartesian3.UNIT_Z, diffVector, diffVectorScratch);var orientation = Quaternion.fromAxisAngle(cross, rotate - Math.PI, orientationScratch);//replace original radiusradius = Cartesian3.distance(position, targetPosition);primitive.modelMatrix = Matrix4.fromRotationTranslation(Matrix3.fromQuaternion(orientation, matrix3Scratch), position, primitive.modelMatrix);} else {if (!Cartesian3.equals(position, data.position) || !Quaternion.equals(orientation, data.orientation)) {if (defined(orientation)) {primitive.modelMatrix = Matrix4.fromRotationTranslation(Matrix3.fromQuaternion(orientation, matrix3Scratch), position, primitive.modelMatrix);data.position = Cartesian3.clone(position, data.position);data.orientation = Quaternion.clone(orientation, data.orientation);} else {primitive.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(position);data.position = Cartesian3.clone(position, data.position);}}}primitive.show = true;primitive.gaze = gaze;primitive.radius = radius;primitive.xHalfAngle = xHalfAngle;primitive.yHalfAngle = yHalfAngle;primitive.lineColor = Property.getValueOrDefault(rectangularSensorGraphics._lineColor, time, Color.WHITE);primitive.showSectorLines = Property.getValueOrDefault(rectangularSensorGraphics._showSectorLines, time, true);primitive.showSectorSegmentLines = Property.getValueOrDefault(rectangularSensorGraphics._showSectorSegmentLines, time, true);primitive.showLateralSurfaces = Property.getValueOrDefault(rectangularSensorGraphics._showLateralSurfaces, time, true);primitive.material = MaterialProperty.getValue(time, rectangularSensorGraphics._material, primitive.material);primitive.showDomeSurfaces = Property.getValueOrDefault(rectangularSensorGraphics._showDomeSurfaces, time, true);primitive.showDomeLines = Property.getValueOrDefault(rectangularSensorGraphics._showDomeLines, time, true);primitive.showIntersection = Property.getValueOrDefault(rectangularSensorGraphics._showIntersection, time, true);primitive.intersectionColor = Property.getValueOrDefault(rectangularSensorGraphics._intersectionColor, time, Color.WHITE);primitive.intersectionWidth = Property.getValueOrDefault(rectangularSensorGraphics._intersectionWidth, time, 1);primitive.showThroughEllipsoid = Property.getValueOrDefault(rectangularSensorGraphics._showThroughEllipsoid, time, true);primitive.scanPlaneMode = Property.getValueOrDefault(rectangularSensorGraphics._scanPlaneMode, time);primitive.scanPlaneColor = Property.getValueOrDefault(rectangularSensorGraphics._scanPlaneColor, time, Color.WHITE);primitive.showScanPlane = Property.getValueOrDefault(rectangularSensorGraphics._showScanPlane, time, true);primitive.scanPlaneRate = Property.getValueOrDefault(rectangularSensorGraphics._scanPlaneRate, time, 1);}return true;};/*** Returns true if this object was destroyed; otherwise, false.** @returns {Boolean} True if this object was destroyed; otherwise, false.*/RectangularSensorVisualizer.prototype.isDestroyed = function() {return false;};/*** Removes and destroys all primitives created by this instance.*/RectangularSensorVisualizer.prototype.destroy = function() {var entities = this._entitiesToVisualize.values;var hash = this._hash;var primitives = this._primitives;for (var i = entities.length - 1; i > -1; i--) {removePrimitive(entities[i], hash, primitives);}return destroyObject(this);};/*** @private*/RectangularSensorVisualizer.prototype._onCollectionChanged = function(entityCollection, added, removed, changed) {var i;var entity;var entities = this._entitiesToVisualize;var hash = this._hash;var primitives = this._primitives;for (i = added.length - 1; i > -1; i--) {entity = added[i];if (defined(entity._rectangularSensor) && defined(entity._position)) {entities.set(entity.id, entity);}}for (i = changed.length - 1; i > -1; i--) {entity = changed[i];if (defined(entity._rectangularSensor) && defined(entity._position)) {entities.set(entity.id, entity);} else {removePrimitive(entity, hash, primitives);entities.remove(entity.id);}}for (i = removed.length - 1; i > -1; i--) {entity = removed[i];removePrimitive(entity, hash, primitives);entities.remove(entity.id);}};exports.RectangularSensorVisualizer = RectangularSensorVisualizer;/***/}),/* 12 *//***/(function(module, exports, __webpack_require__) {"use strict";Object.defineProperty(exports, "__esModule", {value: true});exports.ConicArcSensorCollection = undefined;var _ConicArcSensorGeometry = __webpack_require__(1);var _ConicArcSensorOutlineGeometry = __webpack_require__(2);var _ConicArcSensor = __webpack_require__(13);var defaultValue = Cesium.defaultValue;var defined = Cesium.defined;var Viewer = Cesium.Viewer;var Transforms = Cesium.Transforms;var DeveloperError = Cesium.DeveloperError;var ColorGeometryInstanceAttribute = Cesium.ColorGeometryInstanceAttribute;var Color = Cesium.Color;var Primitive = Cesium.Primitive;var PerInstanceColorAppearance = Cesium.PerInstanceColorAppearance;var Cartesian3 = Cesium.Cartesian3;var VertexFormat = Cesium.VertexFormat;var Quaternion = Cesium.Quaternion;var Matrix3 = Cesium.Matrix3;var Matrix4 = Cesium.Matrix4;var Property = Cesium.Property;var Event = Cesium.Event;var DistanceDisplayCondition = Cesium.DistanceDisplayCondition;var DistanceDisplayConditionGeometryInstanceAttribute = Cesium.DistanceDisplayConditionGeometryInstanceAttribute;function ConicArcSensorCollection(viewer) {var self = this;if (!defined(viewer)) {throw new DeveloperError('viewer is required.');}this._viewer = viewer;var scene = viewer.scene;this._scene = scene;var clock = viewer.clock;this._clock = clock;this._primitives = scene.primitives;this._primitive = undefined;this._outlinePrimitive = undefined;this._conicArcSensorCollection = [];clock.onTick.addEventListener(function() {self.update();});}var matrix3Scratch = new Matrix3();var matrix4Scratch = new Matrix4();var positionScratch = new Cartesian3();var targetPositionScratch = new Cartesian3();var diffVectorScratch = new Cartesian3();var orientationScratch = new Quaternion();ConicArcSensorCollection.prototype.add = function(conicArcSensor) {if (!(conicArcSensor instanceof _ConicArcSensor.ConicArcSensor)) {conicArcSensor = new _ConicArcSensor.ConicArcSensor(conicArcSensor);}this._conicArcSensorCollection.push(conicArcSensor);return conicArcSensor;};ConicArcSensorCollection.prototype.remove = function(conicArcSensor) {var index = this._conicArcSensorCollection.indexOf(conicArcSensor);if (index !== -1) {this._conicArcSensorCollection.splice(index, 1);}};ConicArcSensorCollection.prototype.removeAll = function() {this._conicArcSensorCollection.length = 0;};ConicArcSensorCollection.prototype.update = function() {var time = this._clock.currentTime;var conicArcSensorCollection = this._conicArcSensorCollection;var primitives = this._primitives;var primitive = this._primitive;var outlinePrimitive = this._outlinePrimitive;var instances = [];var outlineInstances = [];if (defined(primitive)) {primitives.removeAndDestroy(primitive);}if (defined(outlinePrimitive)) {primitives.removeAndDestroy(outlinePrimitive);}for (var i = 0, len = conicArcSensorCollection.length; i < len; i++) {var entity = conicArcSensorCollection[i];var conicArcSensor = entity._conicArcSensor;if (!Property.getValueOrDefault(conicArcSensor.show, time, true)) {continue;}var angle = conicArcSensor.angle;var radius = conicArcSensor.radius;var stack = conicArcSensor.stack;var slice = conicArcSensor.slice;if (!defined(angle)) {continue;}var show = Property.getValueOrDefault(entity.show, time, true);if (!show) {continue;}var position = Property.getValueOrUndefined(entity.position, time, positionScratch);if (!defined(position)) {continue;}var modelMatrix;var gaze = conicArcSensor.gaze;if (defined(gaze)) {//ignore original orientationvar targetPosition = Property.getValueOrUndefined(gaze.position, time, targetPositionScratch);if (!defined(position) || !defined(targetPosition)) {continue;}var diffVector = Cartesian3.subtract(position, targetPosition, diffVectorScratch);var rotate = Cartesian3.angleBetween(Cesium.Cartesian3.UNIT_Z, diffVector);var cross = Cartesian3.cross(Cesium.Cartesian3.UNIT_Z, diffVector, diffVectorScratch);//朝上//var orientation = Quaternion.fromAxisAngle(cross, (rotate - Math.PI), orientationScratch);var orientation = Quaternion.fromAxisAngle(cross, rotate, orientationScratch);//replace original dimensionsvar distance = Cartesian3.distance(position, targetPosition);radius = 1;modelMatrix = Matrix4.fromRotationTranslation(Cesium.Matrix3.multiplyByScalar(Matrix3.fromQuaternion(orientation, matrix3Scratch), distance, matrix3Scratch), position, matrix4Scratch);} else {var orientation = Property.getValueOrUndefined(entity.orientation, time, orientationScratch);if (!defined(orientation)) {modelMatrix = Transforms.eastNorthUpToFixedFrame(position, undefined, matrix4Scratch);} else {modelMatrix = Matrix4.fromRotationTranslation(Matrix3.fromQuaternion(orientation, matrix3Scratch), position, matrix4Scratch);}}if (!defined(modelMatrix)) {continue;}var geometry = entity._geometry;if (!defined(geometry)) {var conic;conic = new _ConicArcSensorGeometry.ConicArcSensorGeometry({vertexFormat: Cesium.VertexFormat.POSITION_AND_NORMAL,angle: angle,radius: radius,stackPartitions: stack,slicePartitions: slice});entity._geometry = _ConicArcSensorGeometry.ConicArcSensorGeometry.createGeometry(conic);geometry = entity._geometry;}//var distanceDisplayCondition = Property.getValueOrDefault(conicArcSensor.distanceDisplayCondition, time, entity._distanceDisplayCondition);//var distanceDisplayConditionAttribute = DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(distanceDisplayCondition);//var shadows = Property.getValueOrDefault(conicArcSensor.shadows, time, ShadowMode.DISABLED);var color = conicArcSensor.color;var outline = conicArcSensor.outline;var outlineWidth = conicArcSensor.outlineWidth;if (!defined(outlineWidth)) {outlineWidth = 1;}var outlineColor = conicArcSensor.outlineColor;if (!defined(outlineColor)) {outlineColor = Color.WHITE;}var instance = new Cesium.GeometryInstance({geometry: geometry,modelMatrix: modelMatrix,attributes: {color: Cesium.ColorGeometryInstanceAttribute.fromColor(color)//distanceDisplayCondition: distanceDisplayConditionAttribute}});instances.push(instance);if (outline) {var outlineGeometry = entity._outlineGeometry;if (!defined(outlineGeometry)) {var conicOutline;conicOutline = new _ConicArcSensorOutlineGeometry.ConicArcSensorOutlineGeometry({vertexFormat: Cesium.VertexFormat.POSITION_ONLY,angle: angle,radius: radius});entity._outlineGeometry = _ConicArcSensorOutlineGeometry.ConicArcSensorOutlineGeometry.createGeometry(conicOutline);outlineGeometry = entity._outlineGeometry;}var instance = new Cesium.GeometryInstance({geometry: outlineGeometry,modelMatrix: modelMatrix,attributes: {color: Cesium.ColorGeometryInstanceAttribute.fromColor(outlineColor)//distanceDisplayCondition: distanceDisplayConditionAttribute}});outlineInstances.push(instance);}}if (instances.length > 0) {this._primitive = this._primitives.add(new Primitive({asynchronous: false,geometryInstances: instances,appearance: new PerInstanceColorAppearance({flat: false,translucent: true,closed: true})}));}if (outlineInstances.length > 0) {this._outlinePrimitive = this._primitives.add(new Primitive({asynchronous: false,geometryInstances: outlineInstances,appearance: new PerInstanceColorAppearance({flat: true,translucent: true,renderState: {lineWidth: this._scene.clampLineWidth(outlineWidth)}})}));}};exports.ConicArcSensorCollection = ConicArcSensorCollection;/***/}),/* 13 *//***/(function(module, exports, __webpack_require__) {"use strict";Object.defineProperty(exports, "__esModule", {value: true});exports.ConicArcSensor = undefined;var _ConicArcSensorGraphics = __webpack_require__(3);var Entity = Cesium.Entity;var Event = Cesium.Event;var ConstantPositionProperty = Cesium.ConstantPositionProperty;var createPropertyDescriptor = Cesium.createPropertyDescriptor;var DistanceDisplayCondition = Cesium.DistanceDisplayCondition;var DistanceDisplayConditionGeometryInstanceAttribute = Cesium.DistanceDisplayConditionGeometryInstanceAttribute;function createConstantPositionProperty(value) {return new ConstantPositionProperty(value);}function createPositionPropertyDescriptor(name) {return createPropertyDescriptor(name, undefined, createConstantPositionProperty);}function ConicArcSensor(options) {options = options || {};this._position = undefined;this._orientation = undefined;this._show = undefined;var conicArcSensor = options.conicArcSensor;if (!(conicArcSensor instanceof _ConicArcSensorGraphics.ConicArcSensorGraphics)) {conicArcSensor = new _ConicArcSensorGraphics.ConicArcSensorGraphics(conicArcSensor);}this._conicArcSensor = conicArcSensor;this._distanceDisplayCondition = new DistanceDisplayCondition();this._geometry = undefined;this._outlineGeometry = undefined;this._definitionChanged = new Event();this.merge(options);}Object.defineProperties(ConicArcSensor.prototype, {position: createPositionPropertyDescriptor('position'),orientation: createPropertyDescriptor('orientation'),show: createPropertyDescriptor('show')});ConicArcSensor.prototype.merge = function(options) {this.position = options.position;this.orientation = options.orientation;this.show = options.show;};ConicArcSensor.prototype.gazeAt = function(entity) {if (entity instanceof Entity) {this._conicArcSensor.gaze = entity;}};exports.ConicArcSensor = ConicArcSensor;/***/})/******/]);
});

vue页面

<template></template><script>
import "@/utils/cesiumPlugin/CesiumGeometry.js";export default {mounted() {let r = new Cesium.HeadingPitchRoll(Cesium.Math.toRadians(90),Cesium.Math.toRadians(0),Cesium.Math.toRadians(0));let l = Cesium.Cartesian3.fromDegrees(114.649289, 37.95202, 3000);let sensorEntity = viewer.entities.add({position: l,orientation: Cesium.Transforms.headingPitchRollQuaternion(l, r),rectangularSensor: new Cesium.RectangularSensorGraphics({radius: 1000,xHalfAngle: Cesium.Math.toRadians(45),yHalfAngle: Cesium.Math.toRadians(45),material: new Cesium.Color(1.0, 0.0, 1.0, 0.4),lineColor: new Cesium.Color(1.0, 0.0, 1.0, 1.0),showScanPlane: false,scanPlaneColor: new Cesium.Color(1.0, 0.0, 1.0, 1.0),scanPlaneMode: "vertical",scanPlaneRate: 3,showThroughEllipsoid: !1,}),});},
};
</script><style>
</style>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/372989.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Vue CoreVideoPlayer 一款基于 vue.js 的轻量级、优秀的视频播放器组件

大家好,我是程序视点的小二哥!今天小二哥给大家推荐一款非常优秀的视频播放组件 效果欣赏 介绍 Vue-CoreVideoPlayer 一款基于vue.js的轻量级的视频播放器插件。 采用Adobd XD进行UI设计&#xff0c;支持移动端适配,不仅功能强大&#xff0c;颜值也是超一流&#xff01; Vue-…

我们公司落地大模型的路径、方法和坑

我们公司落地大模型的路径、方法和坑 李木子 AI大模型实验室 2024年07月02日 18:35 北京 最近一年&#xff0c;LLM&#xff08;大型语言模型&#xff09;已经成熟到可以投入实际应用中了。预计到 2025 年&#xff0c;AI 领域的投资会飙升到 2000 亿美元。现在&#xff0c;不只…

【Java 的四大引用详解】

首先分别介绍一下这几种引用 强引用&#xff1a; 只要能通过GC ROOT根对象引用链找到就不会被垃圾回收器回收&#xff0c;当所有的GC Root都不通过强引用引用该对象时&#xff0c;才能被垃圾回收器回收。 软引用&#xff08;SoftReference&#xff09;&#xff1a; 当只有软引…

Tomcat部署以及优化

1、tomcat tomcat是用java代码的程序&#xff0c;运行的是java的web服务器 tomcat和php一样都是用来处理动态页面&#xff0c;tomcat也可以做为web应用服务器&#xff0c;开源的 php处理.php为结尾的 tomcat 处理.jsp nginx 处理 .html 2、tomcat的特点和功能 1、servle…

超详细!Jmeter 压测-设计5W并发量场景

需求&#xff1a;设计一个5W并发量的性能场景&#xff1f; 1、确定性能测试工具&#xff0c;性能测试思路 测试工具&#xff1a;Jmeter 并发设计思路&#xff1a;如果被测服务足够快&#xff0c;比如10ms的响应时间&#xff0c;1个线程/秒就是100tps&#xff0c;5万的TPS&…

MySQL之基本查询(上)-表的增删查改

目录 Create(创建) 案例建表 插入 单行数据 指定列插入 单行数据 全列插入 多行数据 全列插入 插入是否更新 插入时更新 替换 Retrieve(读取) 建表插入 select列 全列查询 指定列查询 查询字段为表达式 为查询结果指定别名 结果去重 where条件 比较运算符 逻辑运…

嵌入式代码升级——IAP

目录 IAP的特点 实现 IAP 功能 STM32 正常的程序运行流程 STM32 加入IAP后的运行流程 程序执行流程 BootLoader程序 APP1程序 APP2程序 验证操作步骤 IAP&#xff08;In-Application Programming&#xff09;指的是在应用程序运行时对其自身的Flash存储器进行编程的操作…

招投标信息采集系统:让您的企业始终站在行业前沿

一、为何招投标信息如此关键&#xff1f; 在经济全球化的大背景下&#xff0c;招投标活动日益频繁&#xff0c;成为企业获取项目、拓展市场的主流方式之一。招投标信息采集&#xff0c;作为企业战略决策的前置环节&#xff0c;其重要性不言而喻。它不仅关乎企业能否第一时间发…

如何网页在线编辑微软Office Word,并导出为PDF格式。

随着互联网技术的不断发展&#xff0c;越来越多的企业开始采用在线办公模式&#xff0c;微软Office Word 是最好用的文档编辑工具&#xff0c;然而doc、docx、xls、xlsx、ppt、pptx等格式的Office文档是无法直接在浏览器中直接打开的&#xff0c;如果可以实现Web在线预览编辑Of…

git只列出本地分支

git只列出本地分支 git branch --list git强制删除本地分支 git branch -D_error: the branch dlx-test is not fully merged. -CSDN博客文章浏览阅读648次。git branch -d 可以通过: git branch 查看所有本地分支及其名字&#xff0c;然后删除特定分支。git删除远程remote分支…

互联网医院系统,开发互联网医院设计哪些功能?

随着科技的进步和数字化转型的推动&#xff0c;互联网医院系统已成为现代医疗服务的重要组成部分。这一系统通过整合信息技术与医疗资源&#xff0c;为用户提供便捷、高效的医疗服务。以下是互联网医院系统的主要功能介绍。 1、在线咨询与诊断 互联网医院系统允许患者通过网络平…

IEC62056标准体系简介-2.IEC62056标准体系及对象标识系统(OBIS)

1. IEC 62056标准体系 IEC 62056标准体系目前共包括六部分&#xff0c;见图1&#xff1a; 第61部分&#xff1a;对象标识系统第62部分&#xff1a;接口类第53部分&#xff1a;COSEM应用层第46部分&#xff1a;使用HDLC&#xff08;High Level Data Link Control&#xff09;协…

54、一维和二维自组织映射(matlab)

1、一维和二维自组织映射原理 一维和二维自组织映射&#xff08;Self-Organizing Maps, SOM&#xff09;是一种无监督的机器学习算法&#xff0c;通过学习输入数据的拓扑结构&#xff0c;将高维输入数据映射到低维的网格结构中&#xff0c;使得相似的输入数据点在映射空间中也…

阿尔泰科技与西安交通大学陕西省某技术重点实验室共谋未来!

近日&#xff0c;阿尔泰科技的电子工程师&#xff08;熊工&#xff09;应邀前往西安交通大学陕西省某技术重点实验室&#xff0c;参与课题组项目的测试与调试工作。此次合作不仅成功推动了项目的进展&#xff0c;还为未来的深入合作奠定了坚实基础。 阿尔泰科技作为领先的测控技…

刷题之删除有序数组中的重复项(leetcode)

删除有序数组中的重复项 这题简单题&#xff0c;双指针&#xff0c;一个指针记录未重复的数的个数&#xff0c;另一个记录遍历的位置。 以下是简单模拟&#xff0c;可以优化&#xff1a; class Solution { public:int removeDuplicates(vector<int>& nums) {int l0…

Debezium报错处理系列之第114篇:No TableMapEventData has been found for table id:256.

Debezium报错处理系列之第114篇:Caused by: com.github.shyiko.mysql.binlog.event.deserialization.MissingTableMapEventException: No TableMapEventData has been found for table id:256. Usually that means that you have started reading binary log within the logic…

博美犬插画:成都亚恒丰创教育科技有限公司

​博美犬插画&#xff1a;萌动心灵的细腻笔触 在浩瀚的艺术海洋中&#xff0c;有一种艺术形式总能以它独有的温柔与细腻&#xff0c;触动人心最柔软的部分——那便是插画。而当插画遇上博美犬这一萌宠界的明星&#xff0c;便诞生了一幅幅令人爱不释手的作品&#xff0c;成都亚…

代码随想录打卡第十八天

代码随想录–二叉树部分 day 17 休息日 day 18 二叉树第五天 文章目录 代码随想录--二叉树部分一、力扣654--最大二叉树二、力扣617--合并二叉树三、力扣700--二乘树中的搜素四、力扣98--验证二叉搜索树 一、力扣654–最大二叉树 代码随想录题目链接&#xff1a;代码随想录 给…

美容师有什么话术技巧?美业人如何提升自己的销售技巧?博弈美业门店管理系统分享经验

作为一名美容师&#xff0c;有一些话术和销售技巧可以帮助你提升服务质量和销售业绩。以下是博弈美业收银系统分享的一些建议&#xff1a; 1.建立信任&#xff1a; 在与客户交流时&#xff0c;表现出真诚、友好和专业的态度。倾听客户的需求&#xff0c;并给予针对性的建议&a…

随笔(一)

1.即时通信软件原理&#xff08;发展&#xff09; 即时通信软件实现原理_即时通讯原理-CSDN博客 笔记&#xff1a; 2.泛洪算法&#xff1a; 算法介绍 | 泛洪算法&#xff08;Flood fill Algorithm&#xff09;-CSDN博客 漫水填充算法实现最常见有四邻域像素填充法&#xf…