feat: make skybox bigger, add new sand texture

This commit is contained in:
matixezor 2022-01-25 17:33:01 +01:00
parent cef7267f78
commit 1ecf2d309f
7 changed files with 9 additions and 9 deletions

View File

@ -5,7 +5,7 @@
namespace Core namespace Core
{ {
glm::mat4 createPerspectiveMatrix(float zNear = 0.1f, float zFar = 500.0f); glm::mat4 createPerspectiveMatrix(float zNear = 0.1f, float zFar = 800.f);
// position - pozycja kamery // position - pozycja kamery
// forward - wektor "do przodu" kamery (jednostkowy) // forward - wektor "do przodu" kamery (jednostkowy)

View File

@ -27,7 +27,7 @@ void Core::Engine::loadTextures() {
this->fishTexture = LoadTexture("textures/fish.png"); this->fishTexture = LoadTexture("textures/fish.png");
this->submarineTexture = LoadTexture("textures/submarine.png"); this->submarineTexture = LoadTexture("textures/submarine.png");
this->bubbleTexture = LoadTexture("textures/bubble.png"); this->bubbleTexture = LoadTexture("textures/bubble.png");
this->terrainTexture = LoadTexture("textures/terrain.jpg"); this->terrainTexture = LoadTexture("textures/sand2.jpg");
this->skyboxTexture = loadCubemap(); this->skyboxTexture = loadCubemap();
} }
@ -133,7 +133,7 @@ const float Core::Engine::cubeVertices[216] = {
-0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f
}; };
const float Core::Engine::skyboxVerticeParameter = 50.0f; const float Core::Engine::skyboxVerticeParameter = 200.0f;
const float Core::Engine::skyboxVertices[108] = { const float Core::Engine::skyboxVertices[108] = {
-skyboxVerticeParameter, skyboxVerticeParameter, -skyboxVerticeParameter, -skyboxVerticeParameter, skyboxVerticeParameter, -skyboxVerticeParameter,

View File

@ -11,7 +11,7 @@ const int HeightGenerator::SEED = rd();
float HeightGenerator::generateHeight(int x, int z) { float HeightGenerator::generateHeight(int x, int z) {
float total = 0; float total = 0;
int p = 0.5f; int p = 0.25f;
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
float freq = pow(2, i); float freq = pow(2, i);
float amp = pow(p, i); float amp = pow(p, i);

View File

@ -25,8 +25,8 @@ obj::Model Terrain::generateTerrain() {
normals[vertexPointer * 3] = normal.x; normals[vertexPointer * 3] = normal.x;
normals[vertexPointer * 3 + 1] = normal.y; normals[vertexPointer * 3 + 1] = normal.y;
normals[vertexPointer * 3 + 2] = normal.z; normals[vertexPointer * 3 + 2] = normal.z;
textureCoords[vertexPointer * 2] = float(j) / float(VERTEX_COUNT - 1); textureCoords[vertexPointer * 2] = float(j) / float(VERTEX_COUNT - 1) * 40;
textureCoords[vertexPointer * 2 + 1] = float(i) / float(VERTEX_COUNT - 1); textureCoords[vertexPointer * 2 + 1] = float(i) / float(VERTEX_COUNT - 1) * 40;
vertexPointer++; vertexPointer++;
} }
} }

View File

@ -17,7 +17,7 @@
Core::Engine engine; Core::Engine engine;
float skyboxBoundary = 48.0f; float skyboxBoundary = 500.f;//198.0f;
float old_x, old_y = -1; float old_x, old_y = -1;
glm::vec3 cursorDiff; glm::vec3 cursorDiff;
@ -61,7 +61,7 @@ bool isInBoundaries(glm::vec3 nextPosition) {
void keyboard(unsigned char key, int x, int y) void keyboard(unsigned char key, int x, int y)
{ {
float angleSpeed = 10.f; float angleSpeed = 10.f;
float moveSpeed = 1.0f; float moveSpeed = 2.0f;
glm::vec3 nextPosition; glm::vec3 nextPosition;
switch (key) switch (key)
{ {
@ -239,7 +239,7 @@ void renderScene()
Core::drawObjectTexture(engine.submarineContext, submarineModelMatrix, engine.submarineTexture, engine.textureShader, lightDir, cameraMatrix, perspectiveMatrix); Core::drawObjectTexture(engine.submarineContext, submarineModelMatrix, engine.submarineTexture, engine.textureShader, lightDir, cameraMatrix, perspectiveMatrix);
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
glCullFace(GL_BACK); glCullFace(GL_BACK);
glm::mat4 terrainTransformation = glm::translate(glm::vec3(50, -45, 50)) * glm::rotate(glm::radians(180.f), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(2.f)); 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); Core::drawObjectTexture(engine.terrainContext, terrainTransformation, engine.terrainTexture, engine.textureShader, lightDir, cameraMatrix, perspectiveMatrix);

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB