merge kuba to master
This commit is contained in:
commit
aa3dada9fb
@ -32,9 +32,9 @@ float appLoadingTime;
|
|||||||
obj::Model planeModel;
|
obj::Model planeModel;
|
||||||
obj::Model shipModel;
|
obj::Model shipModel;
|
||||||
obj::Model sphereModel;
|
obj::Model sphereModel;
|
||||||
obj::Model boxModel;
|
obj::Model stationModel;
|
||||||
|
|
||||||
Core::RenderContext planeContext, shipContext, sphereContext, boxContext;
|
Core::RenderContext planeContext, shipContext, sphereContext, stationContext;
|
||||||
|
|
||||||
float cameraAngle = glm::radians(0.0f);
|
float cameraAngle = glm::radians(0.0f);
|
||||||
glm::vec3 cameraPos = glm::vec3(0, 0 , 250);
|
glm::vec3 cameraPos = glm::vec3(0, 0 , 250);
|
||||||
@ -105,7 +105,7 @@ glm::mat4 createCameraMatrix()
|
|||||||
// Obliczanie kierunku patrzenia kamery (w plaszczyznie x-z) przy uzyciu zmiennej cameraAngle kontrolowanej przez klawisze.
|
// Obliczanie kierunku patrzenia kamery (w plaszczyznie x-z) przy uzyciu zmiennej cameraAngle kontrolowanej przez klawisze.
|
||||||
cameraPos = glm::rotate(cameraPos, orbitSpeed, glm::vec3(0, 1, 0));
|
cameraPos = glm::rotate(cameraPos, orbitSpeed, glm::vec3(0, 1, 0));
|
||||||
//cameraDir = glm::vec3(cosf(cameraAngle), 0.0f, sinf(cameraAngle));
|
//cameraDir = glm::vec3(cosf(cameraAngle), 0.0f, sinf(cameraAngle));
|
||||||
cameraDir = glm::normalize(glm::vec3(0, -1, 0) - cameraPos);
|
cameraDir = glm::normalize(glm::vec3(0, 0, 0) - cameraPos);
|
||||||
glm::vec3 up = glm::vec3(0, 1, 0);
|
glm::vec3 up = glm::vec3(0, 1, 0);
|
||||||
|
|
||||||
return Core::createViewMatrix(cameraPos, cameraDir, up);
|
return Core::createViewMatrix(cameraPos, cameraDir, up);
|
||||||
@ -176,7 +176,7 @@ void renderScene()
|
|||||||
|
|
||||||
// Aktualizacja macierzy widoku i rzutowania.
|
// Aktualizacja macierzy widoku i rzutowania.
|
||||||
cameraMatrix = createCameraMatrix();
|
cameraMatrix = createCameraMatrix();
|
||||||
perspectiveMatrix = Core::createPerspectiveMatrix(0.1f, 1500.f);
|
perspectiveMatrix = Core::createPerspectiveMatrix(0.1f, 1000.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);
|
||||||
@ -185,11 +185,14 @@ void renderScene()
|
|||||||
Skybox::drawSkybox(programSkybox, cameraMatrix, perspectiveMatrix, cubemapTexture);
|
Skybox::drawSkybox(programSkybox, cameraMatrix, perspectiveMatrix, cubemapTexture);
|
||||||
|
|
||||||
//SHIP
|
//SHIP
|
||||||
glm::mat4 shipModelMatrix = glm::translate(cameraPos + cameraDir * 0.6f + glm::vec3(0, -0.25f, 0)) * glm::rotate(-cameraAngle + glm::radians(90.0f), glm::vec3(0, 1, 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));
|
||||||
drawObjectTexture(&shipContext, shipModelMatrix, textureShip);
|
drawObjectColor(&shipContext, shipModelMatrix, glm::vec3(0.5));
|
||||||
|
|
||||||
//SUN
|
//SUN
|
||||||
//drawObjectTexture(&sphereContext, glm::translate(glm::vec3(0, 0, -800)) * glm::scale(glm::vec3(10.f)), textureSun);
|
//drawObjectTexture(&sphereModel, glm::translate(glm::vec3(0, 0, 0)) * glm::scale(glm::vec3(20.f)), textureSun);
|
||||||
|
|
||||||
|
//STATION
|
||||||
|
drawObjectColor(&stationContext, glm::rotate(time / 2.0f, glm::vec3(0, 1, 0)) * glm::translate(glm::vec3(0, 0, 200)) * glm::scale(glm::vec3(5)), glm::vec3(0.5));
|
||||||
|
|
||||||
//EARTH nieruchoma - ³atwiejsze dla naszej cutscenki
|
//EARTH nieruchoma - ³atwiejsze dla naszej cutscenki
|
||||||
drawObjectTexture(&sphereContext, glm::scale(glm::vec3(45)), textureEarthHighres);
|
drawObjectTexture(&sphereContext, glm::scale(glm::vec3(45)), textureEarthHighres);
|
||||||
@ -217,18 +220,15 @@ 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/ship.obj");
|
shipModel = obj::loadModelFromFile("models/box.obj");
|
||||||
shipContext.initFromOBJ(shipModel);
|
shipContext.initFromOBJ(shipModel);
|
||||||
|
|
||||||
|
stationModel = obj::loadModelFromFile("models/box.obj");
|
||||||
|
stationContext.initFromOBJ(stationModel);
|
||||||
|
|
||||||
sphereModel = obj::loadModelFromFile("models/sphere.obj");
|
sphereModel = obj::loadModelFromFile("models/sphere.obj");
|
||||||
sphereContext.initFromOBJ(sphereModel);
|
sphereContext.initFromOBJ(sphereModel);
|
||||||
|
|
||||||
boxModel = obj::loadModelFromFile("models/box.obj");
|
|
||||||
boxContext.initFromOBJ(boxModel);
|
|
||||||
programSkybox = shaderLoader.CreateProgram("shaders/shader_skybox.vert", "shaders/shader_skybox.frag");
|
|
||||||
|
|
||||||
cubemapTexture = Skybox::loadCubemap(faces);
|
|
||||||
|
|
||||||
textureShip = Core::LoadTexture("textures/spaceship.png");
|
textureShip = Core::LoadTexture("textures/spaceship.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");
|
||||||
|
@ -319,9 +319,9 @@ void renderScene()
|
|||||||
boxBodies[1]->setLinearVelocity(PxVec3(0, time * 0.8, 0));
|
boxBodies[1]->setLinearVelocity(PxVec3(0, time * 0.8, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (time > 7 && !applied2) {
|
if (time > 7) {
|
||||||
applied2 = true;
|
applied2 = true;
|
||||||
boxBodies[1]->setLinearVelocity(PxVec3(0, 25, 0));
|
boxBodies[1]->setLinearVelocity(PxVec3(0, 15, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user