History

voxel-paint paints with capsules rather than spheres

Seth Alves committed 9 years ago

Commit 88c850a1 parent 542cb7a7 files · +111 −0Browse files

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

Unified · Split

libraries/entities/src/EntityScriptingInterface.cpp+18−0
@@ -891,6 +891,16 @@ bool EntityScriptingInterface::setVoxelSphere(QUuid entityID, const glm::vec3& c · 890 unmodified lines
891891 });
892892 }
893893
894+bool EntityScriptingInterface::setVoxelCapsule(QUuid entityID,
895+ const glm::vec3& start, const glm::vec3& end,
896+ float radius, int value) {
897+ PROFILE_RANGE(script_entities, __FUNCTION__);
898+
899+ return setVoxels(entityID, [start, end, radius, value](PolyVoxEntityItem& polyVoxEntity) {
900+ return polyVoxEntity.setCapsule(start, end, radius, value);
901+ });
902+}
903+
894904 bool EntityScriptingInterface::setVoxel(QUuid entityID, const glm::vec3& position, int value) {
895905 PROFILE_RANGE(script_entities, __FUNCTION__);
896906
@@ -1524,3 +1534,11 @@ QObject* EntityScriptingInterface::getWebViewRoot(const QUuid& entityID) { · 627 unmodified lines
15241534 return nullptr;
15251535 }
15261536 }
1537+
1538+// TODO move this someplace that makes more sense...
1539+bool EntityScriptingInterface::AABoxIntersectsCapsule(const glm::vec3& low, const glm::vec3& dimensions,
1540+ const glm::vec3& start, const glm::vec3& end, float radius) {
1541+ glm::vec3 penetration;
1542+ AABox aaBox(low, dimensions);
1543+ return aaBox.findCapsulePenetration(start, end, radius, penetration);
1544+}