Repository navigation
Terrain inspector: run the real generator, with toggles for its parts - #60
Merged
Merged
Conversation
Chunks are 32x32x32 and only the ones that cross the surface store blocks. The shader steps through the chunks, then through the blocks of those that have any. Hover ray casts walk the same chunks on the CPU. Uploads to the atlas are capped per frame, and the chunk table is uploaded in one piece.
The nearby surface is found by walking out of or into the block at each spot, along the normal of the face that was hit. That works for any face, and does not need one surface per column.
Nothing reads it now that the far pixel filter probes blocks. A new grid no longer uploads its empty arrays either: the color texture is sized without data, and only generated columns are ever drawn.
Turning noise into heights and colors was most of the cost of a tile, and it ran on the UI thread, 24 tiles a frame. The workers do it now, with whatever splines are current when they start. Tiles made with older splines are made again on the UI thread. Copying tiles into the grid stops after 6ms a frame.
A pixel that hit the side of a step only averaged with other sides, so it stayed dark and grainy. The spots are around the hit on the ground again, and the neighbor's top is found by walking up or down its blocks from the height of the hit. The walk is as long as the pixel is wide.
Add a biome layer and biome name in the hover readout, chunk border overlay, and a seed argument that defaults to a random seed.
The atlas is allocated for the view distance instead of at the driver's maximum, and reallocated (restarting the world) when the slider is let go. The view distance goes up to 32, and the atlas memory is shown. Scrolling zooms towards the ground under the mouse. Also cargo fmt.
Remove the heightmap terrain: the layers, flatten-below-sea-level, the per-column colors and heights, and the real terrain checkbox. The terrain is the blocks of the game's generator, colored by block. Add a "Terrain generator" section that lists the generator's toggles in the order it applies them (3D noise, caves and their parts, biomes, surface layers, biome patches, ores, decorations and each decoration by name). Changing one, or a spline, generates everything again once the mouse is let go.
Bring back the layers (final height, the noise, the splines' outputs, height impact, river distance, biomes) as a "Color by" option on top of the real blocks. "Blocks" colors by block kind, and the rest color every block by the value of its column. Spline edits recolor the loaded columns right away, and generate the terrain again when the mouse is let go.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Turns
terrain-inspector(the old spline editor) into a 3D view of the real terrain generator, so splines and generator parts can be changed live.rgen crates (behind the new
inspectorfeature, off for the game and jni)rgen_biome::Splinesandset_splines()swap the height splines thatWorldBiomes::sample_heightreads. Without the feature it reads the statics as before.rgen-world/inspector,encodefalls back to a block's default state instead of logging an error and using meta 0, since the inspector has no block registry.rgen_world::Region: generates and decorates a rectangle of chunks on the calling thread. It doesn't useCachedWorld.rgen_biome::toggles: parts of the generator that can be turned off, in the order the generator applies them: 3D density noise, caves (noodle, cheese, and their parts), biome variety, surface layers, biome patches, ores, decorations, and each decoration by name. A turned-off decoration still takes its random numbers, so the others stay in place. Without the feature, the checks compile away.terrain-inspector
Testing
cargo test -p terrain-inspectorcargo test -p rgen-biome --features inspector(a region throughRegion, and the toggles changing the output)