mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:44:01 +02:00
add work around for voxel add of larger voxel on top of smaller voxels
This commit is contained in:
parent
dad97cd52e
commit
766a922fb3
2 changed files with 4 additions and 1 deletions
|
@ -922,6 +922,7 @@ print("clickedOverlay="+clickedOverlay);
|
|||
}
|
||||
|
||||
voxelDetails = calculateVoxelFromIntersection(intersection,"add");
|
||||
Voxels.eraseVoxel(voxelDetails.x, voxelDetails.y, voxelDetails.z, voxelDetails.s);
|
||||
Voxels.setVoxel(voxelDetails.x, voxelDetails.y, voxelDetails.z, voxelDetails.s,
|
||||
newColor.red, newColor.green, newColor.blue);
|
||||
lastVoxelPosition = { x: voxelDetails.x, y: voxelDetails.y, z: voxelDetails.z };
|
||||
|
@ -963,6 +964,7 @@ function keyPressEvent(event) {
|
|||
red: colors[color].red,
|
||||
green: colors[color].green,
|
||||
blue: colors[color].blue };
|
||||
Voxels.eraseVoxel(voxelDetails.x, voxelDetails.y, voxelDetails.z, voxelDetails.s);
|
||||
Voxels.setVoxel(newVoxel.x, newVoxel.y, newVoxel.z, newVoxel.s, newVoxel.red, newVoxel.green, newVoxel.blue);
|
||||
setAudioPosition();
|
||||
Audio.playSound(addSound, audioOptions);
|
||||
|
@ -1089,6 +1091,7 @@ function mouseMoveEvent(event) {
|
|||
var dy = event.y - mouseY;
|
||||
if (Math.sqrt(dx*dx + dy*dy) > PIXELS_PER_EXTRUDE_VOXEL) {
|
||||
lastVoxelPosition = Vec3.sum(lastVoxelPosition, extrudeDirection);
|
||||
Voxels.eraseVoxel(voxelDetails.x, voxelDetails.y, voxelDetails.z, voxelDetails.s);
|
||||
Voxels.setVoxel(lastVoxelPosition.x, lastVoxelPosition.y, lastVoxelPosition.z,
|
||||
extrudeScale, lastVoxelColor.red, lastVoxelColor.green, lastVoxelColor.blue);
|
||||
mouseX = event.x;
|
||||
|
|
|
@ -42,7 +42,7 @@ void VoxelsScriptingInterface::setVoxelNonDestructive(float x, float y, float z,
|
|||
VoxelDetail addVoxelDetail = {x / (float)TREE_SCALE, y / (float)TREE_SCALE, z / (float)TREE_SCALE,
|
||||
scale / (float)TREE_SCALE, red, green, blue};
|
||||
|
||||
// queue the packet
|
||||
// queue the add packet
|
||||
queueVoxelAdd(PacketTypeVoxelSet, addVoxelDetail);
|
||||
|
||||
// handle the local tree also...
|
||||
|
|
Loading…
Reference in a new issue