Skip to content

new textures and block icons#4

Merged
dawc17 merged 4 commits into
masterfrom
dev
Feb 11, 2026
Merged

new textures and block icons#4
dawc17 merged 4 commits into
masterfrom
dev

Conversation

@dawc17

@dawc17 dawc17 commented Feb 11, 2026

Copy link
Copy Markdown
Owner

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:

  • Block icons are now generated dynamically by rendering 3D models to textures with the new generateBlockIcons function, 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]
  • The rendering pipeline now performs chunk-level frustum culling for both solid and water chunks, improving performance by skipping rendering of chunks outside the camera view. Counters for tested, culled, and drawn chunks are tracked for debugging and optimization. (src/core/Renderer.cpp, src/core/MainGlobals.cpp, src/core/MainGlobals.h) [1] [2] [3] [4]
  • The block texture array loading process was refactored to load individual block textures instead of extracting tiles from a single atlas, and now includes logic for compositing overlay textures (e.g., grass side overlay) for more flexible texture management. (src/core/Renderer.cpp)

Biome and gameplay enhancements:

  • Block break particles now use biome-specific tint colors for grass and foliage blocks, improving visual feedback and immersion. (src/core/MainGlobals.cpp)
  • Support for biome debug colors and related rendering features was added, along with new biome-related source files and build configuration updates. (src/core/MainGlobals.cpp, src/core/MainGlobals.h, src/CMakeLists.txt) [1] [2] [3]

Build and source file additions:

  • Added new source files Biome.cpp and Frustum.cpp to the build configuration for world and rendering functionality. (src/CMakeLists.txt) [1] [2]

UI tweaks:

  • Adjusted window positions and sizes in imgui.ini for improved layout. (imgui.ini) [1] [2]

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.
@dawc17
dawc17 merged commit 4e6386e into master Feb 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant