cesium 扫描线_Cesium学习(五):雷达扫描

/*

添加雷达扫描线 地形遮挡开启

cartographicCenter 扫描中心

radius 半径 米

scanColor 扫描颜色

duration 持续时间 毫秒

*/

function addRadarScanPostStage(cartographicCenter, radius, scanColor, duration) {

var ScanSegmentShader =

"uniform sampler2D colorTexture;\n" +

"uniform sampler2D depthTexture;\n" +

"varying vec2 v_textureCoordinates;\n" +

"uniform vec4 u_scanCenterEC;\n" +

"uniform vec3 u_scanPlaneNormalEC;\n" +

"uniform vec3 u_scanLineNormalEC;\n" +

"uniform float u_radius;\n" +

"uniform vec4 u_scanColor;\n" +

"vec4 toEye(in vec2 uv, in float depth)\n" +

" {\n" +

" vec2 xy = vec2((uv.x * 2.0 - 1.0),(uv.y * 2.0 - 1.0));\n" +

" vec4 posInCamera =czm_inverseProjection * vec4(xy, depth, 1.0);\n" +

" posInCamera =posInCamera / posInCamera.w;\n" +

" return posInCamera;\n" +

" }\n" +

"bool isPointOnLineRight(in vec3 ptOnLine, in vec3 lineNormal, in vec3 testPt)\n" +

"{\n" +

"vec3 v01 = testPt - ptOnLine;\n" +

"normalize(v01);\n" +

"vec3 temp = cross(v01, lineNormal);\n" +

"float d = dot(temp, u_scanPlaneNormalEC);\n" +

"return d > 0.5;\n" +

"}\n" +

"vec3 pointProjectOnPlane(in vec3 planeNormal, in vec3 planeOrigin, in vec3 point)\n" +

"{\n" +

"vec3 v01 = point -planeOrigin;\n" +

"float d = dot(planeNormal, v01) ;\n" +

"return (point - planeNormal * d);\n" +

"}\n" +

"float distancePointToLine(in vec3 ptOnLine, in vec3 lineNormal, in vec3 testPt)\n" +

"{\n" +

"vec3 tempPt = pointProjectOnPlane(lineNormal, ptOnLine, testPt);\n" +

"ret

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值