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,5 +1,5 @@
#pragma once
#include "DirectXFramework.h"
#include "DirectXCore.h"
struct CBUFFER
{
@ -16,33 +16,45 @@ struct CBUFFER
float padding[2];
};
struct TCBUFFER
{
XMMATRIX completeTransformation;
XMMATRIX worldTransformation;
XMFLOAT4 cameraPosition;
XMVECTOR lightVector;
XMFLOAT4 lightColor;
XMFLOAT4 ambientColor;
XMFLOAT4 diffuseCoefficient;
XMFLOAT4 specularCoefficient;
float shininess;
float opacity;
float waterHeight;
float waterShininess;
XMFLOAT4 waterColor;
float padding[4];
};
namespace SharedMethods
{
XMMATRIX RotateFromPoint(float x, float y, float z, XMMATRIX rotationMatrix);
XMMATRIX RotateFromPoint(const float x, const float y, const float z, const XMMATRIX rotationMatrix);
float RGBValueToIntensity(int value);
float Lerp(int a, int b, int p);
float Lerp(float a, float b, float p);
float RGBValueToIntensity(const int value);
template <typename T = float> T Clamp(const T value, const T min, const T max)
{
if (value < min)
{
return min;
}
else if (value > max)
{
return max;
}
else
{
return value;
}
}
float GenerateRandomIntensity(float min, float max);
float GenerateRandomUV(int min, int max);
// Methods for lerping values
template <typename T = float> float Lerp(const T a, const T b, const float p)
{
return (float)a + p * ((float)b - (float)a);
}
template <typename T = float> float CubicInterpolate(const T n0, const T n1, const T n2, const T n3, const float a)
{
float p = ((float)n3 - (float)n2) - ((float)n0 - (float)n1);
float q = ((float)n0 - (float)n1) - p;
float r = (float)n2 - (float)n0;
float s = (float)n1;
return p * a * a * a + q * a * a + r * a + s;
}
float GenerateRandomIntensity(const float min, const float max);
float GenerateRandomUV(const float min, const float max);
};