创建从对象的位置和半径以及相机位置派生的封堵器。封堵器可用于确定其他对象是否可见或隐藏在由封堵器和相机位置定义的可见地平线之后。
new Occluder(occluderBoundingSphere, cameraPosition)
Parameters:
Example
// Construct an occluder one unit away from the origin with a radius of one.
var cameraPosition = bmgl.Cartesian3.ZERO;
var occluderBoundingSphere = new bmgl.BoundingSphere(new bmgl.Cartesian3(0, 0, -1), 1);
var occluder = new bmgl.Occluder(occluderBoundingSphere, cameraPosition);
Members
cameraPosition : Cartesian3
相机的位置。
position : Cartesian3
封堵器的位置。
radius : Number
封堵器的半径。
Methods
(static) computeOccludeePoint(occluderBoundingSphere, occludeePosition, positions) → {Object}
计算一个点,该点可用作可见性函数的遮掩位置。使用半径为零作为遮挡半径。通常,用户计算用于可见性的对象周围的边界球;但是,也可以计算一个点,如果看到/不看到,也会指示对象是否可见/不可见。对于相对于遮光罩不移动且较大的对象(如一块地形),更好地调用此函数。最好不要这样称呼,不要将对象的边界球用于卫星或地面车辆等对象。
Parameters:
Example
var cameraPosition = new bmgl.Cartesian3(0, 0, 0);
var occluderBoundingSphere = new bmgl.BoundingSphere(new bmgl.Cartesian3(0, 0, -8), 2);
var occluder = new bmgl.Occluder(occluderBoundingSphere, cameraPosition);
var positions = [new bmgl.Cartesian3(-0.25, 0, -5.3), new bmgl.Cartesian3(0.25, 0, -5.3)];
var tileOccluderSphere = bmgl.BoundingSphere.fromPoints(positions);
var occludeePosition = tileOccluderSphere.center;
var occludeePt = bmgl.Occluder.computeOccludeePoint(occluderBoundingSphere, occludeePosition, positions);
Throws
-
DeveloperError :
positions
必须至少包含一个元素。
计算一个点,该点可用作矩形中可见性函数的遮挡位置。
Parameters:
从边界球体和相机位置创建遮光罩。
Parameters:
确定封堵器的可见程度(不可见、部分可见或完全可见)。
Parameters:
Example
var sphere1 = new bmgl.BoundingSphere(new bmgl.Cartesian3(0, 0, -1.5), 0.5);
var sphere2 = new bmgl.BoundingSphere(new bmgl.Cartesian3(0, 0, -2.5), 0.5);
var cameraPosition = new bmgl.Cartesian3(0, 0, 0);
var occluder = new bmgl.Occluder(sphere1, cameraPosition);
occluder.computeVisibility(sphere2); //returns Visibility.NONE
- Occluder#isVisible
See:
确定遮挡器是否隐藏了一个球体,即
occludee
。
Parameters:
Example
var cameraPosition = new bmgl.Cartesian3(0, 0, 0);
var littleSphere = new bmgl.BoundingSphere(new bmgl.Cartesian3(0, 0, -1), 0.25);
var occluder = new bmgl.Occluder(littleSphere, cameraPosition);
var bigSphere = new bmgl.BoundingSphere(new bmgl.Cartesian3(0, 0, -3), 1);
occluder.isBoundingSphereVisible(bigSphere); //returns true
确定遮挡器是否隐藏了一个点,即
occludee
。