Added Comments
Added ability to hold shift and skip the terrain generation when loading Added ability for the perlin terrain to save a raw image of the terrain to use as a cache
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
#include "DirectXCore.h"
|
||||
#include <string>
|
||||
|
||||
// The generic CBuffer used in most of the nodes
|
||||
struct CBUFFER
|
||||
{
|
||||
XMMATRIX completeTransformation;
|
||||
@ -18,6 +19,7 @@ struct CBUFFER
|
||||
float padding[1];
|
||||
};
|
||||
|
||||
// Struct to hold the terrain populate methods variables
|
||||
struct TerrainPopNode
|
||||
{
|
||||
std::wstring nodeBaseName;
|
||||
@ -25,12 +27,16 @@ struct TerrainPopNode
|
||||
float scaleFactor;
|
||||
};
|
||||
|
||||
// The Shared methods namespace should be used for functions that are used in many places to stop duplicate code and keep things consolidated
|
||||
namespace SharedMethods
|
||||
{
|
||||
// Function for creating a rotation matrix that should be around a specific point
|
||||
XMMATRIX RotateFromPoint(const float x, const float y, const float z, const XMMATRIX rotationMatrix);
|
||||
|
||||
// Function for converting a 255 style RGB value to its normalised intensity value
|
||||
float RGBValueToIntensity(const int value);
|
||||
|
||||
// Template function for clamping a number between 2 values, the template allows this to be used for any numeric type
|
||||
template <typename T = float> T Clamp(const T value, const T min, const T max)
|
||||
{
|
||||
if (value < min)
|
||||
@ -47,12 +53,13 @@ namespace SharedMethods
|
||||
}
|
||||
}
|
||||
|
||||
// Methods for lerping values
|
||||
// Template function 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 function for doing a cubic interpolate, i think this is unused currently but i did play around with the idea
|
||||
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);
|
||||
@ -63,7 +70,10 @@ namespace SharedMethods
|
||||
return p * a * a * a + q * a * a + r * a + s;
|
||||
}
|
||||
|
||||
// Function for generating a random float value
|
||||
float GenerateRandomIntensity(const float min, const float max);
|
||||
|
||||
// Function for generating random UV values
|
||||
float GenerateRandomUV(const float min, const float max);
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user