Move thread package

This commit is contained in:
mcrcortex
2024-08-08 00:41:33 +10:00
parent d2483283f5
commit 163d1f9f43
11 changed files with 14 additions and 38 deletions

View File

@@ -10,7 +10,7 @@ import me.cortex.voxy.client.core.util.IrisUtil;
import me.cortex.voxy.client.saver.ContextSelectionSystem; import me.cortex.voxy.client.saver.ContextSelectionSystem;
import me.cortex.voxy.common.world.WorldEngine; import me.cortex.voxy.common.world.WorldEngine;
import me.cortex.voxy.client.importers.WorldImporter; import me.cortex.voxy.client.importers.WorldImporter;
import me.cortex.voxy.common.world.thread.ServiceThreadPool; import me.cortex.voxy.common.thread.ServiceThreadPool;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.hud.ClientBossBar; import net.minecraft.client.gui.hud.ClientBossBar;
import net.minecraft.client.render.Camera; import net.minecraft.client.render.Camera;
@@ -27,7 +27,6 @@ import org.lwjgl.opengl.GL11;
import java.io.File; import java.io.File;
import java.util.*; import java.util.*;
import static org.lwjgl.opengl.ARBDirectStateAccess.glGetNamedFramebufferAttachmentParameteri;
import static org.lwjgl.opengl.GL30C.*; import static org.lwjgl.opengl.GL30C.*;
//Core class that ingests new data from sources and updates the required systems //Core class that ingests new data from sources and updates the required systems

View File

@@ -1,6 +1,5 @@
package me.cortex.voxy.client.core.rendering; package me.cortex.voxy.client.core.rendering;
import me.cortex.voxy.client.config.VoxyConfig;
import me.cortex.voxy.client.core.model.ModelBakerySubsystem; import me.cortex.voxy.client.core.model.ModelBakerySubsystem;
import me.cortex.voxy.client.core.model.ModelStore; import me.cortex.voxy.client.core.model.ModelStore;
import me.cortex.voxy.client.core.rendering.building.BuiltSection; import me.cortex.voxy.client.core.rendering.building.BuiltSection;
@@ -14,8 +13,7 @@ import me.cortex.voxy.client.core.rendering.section.MDICSectionRenderer;
import me.cortex.voxy.client.core.rendering.util.DownloadStream; import me.cortex.voxy.client.core.rendering.util.DownloadStream;
import me.cortex.voxy.client.core.rendering.util.UploadStream; import me.cortex.voxy.client.core.rendering.util.UploadStream;
import me.cortex.voxy.common.world.WorldEngine; import me.cortex.voxy.common.world.WorldEngine;
import me.cortex.voxy.common.world.WorldSection; import me.cortex.voxy.common.thread.ServiceThreadPool;
import me.cortex.voxy.common.world.thread.ServiceThreadPool;
import net.minecraft.client.render.Camera; import net.minecraft.client.render.Camera;
import java.util.Arrays; import java.util.Arrays;

View File

@@ -7,13 +7,10 @@ import me.cortex.voxy.client.core.model.ModelBakerySubsystem;
import me.cortex.voxy.common.world.WorldEngine; import me.cortex.voxy.common.world.WorldEngine;
import me.cortex.voxy.common.world.WorldSection; import me.cortex.voxy.common.world.WorldSection;
import me.cortex.voxy.common.world.other.Mapper; import me.cortex.voxy.common.world.other.Mapper;
import me.cortex.voxy.common.world.thread.ServiceSlice; import me.cortex.voxy.common.thread.ServiceSlice;
import me.cortex.voxy.common.world.thread.ServiceThreadPool; import me.cortex.voxy.common.thread.ServiceThreadPool;
import net.minecraft.client.MinecraftClient;
import net.minecraft.text.Text;
import java.util.List; import java.util.List;
import java.util.concurrent.Semaphore;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.Supplier; import java.util.function.Supplier;

View File

@@ -102,14 +102,11 @@ public class HierarchicalNodeManager {
} }
public void processBuildResult(BuiltSection section) { public void processBuildResult(BuiltSection section) {
section.free();
/*
if (!section.isEmpty()) { if (!section.isEmpty()) {
this.geometryManager.uploadSection(section); this.geometryManager.uploadSection(section);
} else { } else {
section.free(); section.free();
} }
*/
int nodeId = this.activeSectionMap.get(section.position); int nodeId = this.activeSectionMap.get(section.position);
if (nodeId == -1) { if (nodeId == -1) {

View File

@@ -5,9 +5,8 @@ import me.cortex.voxy.client.core.util.ByteBufferBackedInputStream;
import me.cortex.voxy.common.voxelization.VoxelizedSection; import me.cortex.voxy.common.voxelization.VoxelizedSection;
import me.cortex.voxy.common.voxelization.WorldConversionFactory; import me.cortex.voxy.common.voxelization.WorldConversionFactory;
import me.cortex.voxy.common.world.WorldEngine; import me.cortex.voxy.common.world.WorldEngine;
import me.cortex.voxy.common.world.other.Mipper; import me.cortex.voxy.common.thread.ServiceSlice;
import me.cortex.voxy.common.world.thread.ServiceSlice; import me.cortex.voxy.common.thread.ServiceThreadPool;
import me.cortex.voxy.common.world.thread.ServiceThreadPool;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
@@ -30,13 +29,9 @@ import java.nio.ByteOrder;
import java.nio.channels.FileChannel; import java.nio.channels.FileChannel;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.StandardOpenOption; import java.nio.file.StandardOpenOption;
import java.util.Objects;
import java.util.concurrent.ConcurrentLinkedDeque; import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate; import java.util.function.Predicate;
public class WorldImporter { public class WorldImporter {

View File

@@ -9,7 +9,7 @@ import me.cortex.voxy.common.storage.config.StorageConfig;
import me.cortex.voxy.common.storage.other.CompressionStorageAdaptor; import me.cortex.voxy.common.storage.other.CompressionStorageAdaptor;
import me.cortex.voxy.common.storage.rocksdb.RocksDBStorageBackend; import me.cortex.voxy.common.storage.rocksdb.RocksDBStorageBackend;
import me.cortex.voxy.common.world.WorldEngine; import me.cortex.voxy.common.world.WorldEngine;
import me.cortex.voxy.common.world.thread.ServiceThreadPool; import me.cortex.voxy.common.thread.ServiceThreadPool;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.world.ClientWorld; import net.minecraft.client.world.ClientWorld;
import net.minecraft.util.WorldSavePath; import net.minecraft.util.WorldSavePath;

View File

@@ -1,4 +1,4 @@
package me.cortex.voxy.common.world.thread; package me.cortex.voxy.common.thread;
import me.cortex.voxy.common.util.TrackedObject; import me.cortex.voxy.common.util.TrackedObject;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
@@ -6,7 +6,6 @@ import net.minecraft.text.Text;
import java.util.concurrent.Semaphore; import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.BooleanSupplier; import java.util.function.BooleanSupplier;
import java.util.function.Supplier; import java.util.function.Supplier;

View File

@@ -1,8 +1,7 @@
package me.cortex.voxy.common.world.thread; package me.cortex.voxy.common.thread;
import java.util.concurrent.Semaphore; import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import java.util.function.BooleanSupplier; import java.util.function.BooleanSupplier;
import java.util.function.Supplier; import java.util.function.Supplier;

View File

@@ -1,13 +1,11 @@
package me.cortex.voxy.common.world; package me.cortex.voxy.common.world;
import me.cortex.voxy.client.Voxy;
import me.cortex.voxy.common.voxelization.VoxelizedSection; import me.cortex.voxy.common.voxelization.VoxelizedSection;
import me.cortex.voxy.common.world.other.Mapper; import me.cortex.voxy.common.world.other.Mapper;
import me.cortex.voxy.common.world.service.SectionSavingService; import me.cortex.voxy.common.world.service.SectionSavingService;
import me.cortex.voxy.common.world.service.VoxelIngestService; import me.cortex.voxy.common.world.service.VoxelIngestService;
import me.cortex.voxy.common.storage.StorageBackend; import me.cortex.voxy.common.storage.StorageBackend;
import me.cortex.voxy.common.world.thread.ServiceThreadPool; import me.cortex.voxy.common.thread.ServiceThreadPool;
import org.lwjgl.system.MemoryUtil;
import java.util.Arrays; import java.util.Arrays;
import java.util.function.Consumer; import java.util.function.Consumer;

View File

@@ -3,11 +3,10 @@ package me.cortex.voxy.common.world.service;
import me.cortex.voxy.common.world.SaveLoadSystem; import me.cortex.voxy.common.world.SaveLoadSystem;
import me.cortex.voxy.common.world.WorldEngine; import me.cortex.voxy.common.world.WorldEngine;
import me.cortex.voxy.common.world.WorldSection; import me.cortex.voxy.common.world.WorldSection;
import me.cortex.voxy.common.world.thread.ServiceSlice; import me.cortex.voxy.common.thread.ServiceSlice;
import me.cortex.voxy.common.world.thread.ServiceThreadPool; import me.cortex.voxy.common.thread.ServiceThreadPool;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import org.lwjgl.system.MemoryUtil;
import java.util.concurrent.ConcurrentLinkedDeque; import java.util.concurrent.ConcurrentLinkedDeque;

View File

@@ -1,24 +1,19 @@
package me.cortex.voxy.common.world.service; package me.cortex.voxy.common.world.service;
import it.unimi.dsi.fastutil.Pair; import it.unimi.dsi.fastutil.Pair;
import me.cortex.voxy.client.Voxy;
import me.cortex.voxy.common.voxelization.VoxelizedSection; import me.cortex.voxy.common.voxelization.VoxelizedSection;
import me.cortex.voxy.common.voxelization.WorldConversionFactory; import me.cortex.voxy.common.voxelization.WorldConversionFactory;
import me.cortex.voxy.common.world.WorldEngine; import me.cortex.voxy.common.world.WorldEngine;
import me.cortex.voxy.common.world.thread.ServiceSlice; import me.cortex.voxy.common.thread.ServiceSlice;
import me.cortex.voxy.common.world.thread.ServiceThreadPool; import me.cortex.voxy.common.thread.ServiceThreadPool;
import net.minecraft.client.MinecraftClient;
import net.minecraft.text.Text;
import net.minecraft.util.math.ChunkSectionPos; import net.minecraft.util.math.ChunkSectionPos;
import net.minecraft.world.LightType; import net.minecraft.world.LightType;
import net.minecraft.world.chunk.ChunkNibbleArray; import net.minecraft.world.chunk.ChunkNibbleArray;
import net.minecraft.world.chunk.WorldChunk; import net.minecraft.world.chunk.WorldChunk;
import net.minecraft.world.chunk.light.LightStorage;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedDeque; import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.concurrent.Semaphore;
public class VoxelIngestService { public class VoxelIngestService {
private static final ThreadLocal<VoxelizedSection> SECTION_CACHE = ThreadLocal.withInitial(VoxelizedSection::createEmpty); private static final ThreadLocal<VoxelizedSection> SECTION_CACHE = ThreadLocal.withInitial(VoxelizedSection::createEmpty);