Minor modification.

This commit is contained in:
kovacsv 2021-08-17 19:20:44 +02:00
parent b03d4cc433
commit 471a6cd3fa

View File

@ -115,6 +115,24 @@ OV.ViewerGeometry = class
} }
GetModelMeshUnderMouse (mouseCoords, camera, width, height) GetModelMeshUnderMouse (mouseCoords, camera, width, height)
{
let intersection = this.GetModelIntersectionUnderMouse (mouseCoords, camera, width, height);
if (intersection === null) {
return null;
}
return intersection.object;
}
GetModelPointUnderMouse (mouseCoords, camera, width, height)
{
let intersection = this.GetModelIntersectionUnderMouse (mouseCoords, camera, width, height);
if (intersection === null) {
return null;
}
return new OV.Coord3D (intersection.point.x, intersection.point.y, intersection.point.z);
}
GetModelIntersectionUnderMouse (mouseCoords, camera, width, height)
{ {
let raycaster = new THREE.Raycaster (); let raycaster = new THREE.Raycaster ();
let mousePos = new THREE.Vector2 (); let mousePos = new THREE.Vector2 ();
@ -125,7 +143,7 @@ OV.ViewerGeometry = class
for (let i = 0; i < iSectObjects.length; i++) { for (let i = 0; i < iSectObjects.length; i++) {
let iSectObject = iSectObjects[i]; let iSectObject = iSectObjects[i];
if (iSectObject.object.type === 'Mesh' && iSectObject.object.visible) { if (iSectObject.object.type === 'Mesh' && iSectObject.object.visible) {
return iSectObject.object; return iSectObject;
} }
} }
return null; return null;