Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 70 files). Show all
Unified · Split
| @@ -357,19 +357,21 @@ QVector<QUuid> EntityScriptingInterface::findEntitiesInBox(const glm::vec3& corn · 356 unmodified lines | |||
| 357 | return result; | 357 | return result; |
| 358 | } | 358 | } |
| 359 | 359 | ||
| 360 | RayToEntityIntersectionResult EntityScriptingInterface::findRayIntersection(const PickRay& ray, bool precisionPicking, const QScriptValue& entityIdsToInclude) { | 360 | RayToEntityIntersectionResult EntityScriptingInterface::findRayIntersection(const PickRay& ray, bool precisionPicking, const QScriptValue& entityIdsToInclude, const QScriptValue& entityIdsToDiscard) { |
| 361 | QVector<EntityItemID> entities = qVectorEntityItemIDFromScriptValue(entityIdsToInclude); | 361 | QVector<EntityItemID> entitiesToInclude = qVectorEntityItemIDFromScriptValue(entityIdsToInclude); |
| 362 | return findRayIntersectionWorker(ray, Octree::TryLock, precisionPicking, entities); | 362 | QVector<EntityItemID> entitiesToDiscard = qVectorEntityItemIDFromScriptValue(entityIdsToDiscard); |
| 363 | return findRayIntersectionWorker(ray, Octree::TryLock, precisionPicking, entitiesToInclude, entitiesToDiscard); | ||
| 363 | } | 364 | } |
| 364 | 365 | ||
| 365 | RayToEntityIntersectionResult EntityScriptingInterface::findRayIntersectionBlocking(const PickRay& ray, bool precisionPicking, const QScriptValue& entityIdsToInclude) { | 366 | RayToEntityIntersectionResult EntityScriptingInterface::findRayIntersectionBlocking(const PickRay& ray, bool precisionPicking, const QScriptValue& entityIdsToInclude, const QScriptValue& entityIdsToDiscard) { |
| 366 | const QVector<EntityItemID>& entities = qVectorEntityItemIDFromScriptValue(entityIdsToInclude); | 367 | const QVector<EntityItemID>& entitiesToInclude = qVectorEntityItemIDFromScriptValue(entityIdsToInclude); |
| 367 | return findRayIntersectionWorker(ray, Octree::Lock, precisionPicking, entities); | 368 | const QVector<EntityItemID> entitiesToDiscard = qVectorEntityItemIDFromScriptValue(entityIdsToDiscard); |
| 369 | return findRayIntersectionWorker(ray, Octree::Lock, precisionPicking, entitiesToInclude, entitiesToDiscard); | ||
| 368 | } | 370 | } |
| 369 | 371 | ||
| 370 | RayToEntityIntersectionResult EntityScriptingInterface::findRayIntersectionWorker(const PickRay& ray, | 372 | RayToEntityIntersectionResult EntityScriptingInterface::findRayIntersectionWorker(const PickRay& ray, |
| 371 | Octree::lockType lockType, | 373 | Octree::lockType lockType, |
| 372 | bool precisionPicking, const QVector<EntityItemID>& entityIdsToInclude) { | 374 | bool precisionPicking, const QVector<EntityItemID>& entityIdsToInclude, const QVector<EntityItemID>& entityIdsToDiscard) { |
| 373 | 375 | ||
| 374 | 376 | ||
| 375 | RayToEntityIntersectionResult result; | 377 | RayToEntityIntersectionResult result; |
| @@ -377,7 +379,7 @@ RayToEntityIntersectionResult EntityScriptingInterface::findRayIntersectionWorke · 1 unmodified line | |||
| 377 | OctreeElementPointer element; | 379 | OctreeElementPointer element; |
| 378 | EntityItemPointer intersectedEntity = NULL; | 380 | EntityItemPointer intersectedEntity = NULL; |
| 379 | result.intersects = _entityTree->findRayIntersection(ray.origin, ray.direction, element, result.distance, result.face, | 381 | result.intersects = _entityTree->findRayIntersection(ray.origin, ray.direction, element, result.distance, result.face, |
| 380 | result.surfaceNormal, entityIdsToInclude, (void**)&intersectedEntity, lockType, &result.accurate, | 382 | result.surfaceNormal, entityIdsToInclude, entityIdsToDiscard, (void**)&intersectedEntity, lockType, &result.accurate, |
| 381 | precisionPicking); | 383 | precisionPicking); |
| 382 | if (result.intersects && intersectedEntity) { | 384 | if (result.intersects && intersectedEntity) { |
| 383 | result.entityID = intersectedEntity->getEntityItemID(); | 385 | result.entityID = intersectedEntity->getEntityItemID(); |