mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-06-22 02:27:01 +08:00
feat: water effects (#19)
* feat(shaders): add lighting to block accumulation OIT shaders * feat(renderer): add water rendering with OIT and new shaders * feat(water): implement screen-space reflection and refraction for water with depth fade and perturbation * refactor(shader): replace glUniform calls with generic set_loc and remove cached locations * feat(water): add noise-based caustics and configurable fog density * fix(water shader): update depth fade and remove underwater check - Increase DEPTH_FADE_DISTANCE from 8 to 10 - Remove conditional so depth fade always applies - Darken deepColor from (0, 0.08, 0.15) to (0, 0.015, 0.045) * feat(underwater): add volume scattering and shadow mapping for light shafts
This commit is contained in:
@@ -146,6 +146,11 @@ size_t Chunk::get_normal_blend_vertices_sum() const {
|
||||
return m_vertex_data[3].m_sum.load();
|
||||
}
|
||||
|
||||
GLuint Chunk::get_water_vao() const { return m_vertex_data[4].m_vao; }
|
||||
size_t Chunk::get_water_vertices_sum() const {
|
||||
return m_vertex_data[4].m_sum.load();
|
||||
}
|
||||
|
||||
void Chunk::gen_phase_one() {
|
||||
m_generator = std::make_unique<ChunkGenerator>(*this);
|
||||
if (!m_generator) {
|
||||
@@ -392,7 +397,14 @@ void Chunk::gen_vertices(const OptionalBlockVectorArray& neighbor_block) {
|
||||
if (BlockManager::is_discard(cur_id)) {
|
||||
m_vertex_data[2].m_vertices.emplace_back(vex);
|
||||
} else if (BlockManager::is_blend(cur_id)) {
|
||||
m_vertex_data[3].m_vertices.emplace_back(vex);
|
||||
if (cur_id == 7) {
|
||||
m_vertex_data[4].m_vertices.emplace_back(
|
||||
vex);
|
||||
} else {
|
||||
m_vertex_data[3].m_vertices.emplace_back(
|
||||
vex);
|
||||
}
|
||||
|
||||
} else {
|
||||
Logger::warn("Id {} is transparent but not "
|
||||
"discard or blend",
|
||||
|
||||
Reference in New Issue
Block a user