* Add clouds! (optional feature)

This commit is contained in:
iProgramInCpp
2023-08-13 20:38:52 +03:00
parent 206bc5cce0
commit 2da5c2e2fe
11 changed files with 148 additions and 11 deletions

View File

@@ -1246,6 +1246,25 @@ Vec3 Level::getFogColor(float f)
return m_pDimension->getFogColor(getTimeOfDay(f), f);
}
Vec3 Level::getCloudColor(float f)
{
Vec3 result;
float fTODCosAng = Mth::cos(getSunAngle(f));
float mult = 2 * fTODCosAng + 0.5f;
if (mult < 0.0f)
mult = 0.0f;
if (mult > 1.0f)
mult = 1.0f;
result.x = mult * 0.9f + 0.1f;
result.y = result.x;
result.z = mult * 0.85f + 0.15f;
return result;
}
bool Level::isUnobstructed(AABB* aabb)
{
EntityVector* entities = getEntities(nullptr, *aabb);

View File

@@ -113,6 +113,7 @@ public:
bool canSeeSky(int x, int y, int z);
Vec3 getSkyColor(Entity* pEnt, float f);
Vec3 getFogColor(float f);
Vec3 getCloudColor(float f);
bool isUnobstructed(AABB*);
bool mayInteract(Player* player, int x, int y, int z);
bool mayPlace(TileID tid, int x, int y, int z, bool b);