mirror of
https://github.com/JannisX11/blockbench.git
synced 2024-11-27 04:21:46 +08:00
Fix inverted normals when deleting vertices
Remove shadow from floating reference images
This commit is contained in:
parent
99558d2145
commit
6907ebeecc
@ -910,7 +910,7 @@
|
||||
.reference_image[reference_layer=float] {
|
||||
z-index: 8;
|
||||
}
|
||||
.reference_image[reference_layer=float] > img {
|
||||
.reference_image.selected[reference_layer=float] > img {
|
||||
box-shadow: 3px 3px 10px rgb(0 0 0 / 70%);
|
||||
}
|
||||
#work_screen.reference_image_mode .reference_image {
|
||||
|
@ -1896,16 +1896,21 @@ const BARS = {
|
||||
})
|
||||
|
||||
} else if (BarItems.selection_mode.value == 'vertex' && selected_vertices.length < Object.keys(mesh.vertices).length) {
|
||||
selected_vertices.forEach(vertex_key => {
|
||||
delete mesh.vertices[vertex_key];
|
||||
|
||||
selected_vertices.forEach(vkey => {
|
||||
for (let key in mesh.faces) {
|
||||
let face = mesh.faces[key];
|
||||
if (!face.vertices.includes(vertex_key)) continue;
|
||||
if (!face.vertices.includes(vkey)) continue;
|
||||
if (face.vertices.length > 2) {
|
||||
face.vertices.remove(vertex_key);
|
||||
delete face.uv[vertex_key];
|
||||
let initial_normal;
|
||||
if (face.vertices.length == 4) {
|
||||
initial_normal = face.getNormal();
|
||||
}
|
||||
face.vertices.remove(vkey);
|
||||
delete face.uv[vkey];
|
||||
|
||||
if (face.vertices.length == 3 && face.getAngleTo(initial_normal) > 90) {
|
||||
face.invert();
|
||||
}
|
||||
if (face.vertices.length == 2) {
|
||||
for (let fkey2 in mesh.faces) {
|
||||
if (fkey2 != key && !face.vertices.find(vkey => !mesh.faces[fkey2].vertices.includes(vkey))) {
|
||||
@ -1918,6 +1923,7 @@ const BARS = {
|
||||
delete mesh.faces[key];
|
||||
}
|
||||
}
|
||||
delete mesh.vertices[vkey];
|
||||
})
|
||||
} else {
|
||||
Mesh.selected.remove(mesh);
|
||||
|
@ -151,9 +151,9 @@ class MeshFace extends Face {
|
||||
crawl(this);
|
||||
return keys;
|
||||
}
|
||||
getAngleTo(other_face) {
|
||||
getAngleTo(other) {
|
||||
let a = new THREE.Vector3().fromArray(this.getNormal());
|
||||
let b = new THREE.Vector3().fromArray(other_face.getNormal());
|
||||
let b = new THREE.Vector3().fromArray(other instanceof Array ? other : other.getNormal());
|
||||
return Math.radToDeg(a.angleTo(b));
|
||||
}
|
||||
invert() {
|
||||
|
Loading…
Reference in New Issue
Block a user