Conversation
Introduce view frustum culling and chunk load/mesh prioritization to reduce wasted GPU work and smooth streaming. Adds a Frustum class (rendering/Frustum.h/.cpp) and integrates it into Renderer::renderChunks and renderWater to cull chunk AABBs, plus frustum counters in MainGlobals and DebugUI. Updates CMake to include the new source. In main.cpp, precompute sorted load offsets, cache load radius, add adaptive enqueue limits based on pending jobs, batch/enqueue chunk loads and meshes with distance-based prioritization, and limit per-frame enqueues to avoid overloading the job system.
Introduce a biome system (Biome.h / Biome.cpp) with BiomeID, BiomeDefinition, tree types and climate-based picking. Integrate biomes into TerrainGenerator: sample temperature/humidity noise, adjust terrain amplitude, surface/filler blocks, tree type, density and trunk height; add getBiomeAt API. Update perlin seeds and reseeding for biome noise, adjust tree placement hashing and spawn chance to use biome density. Expose biome in DebugUI and add new source to CMakeLists.txt.
Introduce per-vertex biome debug tinting and a UI toggle to visualize biome colors, and reduce unnecessary region file writes plus improve terrain amplitude sampling. - Rendering/meshing: add a biomeTint vec3 to Vertex and propagate it through Meshing -> vertex attrib (location 5) -> vertex shader -> fragment shader. Fragment shader multiplies lit color by BiomeTint when useBiomeDebugTint is enabled. Renderer exposes a new uniform (useBiomeDebugTint) and reads the global showBiomeDebugColors flag from MainGlobals. Add UI checkbox to toggle "Biome Debug Colors". - Meshing: compute biome tint per block via getBiomeDebugTint() and pass chunkWorldOrigin into greedy mesher/buildChunkMeshOffThread so world coords are available. Wire up vertex attribute upload for the new tint. - Globals and UI: add showBiomeDebugColors global and ImGui entry. - Dirty-data tracking and saving: add Chunk::dirtyData and mark chunks dirty when blocks change. WorldSession, ChunkManager and enqueue/save/unload logic now only save chunks with dirtyData. RegionManager::saveColumn now reuses existing allocated sectors if they fit and avoids rewriting identical compressed data: compressed blocks are computed once and compared; skip writes if unchanged. - Job system: pass chunkWorldOrigin into buildChunkMeshOffThread for off-thread meshing. - Terrain generation: add sampleTerrainAmplitude() to blend terrain amplitudes from nearby biomes and use it in height calculations; handle beach/sand placement and adjust tree placement logic accordingly. - Minor tweaks: small biome parameter adjustments and ImGui window position/size tweak. These changes add a debug visualization for biome tinting while improving IO by skipping redundant region writes and making terrain height sample more spatially coherent.
Replace the old texture atlas with a GL_TEXTURE_2D_ARRAY loaded from individual PNG layers and populate a fixed texture enum. Add offscreen icon generation (FBO) that renders item models into 2D textures and store them as HUD icons. Propagate biome-based tinting everywhere: meshing, item model generation, particle spawning, and shaders (item/particle/default) so foliage/grass are tinted by biome. Introduce several new block types and textures (snow grass, spruce log/planks/leaves, cobblestone), update BlockTypes to use helpers and face tint flags, and add corresponding creative inventory entries. Misc: rename loadBlockIcons -> generateBlockIcons, adjust renderer initialization (create texture array, item model shader usage), remove old atlas-randomize UI buttons, fix particle texture coordinates, and various includes/cleanup. This enables per-layer textures, proper biome tinting, and generated item icons.
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.
This pull request introduces several improvements to rendering, resource management, and biome support in the codebase. The most significant changes include switching block icon generation from static image loading to dynamic 3D rendering, implementing chunk-level frustum culling for both solid and water rendering, and adding biome-related features such as block break particle tinting. The pull request also adds new source files and updates build configuration accordingly.
Rendering and resource management improvements:
generateBlockIconsfunction, replacing the previous static image loading approach. This enables more accurate and visually consistent block icons. (src/core/MainGlobals.cpp,src/core/MainGlobals.h,src/core/Renderer.cpp) [1] [2] [3]src/core/Renderer.cpp,src/core/MainGlobals.cpp,src/core/MainGlobals.h) [1] [2] [3] [4]src/core/Renderer.cpp)Biome and gameplay enhancements:
src/core/MainGlobals.cpp)src/core/MainGlobals.cpp,src/core/MainGlobals.h,src/CMakeLists.txt) [1] [2] [3]Build and source file additions:
Biome.cppandFrustum.cppto the build configuration for world and rendering functionality. (src/CMakeLists.txt) [1] [2]UI tweaks:
imgui.inifor improved layout. (imgui.ini) [1] [2]