fixed node texture shifting bugs

This commit is contained in:
Piotrek
2021-05-16 19:08:47 +02:00
parent 67bb4fddd0
commit eecedbf4f4
3 changed files with 38 additions and 43 deletions
+5
View File
@@ -28,6 +28,7 @@ impl Nodes {
pub fn set_node(&mut self, index: usize, value: u32) {
self.node_buffer[self.active_buffer][index] = value;
self.modified = true;
}
pub fn shift(&mut self, offset: &Vector3<i32>) -> bool {
@@ -38,6 +39,10 @@ impl Nodes {
let (ox, oy, oz) = (offset.x, offset.y, offset.z);
let size = NODE_TEX_SIZE as i32;
for i in self.node_buffer[b].iter_mut() {
*i = 0;
}
for x in max(0, -ox)..min(size-ox, size) {
for y in max(0, -oy)..min(size-oy, size) {
for z in max(0, -oz)..min(size-oz, size) {