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:
@ -12,6 +12,7 @@
|
||||
#include "MeshNode.h"
|
||||
#include "SplitMeshNode.h"
|
||||
|
||||
// Struct for holding the terrain vertex data
|
||||
typedef struct TerrainVertex
|
||||
{
|
||||
XMFLOAT3 Position;
|
||||
@ -20,6 +21,8 @@ typedef struct TerrainVertex
|
||||
XMFLOAT2 BlendMapTexCoord;
|
||||
} TerrainVertex;
|
||||
|
||||
// Custom CBuffer for the terrain that can hold the water values, THE BYTE TOTAL FOR THIS MUST HAVE A FACTOR OF 16!!
|
||||
// a float is 4 bytes, so we techically dont need to pad with the array at the bottom but i left it in to remind myself
|
||||
struct TCBUFFER
|
||||
{
|
||||
XMMATRIX completeTransformation;
|
||||
@ -38,6 +41,7 @@ struct TCBUFFER
|
||||
float padding[4];
|
||||
};
|
||||
|
||||
// Class for processing the data of a terrain, one of the child classes should be passing the values to here to process as this class does not generate any actual values.
|
||||
class TerrainNode : public SceneNode
|
||||
{
|
||||
public:
|
||||
@ -51,13 +55,16 @@ public:
|
||||
void Render(void);
|
||||
void virtual Shutdown(void);
|
||||
|
||||
// Method for randomly placing models onto the terrain with the given commands
|
||||
void PopulateTerrain(SceneGraphPointer currentSceneGraph, vector<TerrainPopNode>& nodesForPop, int xStep, int zStep, float heightLower, float heightUpper, float slopeLower, float slopeUpper);
|
||||
|
||||
// Methods for checking if you are in the bounds
|
||||
float GetHeightAtPoint(float x, float z, bool waterCollide = false);
|
||||
bool CheckXBoundary(float x);
|
||||
bool CheckZBoundary(float z);
|
||||
|
||||
protected:
|
||||
// Bool so we can set this if the children have an error processing the data and we wont run
|
||||
bool _initError = false;
|
||||
|
||||
int _widthX;
|
||||
@ -80,6 +87,7 @@ protected:
|
||||
float _terrainEndX;
|
||||
float _terrainEndZ;
|
||||
|
||||
// Vars for dealing with the random number seed
|
||||
wstring _seedString;
|
||||
unsigned int _seedHash;
|
||||
|
||||
@ -111,7 +119,9 @@ protected:
|
||||
ComPtr<ID3D11RasterizerState> _defaultRasteriserState;
|
||||
ComPtr<ID3D11RasterizerState> _wireframeRasteriserState;
|
||||
|
||||
// Pointer for the snow texture since i could not load it with the other textures, i think its because of mixed formats
|
||||
ComPtr<ID3D11ShaderResourceView> _snowTest;
|
||||
|
||||
ComPtr<ID3D11ShaderResourceView> _waterNormalMap;
|
||||
XMFLOAT4 _waterColor;
|
||||
|
||||
@ -126,9 +136,13 @@ protected:
|
||||
void LoadTerrainTextures();
|
||||
void GenerateBlendMap();
|
||||
|
||||
// Method to get a height value at the given index
|
||||
float GetHeightValueAt(int index);
|
||||
|
||||
// Method for adding the normals to each vertex, easier to manage this way
|
||||
void AddNormalToVertex(int row, int col, int vertexIndex, XMVECTOR normal);
|
||||
|
||||
// Method for loading the extra image maps we had, but now just for the water normals
|
||||
void BuildExtraMaps();
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user