statek dziala na orbicie

This commit is contained in:
Wojciech Łukasik 2021-02-23 13:43:04 +01:00
parent 971ba90194
commit 67658b98c8
2 changed files with 30176 additions and 4 deletions

30172
models/ship_orbita.obj Normal file

File diff suppressed because it is too large Load Diff

View File

@ -174,7 +174,7 @@ void renderScene()
// Aktualizacja macierzy widoku i rzutowania. // Aktualizacja macierzy widoku i rzutowania.
cameraMatrix = createCameraMatrix(); cameraMatrix = createCameraMatrix();
perspectiveMatrix = Core::createPerspectiveMatrix(0.1f, 1000.f); perspectiveMatrix = Core::createPerspectiveMatrix(0.1f, 1500.f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearColor(0.0f, 0.3f, 0.3f, 1.0f); glClearColor(0.0f, 0.3f, 0.3f, 1.0f);
@ -184,7 +184,7 @@ void renderScene()
//SHIP //SHIP
glm::mat4 shipModelMatrix = glm::translate(cameraPos + cameraDir * 4.f + glm::vec3(0, -0.25f, 0)) * glm::rotate(glm::orientedAngle(glm::vec3(0, 0, 1), cameraDir, glm::vec3(0, 1, 0)), glm::vec3(0,1,0)) * glm::scale(glm::vec3(0.2)) * glm::translate(glm::vec3(2, 0, 0)); glm::mat4 shipModelMatrix = glm::translate(cameraPos + cameraDir * 4.f + glm::vec3(0, -0.25f, 0)) * glm::rotate(glm::orientedAngle(glm::vec3(0, 0, 1), cameraDir, glm::vec3(0, 1, 0)), glm::vec3(0,1,0)) * glm::scale(glm::vec3(0.2)) * glm::translate(glm::vec3(2, 0, 0));
drawObjectColor(&shipContext, shipModelMatrix, glm::vec3(0.5)); drawObjectTexture(&shipContext, shipModelMatrix, textureShip);
//SUN //SUN
//drawObjectTexture(&sphereModel, glm::translate(glm::vec3(0, 0, 0)) * glm::scale(glm::vec3(20.f)), textureSun); //drawObjectTexture(&sphereModel, glm::translate(glm::vec3(0, 0, 0)) * glm::scale(glm::vec3(20.f)), textureSun);
@ -218,7 +218,7 @@ void init()
programTexture = shaderLoader.CreateProgram("shaders/shader_tex.vert", "shaders/shader_tex.frag"); programTexture = shaderLoader.CreateProgram("shaders/shader_tex.vert", "shaders/shader_tex.frag");
programSun = shaderLoader.CreateProgram("shaders/shader_4_2.vert", "shaders/shader_4_2.frag"); programSun = shaderLoader.CreateProgram("shaders/shader_4_2.vert", "shaders/shader_4_2.frag");
shipModel = obj::loadModelFromFile("models/box.obj"); shipModel = obj::loadModelFromFile("models/ship_orbita.obj");
shipContext.initFromOBJ(shipModel); shipContext.initFromOBJ(shipModel);
stationModel = obj::loadModelFromFile("models/box.obj"); stationModel = obj::loadModelFromFile("models/box.obj");
@ -227,7 +227,7 @@ void init()
sphereModel = obj::loadModelFromFile("models/sphere.obj"); sphereModel = obj::loadModelFromFile("models/sphere.obj");
sphereContext.initFromOBJ(sphereModel); sphereContext.initFromOBJ(sphereModel);
textureShip = Core::LoadTexture("textures/spaceship.png"); textureShip = Core::LoadTexture("textures/ship.png");
textureEarthHighres = Core::LoadTexture("textures/4k_earth_daymap.png"); textureEarthHighres = Core::LoadTexture("textures/4k_earth_daymap.png");
textureAsteroid = Core::LoadTexture("textures/asteroid.png"); textureAsteroid = Core::LoadTexture("textures/asteroid.png");
textureSun = Core::LoadTexture("textures/2k_sun_texture.png"); textureSun = Core::LoadTexture("textures/2k_sun_texture.png");