Added follow cam

Added "Controlled" mesh classes
Added Global Lighting Class
Added Gamepad controls
Split terrain nodes into Height and Perlin classes
Fixed Splitmesh node stuff
This commit is contained in:
iDunnoDev
2022-05-09 17:50:22 +01:00
committed by iDunnoDev
parent bc906064e5
commit f6bba67897
58 changed files with 1743 additions and 351 deletions

View File

@ -1,28 +1,19 @@
#include "SharedMethods.h"
XMMATRIX SharedMethods::RotateFromPoint(float x, float y, float z, XMMATRIX rotationMatrix)
XMMATRIX SharedMethods::RotateFromPoint(const float x, const float y, const float z, const XMMATRIX rotationMatrix)
{
// Translates a matrix to a point, rotates and then returns back to where it was
return XMMatrixTranslation(x, y, z) * rotationMatrix * XMMatrixTranslation(-x, -y, -z);
}
// Method so i can use normal RGB values and hopefully hex values too since im use to those
float SharedMethods::RGBValueToIntensity(int value)
float SharedMethods::RGBValueToIntensity(const int value)
{
return (float)value / 255.0f;
}
float SharedMethods::Lerp(int a, int b, int p)
{
return 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)
// Method to generate a random intensity rating between 2 floats
float SharedMethods::GenerateRandomIntensity(const float min, const float max)
{
float randNo = (float)rand() / (float)RAND_MAX;
float rangeDiff = max - min;
@ -31,19 +22,8 @@ float SharedMethods::GenerateRandomIntensity(float min, float max)
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;
// Method for genering random UV's, maybe get rid of this in future
float SharedMethods::GenerateRandomUV(const float min, const float max)
{
return SharedMethods::Clamp<float>((float)(rand() % (int)(max * 100.0f)) * 0.01f, (float)min, (float)max);
}