Added color gradient for the terrain blend maps

Added terrainBuffer struct
Added shared methods to genereate random UV's and intensities
Added water to the terrain
Added random UV's to the shader
Removed the vector3d class since DX can deal with that stuff...
This commit is contained in:
iDunnoDev
2022-05-04 14:09:59 +01:00
committed by iDunnoDev
parent 7a57c73ac3
commit bc906064e5
15 changed files with 597 additions and 254 deletions

View File

@ -12,12 +12,38 @@ float SharedMethods::RGBValueToIntensity(int value)
return (float)value / 255.0f;
}
float SharedMethods::lerp(int a, int b, int p)
float SharedMethods::Lerp(int a, int b, int p)
{
return lerp((float)a, (float)b, (float)p);
return Lerp((float)a, (float)b, (float)p);
}
float SharedMethods::lerp(float a, float b, float p)
float SharedMethods::Lerp(float a, float b, float p)
{
return a + p * (b - a);
}
float SharedMethods::GenerateRandomIntensity(float min, float max)
{
float randNo = (float)rand() / (float)RAND_MAX;
float rangeDiff = max - min;
float actualNo = randNo * rangeDiff;
int roundedNo = (int)(actualNo * 100 + 0.5f);
return (float)roundedNo * 0.01f;
}
float SharedMethods::GenerateRandomUV(int min, int max)
{
int randNo = rand() % ((max - min) + 1) + min;
float finalNo;
if (randNo < max)
{
int randMan = rand() % 90;
finalNo = (float)(randNo * 0.1f) + (randMan * 0.01f);
}
else
{
finalNo = (float)randNo * 0.1f;
}
return finalNo;
}