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
871 return result;871 return result;
872}872}
873 873
874ParabolaToEntityIntersectionResult 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
881ParabolaToEntityIntersectionResult 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
874bool EntityScriptingInterface::reloadServerScripts(QUuid entityID) {898bool EntityScriptingInterface::reloadServerScripts(QUuid entityID) {
875 auto client = DependencyManager::get<EntityScriptClient>();899 auto client = DependencyManager::get<EntityScriptClient>();
876 return client->reloadServerScript(entityID);900 return client->reloadServerScript(entityID);
@@ -1025,15 +1049,6 @@ bool EntityScriptingInterface::getDrawZoneBoundaries() const { · 148 unmodified lines
1025 return ZoneEntityItem::getDrawZoneBoundaries();1049 return ZoneEntityItem::getDrawZoneBoundaries();
1026}1050}
1027 1051
1028RayToEntityIntersectionResult::RayToEntityIntersectionResult() :
1029 intersects(false),
1030 accurate(true), // assume it's accurate
1031 entityID(),
1032 distance(0),
1033 face()
1034{
1035}
1036
1037QScriptValue RayToEntityIntersectionResultToScriptValue(QScriptEngine* engine, const RayToEntityIntersectionResult& value) {1052QScriptValue RayToEntityIntersectionResultToScriptValue(QScriptEngine* engine, const RayToEntityIntersectionResult& value) {
1038 PROFILE_RANGE(script_entities, __FUNCTION__);1053 PROFILE_RANGE(script_entities, __FUNCTION__);
1039 1054