History

support additional .extraInfo for ray intersections

humbletim committed 8 years ago

Commit a146b771 parent 61711f344 files · +181 −116Browse files

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

Unified · Split

libraries/entities/src/EntityScriptingInterface.cpp+7−7
@@ -778,13 +778,12 @@ RayToEntityIntersectionResult EntityScriptingInterface::findRayIntersectionWorke · 777 unmodified lines
778 RayToEntityIntersectionResult result;778 RayToEntityIntersectionResult result;
779 if (_entityTree) {779 if (_entityTree) {
780 OctreeElementPointer element;780 OctreeElementPointer element;
781 EntityItemPointer intersectedEntity = NULL;781 result.entityID = _entityTree->findRayIntersection(ray.origin, ray.direction,
782 result.intersects = _entityTree->findRayIntersection(ray.origin, ray.direction,
783 entityIdsToInclude, entityIdsToDiscard, visibleOnly, collidableOnly, precisionPicking,782 entityIdsToInclude, entityIdsToDiscard, visibleOnly, collidableOnly, precisionPicking,
784 element, result.distance, result.face, result.surfaceNormal,783 element, result.distance, result.face, result.surfaceNormal,
785 (void**)&intersectedEntity, lockType, &result.accurate);784 result.extraInfo, lockType, &result.accurate);
786 if (result.intersects && intersectedEntity) {785 result.intersects = !result.entityID.isNull();
787 result.entityID = intersectedEntity->getEntityItemID();786 if (result.intersects) {
788 result.intersection = ray.origin + (ray.direction * result.distance);787 result.intersection = ray.origin + (ray.direction * result.distance);
789 }788 }
790 }789 }
@@ -950,8 +949,7 @@ RayToEntityIntersectionResult::RayToEntityIntersectionResult() : · 159 unmodified lines
950 accurate(true), // assume it's accurate949 accurate(true), // assume it's accurate
951 entityID(),950 entityID(),
952 distance(0),951 distance(0),
953 face(),952 face()
954 entity(NULL)
955{953{
956}954}
957 955
@@ -998,6 +996,7 @@ QScriptValue RayToEntityIntersectionResultToScriptValue(QScriptEngine* engine, c · 40 unmodified lines
998 996
999 QScriptValue surfaceNormal = vec3toScriptValue(engine, value.surfaceNormal);997 QScriptValue surfaceNormal = vec3toScriptValue(engine, value.surfaceNormal);
1000 obj.setProperty("surfaceNormal", surfaceNormal);998 obj.setProperty("surfaceNormal", surfaceNormal);
999 obj.setProperty("extraInfo", engine->toScriptValue(value.extraInfo));
1001 return obj;1000 return obj;
1002}1001}
1003 1002
@@ -1033,6 +1032,7 @@ void RayToEntityIntersectionResultFromScriptValue(const QScriptValue& object, Ra · 29 unmodified lines
1033 if (surfaceNormal.isValid()) {1032 if (surfaceNormal.isValid()) {
1034 vec3FromScriptValue(surfaceNormal, value.surfaceNormal);1033 vec3FromScriptValue(surfaceNormal, value.surfaceNormal);
1035 }1034 }
1035 value.extraInfo = object.property("extraInfo").toVariant().toMap();
1036}1036}
1037 1037
1038bool EntityScriptingInterface::polyVoxWorker(QUuid entityID, std::function<bool(PolyVoxEntityItem&)> actor) {1038bool EntityScriptingInterface::polyVoxWorker(QUuid entityID, std::function<bool(PolyVoxEntityItem&)> actor) {