This commit is contained in:
Thyme1 2022-01-25 21:40:06 +01:00
parent 1be1d6d95a
commit 03d3efd52e
2 changed files with 11 additions and 10 deletions

View File

@ -98,11 +98,12 @@ void Core::Engine::generateBubbleArray() {
}
void Core::Engine::generateObjectArray() {
std::uniform_int_distribution<> distr(-64, 64);
for (int i = 0; i < 200; i++) {
int random1 = this->distr(this->gen);
int random2 = this->distr(this->gen);
float height = -this->skyboxVerticeParameter + this->terrain.heightTable[random1][random2] + 15;
this->objectArray[i] = glm::vec3(random1, height, random2);
int random1 = distr(this->gen);
int random2 = distr(this->gen);
float height = -this->skyboxVerticeParameter + this->terrain.heightTable[abs(random1)][abs(random2)] + 15;
this->objectArray[i] = glm::vec3(random1, height, random2) * glm::vec3(3,1,3);
}
}

View File

@ -237,11 +237,7 @@ void renderScene()
}
}
Core::drawObjectTexture(engine.submarineContext, submarineModelMatrix, engine.submarineTexture, engine.textureShader, lightDir, cameraMatrix, perspectiveMatrix);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glm::mat4 terrainTransformation = glm::translate(glm::vec3(200, -185, 200)) * glm::rotate(glm::radians(180.f), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(8.f));
Core::drawObjectTexture(engine.terrainContext, terrainTransformation, engine.terrainTexture, engine.textureShader, lightDir, cameraMatrix, perspectiveMatrix);
for (int j = 0; j < 25; j++) {
@ -258,7 +254,7 @@ void renderScene()
objectTransformation = glm::translate(engine.objectArray[75+j]) * glm::rotate(glm::radians(0.f), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(0.3f));
drawObjectTexture(engine.coral1Context, objectTransformation, engine.coral1Texture, engine.textureShader, lightDir, cameraMatrix, perspectiveMatrix);
objectTransformation = glm::translate(engine.objectArray[100+j]) * glm::rotate(glm::radians(0.f), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(0.3f));
objectTransformation = glm::translate(engine.objectArray[100+j]) * glm::rotate(glm::radians(90.f), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(0.3f));
drawObjectTexture(engine.archContext, objectTransformation, engine.archTexture, engine.textureShader, lightDir, cameraMatrix, perspectiveMatrix);
}
@ -267,6 +263,10 @@ void renderScene()
drawObjectTexture(engine.rocktower1Context, objectTransformation, engine.rocktower1Texture, engine.textureShader, lightDir, cameraMatrix, perspectiveMatrix);
}
glm::mat4 terrainTransformation = glm::translate(glm::vec3(200, -185, 200)) * glm::rotate(glm::radians(180.f), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(8.f));
Core::drawObjectTexture(engine.terrainContext, terrainTransformation, engine.terrainTexture, engine.textureShader, lightDir, cameraMatrix, perspectiveMatrix);
glutSwapBuffers();
}