dokowanie i rozbicie

This commit is contained in:
Mikołaj Paterka 2021-02-25 14:48:31 +01:00
parent 71cdfca0d1
commit aa70421d68

View File

@ -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<std::string> faces3
"textures/skybox/stars4.jpeg",
};
//dokwanie
std::vector<std::string> 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<std::string> 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 <<std::endl;
//std::cout << "stationPos.x: " << stationPos.x << "stationPos.z: " << stationPos.z << std::endl;
if (distance < 5) {
@ -564,16 +588,34 @@ void renderScene()
//end
else
{
float time = glutGet(GLUT_ELAPSED_TIME) / 1000.0f - appLoadingTime;
//rozbicie statku
if (orbitSpeed > 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);