History

parabola picks, started implementing math

SamGondelman committed 8 years ago

Commit 90091d11 parent 1f4346d50 files · +1057 −60Browse files

Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 50 files). Show all

Unified · Split

libraries/entities/src/EntityScriptingInterface.cpp+24−9
@@ -871,6 +871,30 @@ RayToEntityIntersectionResult EntityScriptingInterface::findRayIntersectionWorke · 870 unmodified lines
871871 return result;
872872 }
873873
874+ParabolaToEntityIntersectionResult EntityScriptingInterface::findParabolaIntersectionVector(const PickParabola& parabola, bool precisionPicking,
875+ const QVector<EntityItemID>& entityIdsToInclude, const QVector<EntityItemID>& entityIdsToDiscard, bool visibleOnly, bool collidableOnly) {
876+ PROFILE_RANGE(script_entities, __FUNCTION__);
877+
878+ return findParabolaIntersectionWorker(parabola, Octree::Lock, precisionPicking, entityIdsToInclude, entityIdsToDiscard, visibleOnly, collidableOnly);
879+}
880+
881+ParabolaToEntityIntersectionResult EntityScriptingInterface::findParabolaIntersectionWorker(const PickParabola& parabola,
882+ Octree::lockType lockType, bool precisionPicking, const QVector<EntityItemID>& entityIdsToInclude,
883+ const QVector<EntityItemID>& entityIdsToDiscard, bool visibleOnly, bool collidableOnly) {
884+
885+
886+ ParabolaToEntityIntersectionResult result;
887+ if (_entityTree) {
888+ OctreeElementPointer element;
889+ result.entityID = _entityTree->findParabolaIntersection(parabola,
890+ entityIdsToInclude, entityIdsToDiscard, visibleOnly, collidableOnly, precisionPicking,
891+ element, result.intersection, result.distance, result.parabolicDistance, result.face, result.surfaceNormal,
892+ result.extraInfo, lockType, &result.accurate);
893+ result.intersects = !result.entityID.isNull();
894+ }
895+ return result;
896+}
897+
874898 bool EntityScriptingInterface::reloadServerScripts(QUuid entityID) {
875899 auto client = DependencyManager::get<EntityScriptClient>();
876900 return client->reloadServerScript(entityID);
@@ -1025,15 +1049,6 @@ bool EntityScriptingInterface::getDrawZoneBoundaries() const { · 148 unmodified lines
10251049 return ZoneEntityItem::getDrawZoneBoundaries();
10261050 }
10271051
1028−RayToEntityIntersectionResult::RayToEntityIntersectionResult() :
1029− intersects(false),
1030− accurate(true), // assume it's accurate
1031− entityID(),
1032− distance(0),
1033− face()
1034−{
1035−}
1036−
10371052 QScriptValue RayToEntityIntersectionResultToScriptValue(QScriptEngine* engine, const RayToEntityIntersectionResult& value) {
10381053 PROFILE_RANGE(script_entities, __FUNCTION__);
10391054