MCPcopy
hub / github.com/CesiumGS/cesium / getRayIntersection

Function getRayIntersection

packages/engine/Source/Scene/Picking.js:1102–1186  ·  view source on GitHub ↗
(
  picking,
  scene,
  ray,
  objectsToExclude,
  width,
  requirePosition,
  mostDetailed,
)

Source from the content-addressed store, hash-verified

1100}
1101
1102function getRayIntersection(
1103 picking,
1104 scene,
1105 ray,
1106 objectsToExclude,
1107 width,
1108 requirePosition,
1109 mostDetailed,
1110) {
1111 const { context, frameState } = scene;
1112 const uniformState = context.uniformState;
1113
1114 const view = picking._pickOffscreenView;
1115 scene.view = view;
1116
1117 updateOffscreenCameraFromRay(picking, ray, width, view.camera);
1118
1119 const drawingBufferRectangle = BoundingRectangle.clone(
1120 view.viewport,
1121 scratchRectangle,
1122 );
1123
1124 const passState = view.pickFramebuffer.begin(
1125 drawingBufferRectangle,
1126 view.viewport,
1127 );
1128
1129 scene.jobScheduler.disableThisFrame();
1130
1131 scene.updateFrameState();
1132 frameState.invertClassification = false;
1133 frameState.passes.pick = true;
1134 frameState.passes.offscreen = true;
1135
1136 if (mostDetailed) {
1137 frameState.tilesetPassState = mostDetailedPickTilesetPassState;
1138 } else {
1139 frameState.tilesetPassState = pickTilesetPassState;
1140 }
1141
1142 uniformState.update(frameState);
1143
1144 scene.updateEnvironment();
1145 scene.updateAndExecuteCommands(passState, scratchColorZero);
1146 scene.resolveFramebuffers(passState);
1147
1148 let position;
1149 // Picking one object, result is either [object] or []
1150 const object = view.pickFramebuffer.end(drawingBufferRectangle, 1)[0];
1151
1152 if (scene.context.depthTexture) {
1153 const { frustumCommandsList } = view;
1154 const numFrustums = frustumCommandsList.length;
1155 for (let i = 0; i < numFrustums; ++i) {
1156 const pickDepth = picking.getPickDepth(scene, i);
1157 const depth = pickDepth.getDepth(context, 0, 0);
1158 if (!defined(depth)) {
1159 continue;

Callers 1

pickCallbackFunction · 0.85

Calls 6

isExcludedFunction · 0.85
getPointMethod · 0.80
definedFunction · 0.50
cloneMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…