voxel value generation work
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				studiorailgun/Renderer/pipeline/head This commit looks good
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	studiorailgun/Renderer/pipeline/head This commit looks good
				
			This commit is contained in:
		
							parent
							
								
									782b31954e
								
							
						
					
					
						commit
						388f622c9b
					
				| @ -7,6 +7,9 @@ | ||||
| + non-feedback requirements | ||||
| 
 | ||||
| + feedback driven requirements | ||||
|   Spawn a town in macro data | ||||
|    - Place a building | ||||
|     - Elevation calls give you the ACTUAL elevation | ||||
|   Crouching | ||||
|   Model clothing, hair for the human | ||||
|   particles, light on sword collision | ||||
| @ -17,6 +20,5 @@ | ||||
| 
 | ||||
| + bug fixes | ||||
|  - Window does not play nice with its minWidth/minHeight being set differently | ||||
|  - Interaction block cursor is overwriting fab cursor | ||||
| 
 | ||||
| + unreproducible bugs | ||||
|  | ||||
| @ -1595,6 +1595,8 @@ Unit tests for unhash func | ||||
| Filter client entity list to terrain | ||||
| Fix server loading full res chunks from disk as strided chunks | ||||
| Debugging tooling for foliage manager | ||||
| Refactor ProceduralChunkGenerator | ||||
| NoiseVoxelGen work to make elevation values align with voxel values that are generated | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -5,7 +5,7 @@ import electrosphere.engine.signal.Signal.SignalType; | ||||
| import electrosphere.renderer.ui.imgui.ImGuiWindow; | ||||
| import electrosphere.renderer.ui.imgui.ImGuiWindow.ImGuiWindowCallback; | ||||
| import electrosphere.server.datacell.gridded.GriddedDataCellManager; | ||||
| import electrosphere.server.physics.terrain.generation.TestGenerationChunkGenerator; | ||||
| import electrosphere.server.physics.terrain.generation.ProceduralChunkGenerator; | ||||
| import electrosphere.server.physics.terrain.models.TerrainModel; | ||||
| import imgui.ImGui; | ||||
| import imgui.type.ImInt; | ||||
| @ -62,7 +62,7 @@ public class ImGuiTestGen { | ||||
|                 } | ||||
| 
 | ||||
|                 //set macro data scale in terrain model | ||||
|                 if(ImGui.sliderInt("Macro Data Scale", macroDataScaleInput, TestGenerationChunkGenerator.GENERATOR_REALM_SIZE / terrainModel.getBiome().length, TerrainModel.DEFAULT_MACRO_DATA_SCALE)){ | ||||
|                 if(ImGui.sliderInt("Macro Data Scale", macroDataScaleInput, ProceduralChunkGenerator.GENERATOR_REALM_SIZE / terrainModel.getBiome().length, TerrainModel.DEFAULT_MACRO_DATA_SCALE)){ | ||||
|                     terrainModel.setMacroDataScale(macroDataScaleInput[0]); | ||||
|                 } | ||||
| 
 | ||||
|  | ||||
| @ -11,7 +11,7 @@ import electrosphere.renderer.ui.imgui.ImGuiLinePlot; | ||||
| import electrosphere.renderer.ui.imgui.ImGuiWindow; | ||||
| import electrosphere.renderer.ui.imgui.ImGuiLinePlot.ImGuiLinePlotDataset; | ||||
| import electrosphere.renderer.ui.imgui.ImGuiWindow.ImGuiWindowCallback; | ||||
| import electrosphere.server.physics.terrain.generation.TestGenerationChunkGenerator; | ||||
| import electrosphere.server.physics.terrain.generation.ProceduralChunkGenerator; | ||||
| import imgui.ImGui; | ||||
| 
 | ||||
| /** | ||||
| @ -161,7 +161,7 @@ public class ImGuiWindowMacros { | ||||
|                     Globals.realmManager != null && | ||||
|                     Globals.realmManager.first() != null && | ||||
|                     Globals.realmManager.first().getServerWorldData() != null && | ||||
|                     Globals.realmManager.first().getServerWorldData().getServerTerrainManager().getChunkGenerator() instanceof TestGenerationChunkGenerator && | ||||
|                     Globals.realmManager.first().getServerWorldData().getServerTerrainManager().getChunkGenerator() instanceof ProceduralChunkGenerator && | ||||
|                     ImGui.button("Test Terrain Gen") | ||||
|                 ){ | ||||
|                     ImGuiTestGen.testGenWindow.setOpen(true); | ||||
|  | ||||
| @ -13,7 +13,7 @@ import electrosphere.logger.LoggerInterface; | ||||
| import electrosphere.net.parser.net.message.TerrainMessage; | ||||
| import electrosphere.net.server.ServerConnectionHandler; | ||||
| import electrosphere.renderer.ui.elements.Window; | ||||
| import electrosphere.server.physics.terrain.generation.TestGenerationChunkGenerator; | ||||
| import electrosphere.server.physics.terrain.generation.ProceduralChunkGenerator; | ||||
| import electrosphere.server.saves.SaveUtils; | ||||
| 
 | ||||
| /** | ||||
| @ -43,7 +43,7 @@ public class ChunkGenerationTestLoading { | ||||
|         }); | ||||
| 
 | ||||
|         //wait on script engine to load | ||||
|         if(TestGenerationChunkGenerator.DEFAULT_USE_JAVASCRIPT){ | ||||
|         if(ProceduralChunkGenerator.DEFAULT_USE_JAVASCRIPT){ | ||||
|             WindowUtils.updateLoadingWindow("Waiting on scripting engine"); | ||||
|             while(!Globals.scriptEngine.isInitialized()){ | ||||
|                 try { | ||||
|  | ||||
| @ -3,7 +3,7 @@ package electrosphere.entity.scene; | ||||
| import java.util.Objects; | ||||
| 
 | ||||
| import electrosphere.server.datacell.gridded.GriddedDataCellManager; | ||||
| import electrosphere.server.physics.terrain.generation.TestGenerationChunkGenerator; | ||||
| import electrosphere.server.physics.terrain.generation.ProceduralChunkGenerator; | ||||
| 
 | ||||
| /** | ||||
|  * Generates scene files where appropriate (ie, if playing the procedurally generated level) | ||||
| @ -37,7 +37,7 @@ public class SceneGenerator { | ||||
|         SceneFile file = SceneFile.createSceneFile(); | ||||
|         //realm descriptor stuff | ||||
|         file.realmDescriptor.type = RealmDescriptor.REALM_DESCRIPTOR_GENERATION_TESTING; | ||||
|         file.realmDescriptor.griddedRealmSize = TestGenerationChunkGenerator.GENERATOR_REALM_SIZE; | ||||
|         file.realmDescriptor.griddedRealmSize = ProceduralChunkGenerator.GENERATOR_REALM_SIZE; | ||||
|         file.createSaveInstance = true; //won't have a predefined scene to load, so must create one in the save | ||||
|         file.loadAllCells = false; // do not load all cells on init | ||||
|          | ||||
|  | ||||
| @ -5,7 +5,7 @@ import electrosphere.server.physics.block.manager.ServerBlockManager; | ||||
| import electrosphere.server.physics.fluid.generation.DefaultFluidGenerator; | ||||
| import electrosphere.server.physics.fluid.manager.ServerFluidManager; | ||||
| import electrosphere.server.physics.terrain.generation.DefaultChunkGenerator; | ||||
| import electrosphere.server.physics.terrain.generation.TestGenerationChunkGenerator; | ||||
| import electrosphere.server.physics.terrain.generation.ProceduralChunkGenerator; | ||||
| import electrosphere.server.physics.terrain.manager.ServerTerrainChunk; | ||||
| import electrosphere.server.physics.terrain.manager.ServerTerrainManager; | ||||
| import electrosphere.server.physics.terrain.models.TerrainModel; | ||||
| @ -147,7 +147,7 @@ public class ServerWorldData { | ||||
|         } else { | ||||
|             //TODO: Allow loading procedurally generated terrain from disk (the chunk generator is always default currently) | ||||
|             serverWorldData = FileUtils.loadObjectFromSavePath(sceneOrSaveName, "world.json", ServerWorldData.class); | ||||
|             serverTerrainManager = new ServerTerrainManager(serverWorldData, 0, new TestGenerationChunkGenerator(serverWorldData, false)); | ||||
|             serverTerrainManager = new ServerTerrainManager(serverWorldData, 0, new ProceduralChunkGenerator(serverWorldData, false)); | ||||
|             serverTerrainManager.load(sceneOrSaveName); | ||||
|             serverFluidManager = new ServerFluidManager(serverWorldData, serverTerrainManager, 0, new DefaultFluidGenerator()); | ||||
|             serverBlockManager = new ServerBlockManager(serverWorldData); | ||||
| @ -170,13 +170,13 @@ public class ServerWorldData { | ||||
|         ServerFluidManager serverFluidManager = null; | ||||
|         ServerBlockManager serverBlockManager = null; | ||||
|         //TODO: Allow loading procedurally generated terrain from disk (the chunk generator is always default currently) | ||||
|         serverWorldData = ServerWorldData.createFixedWorldData(new Vector3d(0),new Vector3d(TestGenerationChunkGenerator.GENERATOR_REALM_SIZE * ServerTerrainChunk.CHUNK_DIMENSION)); | ||||
|         serverWorldData.worldSizeDiscrete = TestGenerationChunkGenerator.GENERATOR_REALM_SIZE; | ||||
|         serverWorldData.worldSizeDiscreteVertical = TestGenerationChunkGenerator.GENERATOR_REALM_SIZE; | ||||
|         serverWorldData = ServerWorldData.createFixedWorldData(new Vector3d(0),new Vector3d(ProceduralChunkGenerator.GENERATOR_REALM_SIZE * ServerTerrainChunk.CHUNK_DIMENSION)); | ||||
|         serverWorldData.worldSizeDiscrete = ProceduralChunkGenerator.GENERATOR_REALM_SIZE; | ||||
|         serverWorldData.worldSizeDiscreteVertical = ProceduralChunkGenerator.GENERATOR_REALM_SIZE; | ||||
| 
 | ||||
|         //test terrain gen | ||||
|         { | ||||
|             TestGenerationChunkGenerator chunkGen = new TestGenerationChunkGenerator(serverWorldData, TestGenerationChunkGenerator.DEFAULT_USE_JAVASCRIPT); | ||||
|             ProceduralChunkGenerator chunkGen = new ProceduralChunkGenerator(serverWorldData, ProceduralChunkGenerator.DEFAULT_USE_JAVASCRIPT); | ||||
|             serverTerrainManager = new ServerTerrainManager(serverWorldData, 0, chunkGen); | ||||
|             serverTerrainManager.genTestData(chunkGen); | ||||
|         } | ||||
| @ -278,12 +278,12 @@ public class ServerWorldData { | ||||
| 
 | ||||
|     /** | ||||
|      * Converts a chunk space coordinate to a real space coordinate | ||||
|      * @param chunk The position within the chunk | ||||
|      * @param voxelPos The voxel's position within the chunk | ||||
|      * @param worldPos The world pos of the chunk | ||||
|      * @return The real pos | ||||
|      */ | ||||
|     public double convertVoxelToRealSpace(int chunk, int worldPos){ | ||||
|         return chunk + this.convertWorldToReal(worldPos); | ||||
|     public double convertVoxelToRealSpace(int voxelPos, int worldPos){ | ||||
|         return voxelPos + this.convertWorldToReal(worldPos); | ||||
|     } | ||||
|      | ||||
|     public double getRelativeLocation(double real, int world){ | ||||
|  | ||||
| @ -32,7 +32,7 @@ import io.github.studiorailgun.MathUtils; | ||||
| /** | ||||
|  * A generator for testing terrain generation | ||||
|  */ | ||||
| public class TestGenerationChunkGenerator implements ChunkGenerator { | ||||
| public class ProceduralChunkGenerator implements ChunkGenerator { | ||||
| 
 | ||||
|     /** | ||||
|      * The size of the realm for testing generation | ||||
| @ -87,7 +87,7 @@ public class TestGenerationChunkGenerator implements ChunkGenerator { | ||||
|     /** | ||||
|      * Constructor | ||||
|      */ | ||||
|     public TestGenerationChunkGenerator(ServerWorldData serverWorldData, boolean useJavascript){ | ||||
|     public ProceduralChunkGenerator(ServerWorldData serverWorldData, boolean useJavascript){ | ||||
|         this.serverWorldData = serverWorldData; | ||||
|         this.registerAllGenerators(); | ||||
|         this.useJavascript = useJavascript; | ||||
| @ -85,28 +85,28 @@ public class NoiseVoxelGen implements VoxelGenerator { | ||||
|         } | ||||
|         sample = Math.min(sample,1.0); | ||||
|         if(heightDiff < -strideMultiplier * SURFACE_VOXEL_WIDTH){ | ||||
|             //below surface | ||||
|             //below surface, ie generate stone here | ||||
|             double finalSurface = sample; | ||||
|             voxel.weight = (float)finalSurface; | ||||
|             voxel.type = 1; | ||||
|         } else if(heightDiff > 0) { | ||||
|             //above surface | ||||
|             //above surface, ie generate air here | ||||
|             voxel.weight = -1.0f; | ||||
|             voxel.type = 0; | ||||
|         } else if(heightDiff < -strideMultiplier){ | ||||
|             BiomeFloorElement floorEl = surfaceParams.getFloorVariant((float)surfaceSelectionNoise); | ||||
|             //generate full-size surface-type voxel | ||||
|             //generate full-size surface-type voxel, ie generate grass here | ||||
|             double finalHeight = sample; | ||||
|             voxel.weight = (float)finalHeight; | ||||
|             voxel.type = floorEl.getVoxelId(); | ||||
|         } else { | ||||
|             BiomeFloorElement floorEl = surfaceParams.getFloorVariant((float)surfaceSelectionNoise); | ||||
|             //surface | ||||
|             //surface, ie generate grass here | ||||
|             double surfacePercent = -heightDiff / strideMultiplier; | ||||
|             if(surfacePercent > 1.0 || surfacePercent < 0){ | ||||
|                 throw new Error("surfacePercent " + surfacePercent + " " + realY + " " + surfaceHeight + " " + heightDiff + " " + strideMultiplier); | ||||
|             } | ||||
|             double finalHeight = sample * surfacePercent * 2 - 1; | ||||
|             double finalHeight = sample * surfacePercent * 2; | ||||
|             voxel.weight = (float)(finalHeight * sample); | ||||
|             voxel.type = floorEl.getVoxelId(); | ||||
|         } | ||||
|  | ||||
| @ -5,7 +5,7 @@ import electrosphere.engine.Globals; | ||||
| import electrosphere.entity.scene.RealmDescriptor; | ||||
| import electrosphere.server.datacell.ServerWorldData; | ||||
| import electrosphere.server.physics.terrain.diskmap.ChunkDiskMap; | ||||
| import electrosphere.server.physics.terrain.generation.TestGenerationChunkGenerator; | ||||
| import electrosphere.server.physics.terrain.generation.ProceduralChunkGenerator; | ||||
| import electrosphere.server.physics.terrain.generation.interfaces.ChunkGenerator; | ||||
| import electrosphere.server.physics.terrain.generation.macro.DefaultMacroGenerator; | ||||
| import electrosphere.server.physics.terrain.generation.macro.HomogenousMacroGenerator; | ||||
| @ -234,7 +234,7 @@ public class ServerTerrainManager { | ||||
|      * Generates a test terrain model | ||||
|      * @param chunkGen The chunk generator | ||||
|      */ | ||||
|     public void genTestData(TestGenerationChunkGenerator chunkGen){ | ||||
|     public void genTestData(ProceduralChunkGenerator chunkGen){ | ||||
|         this.model = TerrainModel.generateTestModel(); | ||||
|         chunkGen.setModel(model); | ||||
|     } | ||||
|  | ||||
| @ -2,7 +2,7 @@ package electrosphere.server.physics.terrain.models; | ||||
| 
 | ||||
| import electrosphere.engine.Globals; | ||||
| import electrosphere.game.data.biome.BiomeData; | ||||
| import electrosphere.server.physics.terrain.generation.TestGenerationChunkGenerator; | ||||
| import electrosphere.server.physics.terrain.generation.ProceduralChunkGenerator; | ||||
| import electrosphere.server.physics.terrain.manager.ServerTerrainChunk; | ||||
| import electrosphere.util.annotation.Exclude; | ||||
| 
 | ||||
| @ -109,12 +109,12 @@ public class TerrainModel { | ||||
|      */ | ||||
|     public static TerrainModel generateTestModel(){ | ||||
|         TerrainModel rVal = new TerrainModel(); | ||||
|         rVal.discreteArrayDimension = TestGenerationChunkGenerator.GENERATOR_REALM_SIZE; | ||||
|         int macroDataImageScale = TestGenerationChunkGenerator.GENERATOR_REALM_SIZE / DEFAULT_MACRO_DATA_SCALE + 1; | ||||
|         rVal.discreteArrayDimension = ProceduralChunkGenerator.GENERATOR_REALM_SIZE; | ||||
|         int macroDataImageScale = ProceduralChunkGenerator.GENERATOR_REALM_SIZE / DEFAULT_MACRO_DATA_SCALE + 1; | ||||
|         rVal.biome = new short[macroDataImageScale][macroDataImageScale]; | ||||
|         for(int x = 0; x < macroDataImageScale; x++){ | ||||
|             for(int z = 0; z < macroDataImageScale; z++){ | ||||
|                 rVal.biome[x][z] = TestGenerationChunkGenerator.DEFAULT_BIOME_INDEX; | ||||
|                 rVal.biome[x][z] = ProceduralChunkGenerator.DEFAULT_BIOME_INDEX; | ||||
|             } | ||||
|         } | ||||
|         rVal.biome[1][0] = 0; | ||||
|  | ||||
| @ -14,7 +14,7 @@ import electrosphere.server.macro.MacroData; | ||||
| import electrosphere.server.physics.fluid.generation.DefaultFluidGenerator; | ||||
| import electrosphere.server.physics.fluid.manager.ServerFluidManager; | ||||
| import electrosphere.server.physics.terrain.generation.DefaultChunkGenerator; | ||||
| import electrosphere.server.physics.terrain.generation.TestGenerationChunkGenerator; | ||||
| import electrosphere.server.physics.terrain.generation.ProceduralChunkGenerator; | ||||
| import electrosphere.server.physics.terrain.manager.ServerTerrainManager; | ||||
| import electrosphere.util.FileUtils; | ||||
| 
 | ||||
| @ -117,7 +117,7 @@ public class SaveUtils { | ||||
|             ServerWorldData serverWorldData = ServerWorldData.createGriddedRealmWorldData(ServerWorldData.PROCEDURAL_WORLD_SIZE); | ||||
|             FileUtils.serializeObjectToSavePath(saveName, "./world.json", serverWorldData); | ||||
|             //terrain manager | ||||
|             ServerTerrainManager serverTerrainManager = new ServerTerrainManager(serverWorldData, sceneFile.getSeed(), new TestGenerationChunkGenerator(serverWorldData, false)); | ||||
|             ServerTerrainManager serverTerrainManager = new ServerTerrainManager(serverWorldData, sceneFile.getSeed(), new ProceduralChunkGenerator(serverWorldData, false)); | ||||
|             serverTerrainManager.generate(sceneFile.getRealmDescriptor()); | ||||
|             serverTerrainManager.save(saveName); | ||||
|             //fluid manager | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user