diff --git a/TerrainFPS/TerrainFPS.cpp b/TerrainFPS/TerrainFPS.cpp
index 8eb60c0..df8551e 100644
--- a/TerrainFPS/TerrainFPS.cpp
+++ b/TerrainFPS/TerrainFPS.cpp
@@ -48,6 +48,11 @@ void do_movement(TerrainFPS terrain)
camera.UpdatePosition(terrain.TerrainHeight(camera.Position.x + terrain.nrows / 2, camera.Position.z + terrain.ncols / 2) * terrain.terrainHeightScale, deltaTime);
//std::cout << camera.Position.y << std::endl;
+ if (keys[GLFW_KEY_TAB]) {
+
+ glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
+ }
+
}
static void error_callback(int error, const char* description)
@@ -118,6 +123,9 @@ void OnMouseButton(GLFWwindow* window, int glfwButton, int glfwAction) {
else
bullet.Position.y += 0.0f;
bullets.push_back(bullet);
+
+ glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
+
}
}
@@ -163,7 +171,6 @@ void setup_window() {
// Set this to true so GLEW knows to use a modern approach to retrieving function pointers and extensions
glewExperimental = GL_TRUE;
-
glfwSwapInterval(1);
// Initialize GLEW to setup the OpenGL Function pointers
@@ -299,9 +306,11 @@ void TerrainFPS::GenSubDividedTerrainSurface() {
terVerts[curPlace++] = i - data->nrows / 2;
terVerts[curPlace++] = ((data->data[i][j]) - data->lowestValue) / data->range;
terVerts[curPlace++] = j - data->ncols / 2;
+
terVerts[curPlace++] = CalcColorAtElevation((data->data[i][j] - data->lowestValue) / data->range, 0);
terVerts[curPlace++] = CalcColorAtElevation((data->data[i][j] - data->lowestValue) / data->range, 1);
terVerts[curPlace++] = CalcColorAtElevation((data->data[i][j] - data->lowestValue) / data->range, 2);
+
float hL = Height(i + 1, j);
float hR = Height(i - 1, j);
float hD = Height(i, j + 1);
@@ -575,6 +584,10 @@ int main() {
deltaTime = currentFrame - lastFrame;
lastFrame = currentFrame;
+ glfwSetWindowTitle(window,
+ std::string(std::string("Terrain FPS ") + std::to_string(1 / deltaTime).c_str()).c_str()
+ );
+
// Check if any events have been activiated (key pressed, mouse moved etc.) and call corresponding response functions
glfwPollEvents();
do_movement(shooter);
diff --git a/TerrainFPS/TerrainFPS.h b/TerrainFPS/TerrainFPS.h
index 6d7b91d..26ac246 100644
--- a/TerrainFPS/TerrainFPS.h
+++ b/TerrainFPS/TerrainFPS.h
@@ -101,6 +101,7 @@ Camera camera(glm::vec3(0, 60, 0));
bool keys[1024];
GLfloat lastX = 400, lastY = 300;
bool firstMouse = true;
+bool mouseControl = false;
// Deltatime
GLfloat deltaTime = 0.0f; // Time between current frame and last frame
diff --git a/TerrainFPS/TerrainFPS.vcxproj b/TerrainFPS/TerrainFPS.vcxproj
index a944246..d428382 100644
--- a/TerrainFPS/TerrainFPS.vcxproj
+++ b/TerrainFPS/TerrainFPS.vcxproj
@@ -69,12 +69,12 @@
- C:\openglstuff\include;$(IncludePath)
+ C:\Users\Charles\Documents\Visual Studio 2015\Libraries\glm\include;C:\openglstuff\include;$(IncludePath)
C:\openglstuff\lib;$(LibraryPath)
$(ExecutablePath)
- C:\openglstuff\include;$(IncludePath)
+ C:\Users\Charles\Documents\Visual Studio 2015\Libraries\glm\include;C:\openglstuff\include;$(IncludePath)
C:\openglstuff\lib;$(LibraryPath)
@@ -82,9 +82,11 @@
Level3
Disabled
true
+ C:\Users\Charles\Documents\Visual Studio 2015\Libraries\glew\include;C:\Users\Charles\Documents\Visual Studio 2015\Libraries\glm\include;C:\Users\Charles\Documents\Visual Studio 2015\Libraries\glfw\include;%(AdditionalIncludeDirectories)
SOIL.lib;opengl32.lib;glfw3.lib;glew32s.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ C:\Users\Charles\Documents\Visual Studio 2015\Libraries\soil;C:\Users\Charles\Documents\Visual Studio 2015\Libraries\glfw\lib;C:\Users\Charles\Documents\Visual Studio 2015\Libraries\glew\lib;%(AdditionalLibraryDirectories)
@@ -92,7 +94,12 @@
Level3
Disabled
true
+ C:\Users\Charles\Documents\Visual Studio 2015\Libraries\glm\include;C:\Users\Charles\Downloads\glew-2.0.0-win32\glew-2.0.0\include;C:\Users\Charles\Downloads\glfw-3.2.1\glfw-3.2.1\include;%(AdditionalIncludeDirectories)
+
+ glfw3.lib;glew32s.lib;%(AdditionalDependencies)
+ C:\Users\Charles\Documents\Visual Studio 2015\Libraries\glew\lib;C:\Users\Charles\Downloads\glfw-3.2.1.bin.WIN32\glfw-3.2.1.bin.WIN32\lib-vc2015;%(AdditionalLibraryDirectories)
+
@@ -101,11 +108,13 @@
true
true
true
+ C:\Users\Charles\Documents\Visual Studio 2015\Libraries\glew\include;C:\Users\Charles\Documents\Visual Studio 2015\Libraries\glm\include;C:\Users\Charles\Documents\Visual Studio 2015\Libraries\glfw\include;%(AdditionalIncludeDirectories)
true
true
SOIL.lib;opengl32.lib;glfw3.lib;glew32s.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ C:\Users\Charles\Documents\Visual Studio 2015\Libraries\soil;C:\Users\Charles\Documents\Visual Studio 2015\Libraries\glfw\lib;C:\Users\Charles\Documents\Visual Studio 2015\Libraries\glew\lib;%(AdditionalLibraryDirectories)
@@ -115,10 +124,13 @@
true
true
true
+ C:\Users\Charles\Documents\Visual Studio 2015\Libraries\glm\include;C:\Users\Charles\Downloads\glew-2.0.0-win32\glew-2.0.0\include;C:\Users\Charles\Downloads\glfw-3.2.1\glfw-3.2.1\include;%(AdditionalIncludeDirectories)
true
true
+ glfw3.lib;glew32s.lib;%(AdditionalDependencies)
+ C:\Users\Charles\Documents\Visual Studio 2015\Libraries\glew\lib;C:\Users\Charles\Downloads\glfw-3.2.1.bin.WIN32\glfw-3.2.1.bin.WIN32\lib-vc2015;%(AdditionalLibraryDirectories)