Lots of additional comments, terrain shifted by 0.3f

This commit is contained in:
s469065 2023-02-13 19:07:38 +01:00
parent 747aa7c8c9
commit a2902e6eeb

View File

@ -4,7 +4,6 @@
#include "ext.hpp"
#include <iostream>
#include <cmath>
#include <vector>
#include "Shader_Loader.h"
#include "Render_Utils.h"
@ -228,7 +227,7 @@ void Terraingen() {
for (int y = 0; y < size; y++)
{
//Generating noise for point based on time
//Generating noise, based on x and y coordinates
float noise = glm::simplex(glm::vec2(
(x - size / 2) * scaleA,
(y - size / 2) * scaleA
@ -237,7 +236,7 @@ void Terraingen() {
noise = (noise + 1) / 2;
//x, y, z of a point
vertices.push_back(glm::vec3(
((x - size / 2) * scaleB)+5,
((x - size / 2) * scaleB)+5.3f,
((noise * 1.2f)-0.65f),
(y - size / 2) * scaleB
));
@ -299,8 +298,8 @@ void Terraingen() {
}
//function with chatGPT help
//A function to write terrain into a file
//function pregenerated by chatGPT
//Converst the 3 arrays (vertives, indices and normals) into a Wavefront .obj file, in a f v//vn shortened format
void WriteOBJ(const std::string& GeneratedTerrain) {
// Open the output file
std::ofstream outFile(GeneratedTerrain);
@ -1013,7 +1012,7 @@ void init(GLFWwindow* window)
loadModelToContext("./models/algae3.obj", models::algae3Context);
//model created manually
loadModelToContext("./models/glassWindow.obj", models::glassWindowContext);
//model created manually(by generating)
//model created automatically within code
loadModelToContext("./models/GeneratedTerrain.obj", models::ProcedurallyGT);
@ -1085,23 +1084,6 @@ void init(GLFWwindow* window)
);
}
//
/*
glGenVertexArrays(1, &TerrainVAO);
glGenBuffers(1, &TerrainVBO);
glGenBuffers(1, &TerrainIBO);
glBindVertexArray(TerrainVAO);
glBindBuffer(GL_ARRAY_BUFFER, TerrainVBO);
glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(glm::vec3), vertices.data(), GL_STATIC_DRAW);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, TerrainIBO);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(unsigned int), indices.data(), GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);
glEnableVertexAttribArray(0);
glBindVertexArray(0);
//glBindBuffer(GL_ARRAY_BUFFER, 0);
//glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
*/
}
void shutdown(GLFWwindow* window)