mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 13:58:51 +02:00
Remove voxels with middle mouse button
This commit is contained in:
parent
4be0dd4f50
commit
ab57e191a5
1 changed files with 15 additions and 3 deletions
|
@ -38,6 +38,7 @@ EditVoxels = function() {
|
||||||
var editSingleVoxels = false;
|
var editSingleVoxels = false;
|
||||||
var editSpheres = false;
|
var editSpheres = false;
|
||||||
var editAdd = true; // Remove voxels if false
|
var editAdd = true; // Remove voxels if false
|
||||||
|
var inverseOperation = false; // True when middle mouse button or grip is pressed
|
||||||
var brushPointer = false;
|
var brushPointer = false;
|
||||||
var isActive = true;
|
var isActive = true;
|
||||||
|
|
||||||
|
@ -159,12 +160,17 @@ EditVoxels = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
lastEditValue = 0;
|
lastEditValue = 0;
|
||||||
if(editAdd){
|
if((editAdd && !inverseOperation) || (!editAdd && inverseOperation)){
|
||||||
lastEditValue = 255;
|
lastEditValue = 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (editSingleVoxels) {
|
if (editSingleVoxels) {
|
||||||
var toDrawPosition = Vec3.subtract(voxelPosition, Vec3.multiply(pickRayDirInVoxelSpace, 0.1));
|
var toDrawPosition = null;
|
||||||
|
if(lastEditValue === 255){
|
||||||
|
toDrawPosition = Vec3.subtract(voxelPosition, Vec3.multiply(pickRayDirInVoxelSpace, 0.1));
|
||||||
|
}else{
|
||||||
|
toDrawPosition = Vec3.subtract(voxelPosition, Vec3.multiply(pickRayDirInVoxelSpace, -0.1));
|
||||||
|
}
|
||||||
if (wantDebug) {
|
if (wantDebug) {
|
||||||
print("Calling setVoxel");
|
print("Calling setVoxel");
|
||||||
print("entityID: " + JSON.stringify(entityID));
|
print("entityID: " + JSON.stringify(entityID));
|
||||||
|
@ -237,9 +243,15 @@ EditVoxels = function() {
|
||||||
print("=============== eV::mousePressEvent BEG =======================");
|
print("=============== eV::mousePressEvent BEG =======================");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!event.isLeftButton && !triggered()) {
|
if (!(event.isLeftButton || event.isMiddleButton) && !triggered()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event.isMiddleButton){
|
||||||
|
inverseOperation = true;
|
||||||
|
}else{
|
||||||
|
inverseOperation = false;
|
||||||
|
}
|
||||||
|
|
||||||
var pickRay = generalComputePickRay(event.x, event.y);
|
var pickRay = generalComputePickRay(event.x, event.y);
|
||||||
var intersection = Entities.findRayIntersection(pickRay, true); // accurate picking
|
var intersection = Entities.findRayIntersection(pickRay, true); // accurate picking
|
||||||
|
|
Loading…
Reference in a new issue