From aa70421d6888224e96ecec64fd6463e16a78a0a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Paterka?= Date: Thu, 25 Feb 2021 14:48:31 +0100 Subject: [PATCH] dokowanie i rozbicie --- src/projekt.cpp | 58 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 51 insertions(+), 7 deletions(-) diff --git a/src/projekt.cpp b/src/projekt.cpp index 42e4b36..a99245b 100644 --- a/src/projekt.cpp +++ b/src/projekt.cpp @@ -23,6 +23,9 @@ GLuint programSun; GLuint cubemapTexture; GLuint cubemapTexture2; GLuint cubemapTexture3; +GLuint cubemapTexture4; +GLuint cubemapTexture5; + GLuint skyboxVAO, skyboxVBO; Core::Shader_Loader shaderLoader; @@ -99,7 +102,27 @@ std::vector faces3 "textures/skybox/stars4.jpeg", }; +//dokwanie +std::vector faces4 +{ + "textures/skybox/stars3.jpeg", + "textures/skybox/stars3.jpeg", + "textures/skybox/stars3.jpeg", + "textures/skybox/stars3.jpeg", + "textures/skybox/stars3.jpeg", + "textures/skybox/stars3.jpeg", +}; +//rozbicie +std::vector faces5 +{ + "textures/skybox/stars4.jpeg", + "textures/skybox/stars4.jpeg", + "textures/skybox/stars4.jpeg", + "textures/skybox/stars4.jpeg", + "textures/skybox/stars4.jpeg", + "textures/skybox/stars4.jpeg", +}; // Initalization of physical scene (PhysX) Physics pxScene(9.8 /* gravity (m/s^2) */); @@ -533,6 +556,7 @@ void renderScene() float distance = sqrt((cameraPos.x - stationPos.x)*(cameraPos.x - stationPos.x) + (cameraPos.z - stationPos.z)* (cameraPos.z - stationPos.z)); std::cout << "distance: " << distance << std::endl; + std::cout << "speed: " << orbitSpeed << std::endl; //std::cout << "cameraPos.x: " << cameraPos.x << "cameraPos.z: " << cameraPos.z < 0.01) + { + float time = glutGet(GLUT_ELAPSED_TIME) / 1000.0f - appLoadingTime; - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glClearColor(0.0f, 0.1f, 0.3f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glClearColor(0.0f, 0.1f, 0.3f, 1.0f); - cameraMatrix = createCameraMatrixLoading(); - perspectiveMatrix = Core::createPerspectiveMatrix(0.1f, 1500.f); - Skybox::drawSkybox(programSkybox, cameraMatrix, perspectiveMatrix, cubemapTexture3); + cameraMatrix = createCameraMatrixLoading(); + perspectiveMatrix = Core::createPerspectiveMatrix(0.1f, 1500.f); + Skybox::drawSkybox(programSkybox, cameraMatrix, perspectiveMatrix, cubemapTexture5); - glutSwapBuffers(); + glutSwapBuffers(); + } + else + //dokowanie + { + float time = glutGet(GLUT_ELAPSED_TIME) / 1000.0f - appLoadingTime; + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glClearColor(0.0f, 0.1f, 0.3f, 1.0f); + + cameraMatrix = createCameraMatrixLoading(); + perspectiveMatrix = Core::createPerspectiveMatrix(0.1f, 1500.f); + Skybox::drawSkybox(programSkybox, cameraMatrix, perspectiveMatrix, cubemapTexture4); + + glutSwapBuffers(); + } } } @@ -589,6 +631,8 @@ void init() cubemapTexture = Skybox::loadCubemap(faces); cubemapTexture2 = Skybox::loadCubemap(faces2); cubemapTexture3 = Skybox::loadCubemap(faces3); + cubemapTexture4 = Skybox::loadCubemap(faces4); + cubemapTexture5 = Skybox::loadCubemap(faces5); glEnable(GL_DEPTH_TEST);