diff --git a/examples/voxels.js b/examples/voxels.js index 809b8f95a6..00d49ae711 100644 --- a/examples/voxels.js +++ b/examples/voxels.js @@ -404,13 +404,8 @@ function attemptVoxelChange(pickRayDir, intersection) { var ids; - if (addingSpheres || deletingSpheres) { - ids = Entities.findEntities(intersection.intersection, editSphereRadius + 1.0); - } else { - ids = [intersection.entityID]; - } - - print("ids = " + ids); + ids = Entities.findEntities(intersection.intersection, editSphereRadius + 1.0); + // print("ids = " + ids); var success = false; for (var i = 0; i < ids.length; i++) { diff --git a/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp b/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp index cd150dc44c..9d6648ee04 100644 --- a/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp @@ -164,6 +164,8 @@ bool RenderablePolyVoxEntityItem::setVoxel(int x, int y, int z, uint8_t toValue) return false; } + cacheNeighbors(); + _volDataLock.lockForWrite(); bool result = setVoxelInternal(x, y, z, toValue); if (result) { @@ -975,10 +977,6 @@ void RenderablePolyVoxEntityItem::clearOutOfDateNeighbors() { } void RenderablePolyVoxEntityItem::cacheNeighbors() { - if (_voxelSurfaceStyle != PolyVoxEntityItem::SURFACE_MARCHING_CUBES) { - return; - } - clearOutOfDateNeighbors(); EntityTreeElement* element = getElement(); EntityTree* tree = element ? element->getTree() : nullptr; @@ -986,14 +984,14 @@ void RenderablePolyVoxEntityItem::cacheNeighbors() { return; } - if (_xPNeighborID != UNKNOWN_ENTITY_ID && _xPNeighbor.expired()) { - _xPNeighbor = tree->findEntityByID(_xPNeighborID); + if (_xNNeighborID != UNKNOWN_ENTITY_ID && _xNNeighbor.expired()) { + _xNNeighbor = tree->findEntityByID(_xNNeighborID); } - if (_yPNeighborID != UNKNOWN_ENTITY_ID && _yPNeighbor.expired()) { - _yPNeighbor = tree->findEntityByID(_yPNeighborID); + if (_yNNeighborID != UNKNOWN_ENTITY_ID && _yNNeighbor.expired()) { + _yNNeighbor = tree->findEntityByID(_yNNeighborID); } - if (_zPNeighborID != UNKNOWN_ENTITY_ID && _zPNeighbor.expired()) { - _zPNeighbor = tree->findEntityByID(_zPNeighborID); + if (_zNNeighborID != UNKNOWN_ENTITY_ID && _zNNeighbor.expired()) { + _zNNeighbor = tree->findEntityByID(_zNNeighborID); } if (_xPNeighborID != UNKNOWN_ENTITY_ID && _xPNeighbor.expired()) {