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
891 });891 });
892}892}
893 893
894bool 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
894bool EntityScriptingInterface::setVoxel(QUuid entityID, const glm::vec3& position, int value) {904bool EntityScriptingInterface::setVoxel(QUuid entityID, const glm::vec3& position, int value) {
895 PROFILE_RANGE(script_entities, __FUNCTION__);905 PROFILE_RANGE(script_entities, __FUNCTION__);
896 906
@@ -1524,3 +1534,11 @@ QObject* EntityScriptingInterface::getWebViewRoot(const QUuid& entityID) { · 627 unmodified lines
1524 return nullptr;1534 return nullptr;
1525 }1535 }
1526}1536}
1537
1538// TODO move this someplace that makes more sense...
1539bool 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}