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

@ -0,0 +1,36 @@
#include "HeightMapTerrainNode.h"
#define WORLD_HEIGHT 1024
HeightMapTerrainNode::HeightMapTerrainNode(wstring name, wstring heightMap, wstring seed, float waterHeight, int widthX, int widthZ, int cellSizeX, int cellSizeZ) : TerrainNode(name, seed, waterHeight, widthX, widthZ, cellSizeX, cellSizeZ)
{
_heightMap = heightMap;
if (!LoadHeightMap(_heightMap))
{
_initError = true;
}
}
bool HeightMapTerrainNode::LoadHeightMap(wstring heightMapFilename)
{
unsigned int mapSize = _gridCols * _gridRows;
USHORT* rawFileValues = new USHORT[mapSize];
std::ifstream inputHeightMap;
inputHeightMap.open(heightMapFilename.c_str(), std::ios_base::binary);
if (!inputHeightMap)
{
return false;
}
inputHeightMap.read((char*)rawFileValues, mapSize * 2);
inputHeightMap.close();
// Normalise BYTE values to the range 0.0f - 1.0f;
for (unsigned int i = 0; i < mapSize; i++)
{
_heightValues.push_back((float)rawFileValues[i] / 65536);
}
delete[] rawFileValues;
return true;
}