small bug-fixes

This commit is contained in:
Seth Alves 2015-09-01 16:51:55 -07:00
parent 9256917f15
commit 8608e4f2b0
2 changed files with 10 additions and 17 deletions

View file

@ -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++) {

View file

@ -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()) {