mirror of
https://github.com/Kbz-8/42_vox.git
synced 2026-01-11 06:33:36 +00:00
improving water
This commit is contained in:
@@ -78,7 +78,7 @@ void Chunk::GenerateMesh()
|
|||||||
std::vector<std::uint32_t>& index_data = (is_water ? m_water_mesh_index_data : m_mesh_index_data);
|
std::vector<std::uint32_t>& index_data = (is_water ? m_water_mesh_index_data : m_mesh_index_data);
|
||||||
std::uint32_t& offset = (is_water ? water_offset : mesh_offset);
|
std::uint32_t& offset = (is_water ? water_offset : mesh_offset);
|
||||||
|
|
||||||
Scop::Vec4f color = is_water ? Scop::Vec4f{ 1.0f, 1.0f, 1.0f, 0.9f } : Scop::Vec4f{ 1.0f };
|
Scop::Vec4f color = is_water ? Scop::Vec4f{ 0.3f, 0.5f, 0.7f, 0.9f } : Scop::Vec4f{ 1.0f };
|
||||||
|
|
||||||
std::uint32_t invalid_limit = is_water ? static_cast<std::uint32_t>(BlockType::Air) : static_cast<std::uint32_t>(BlockType::Water);
|
std::uint32_t invalid_limit = is_water ? static_cast<std::uint32_t>(BlockType::Air) : static_cast<std::uint32_t>(BlockType::Water);
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,12 @@ World::World(Scop::Scene& scene) : m_noisecollection(42), m_scene(scene), m_prev
|
|||||||
|
|
||||||
if(Scop::NonOwningPtr<Chunk> current_chunk = GetChunk(m_current_chunk_position); current_chunk)
|
if(Scop::NonOwningPtr<Chunk> current_chunk = GetChunk(m_current_chunk_position); current_chunk)
|
||||||
{
|
{
|
||||||
Scop::Vec3f camera_pos = scene->GetCamera()->GetPosition();
|
Scop::Vec3i camera_pos = Scop::Vec3i(std::floor(scene->GetCamera()->GetPosition().x), scene->GetCamera()->GetPosition().y, std::floor(scene->GetCamera()->GetPosition().z));
|
||||||
scene->GetPostProcessData().data.GetDataAs<std::int32_t>()[0] = current_chunk->GetBlock(Scop::Vec3i(std::abs(camera_pos.x - m_current_chunk_position.x), camera_pos.y, std::abs(camera_pos.z - m_current_chunk_position.y))) == static_cast<std::uint32_t>(BlockType::Water);
|
camera_pos.x %= CHUNK_SIZE.x;
|
||||||
|
camera_pos.z %= CHUNK_SIZE.z;
|
||||||
|
camera_pos.x += CHUNK_SIZE.x;
|
||||||
|
camera_pos.z += CHUNK_SIZE.z;
|
||||||
|
scene->GetPostProcessData().data.GetDataAs<std::int32_t>()[0] = current_chunk->GetBlock(Scop::Vec3i(camera_pos.x % CHUNK_SIZE.x, camera_pos.y, camera_pos.z % CHUNK_SIZE.z)) == static_cast<std::uint32_t>(BlockType::Water);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(input.IsKeyPressed(SDL_SCANCODE_G))
|
if(input.IsKeyPressed(SDL_SCANCODE_G))
|
||||||
|
|||||||
Reference in New Issue
Block a user