summaryrefslogtreecommitdiff
path: root/src/chunk.h
Commit message (Collapse)AuthorAgeFilesLines
* Bugfixes, infinite loading worksAaditya Dhruv16 hours1-1/+1
|
* Add face culling - drastic reduction in rendered facesAaditya Dhruv18 hours1-1/+2
| | | | | | - Only render faces that are "visible" so - exposed to air essentially. - We also check a neighbor chunk to test if there is a block, and accordigly draw a face in the curr chunk
* Rework chunk rendering to get a 100x performance boost!Aaditya Dhruv31 hours1-3/+24
| | | | | | | | | | | | | | | | | | | | - Switching to semi-chunk mesh rendering just 100x the framerate, it was running at around 100fps for 3 CHUNK_DISTANCE, and pushing it above would make it drop to 30. Now it runs at 9000 frames per second with CHUNK_DISTANCE of 8, probably can push it even more - What is bizarre is this is just from the reduction in draw calls, I still need to implement face culling for invisible blocks (simple) and frustrum culling (using AABB) or maybe octrees - Block is way way more simplifed, it's just metadata about a coordinate in the chunk block array - All rendering and mesh generation code is handled by chunks. There is a VAO, single VBO and EBO for each chunk. The data buffer is loaded into the GPU with a chunk_load, and it stays like that until it is loaded again. chunk_load is called if we move chunks, in engine_update. Here we unload existing chunks, then load the new ones
* Add basic block texturesAaditya Dhruv39 hours1-1/+3
| | | | | | | | | - Remove the code that sent colors through uniform variables, instead send texture data - Each vertex now has a texture coordinate - struct texture is a easy way to represent textures, can be extended later - Shaders updated to use textures
* Add chunk_unloading on chunk ChangesAaditya Dhruv2 days1-1/+2
| | | | | If we change a chunk, unload all chunks. This removes block GPU data (vbo, ebo, vao). We anyways redraw so we don't lose anything
* Update chunk rendering, improve chunk loadingAaditya Dhruv2 days1-2/+27
| | | | | | | | | | - On world_init, LOAD_CHUNK amount of chunks are preloaded - Chunks are loaded around the player's current chunk, in a square shape. The size of the shape is controlled by CHUNK_DISTANCE - Allow chunks struct to be independent of a position. We load a chunk TO a position in the world chunk grid (x, y). This allows us to "wrap" chunks, so we have an endless world, but we are really just wrapping around
* Add World and multi-chunk renderingAaditya Dhruv4 days1-5/+11
| | | | | | | - More than 1 chunk can now be rendered with the help of the world struct - Block coords are now in world space, not local space - Engine init code cleaned up for cleaner world/chunk handling
* Add support for chunk and worldAaditya Dhruv5 days1-0/+21
- Chunk is a array of blocks - World is a array of chunks - Basic chunk plains generation based on simple linear functions - Bunch of functions still not implemented, in design phase