merge develop into master
This commit is contained in:
commit
7b2fb51136
@ -21,6 +21,10 @@ public:
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glm::vec3 color = glm::vec3(0.3, 0.3, 0.5);
|
||||||
|
float roughness = 0.2;
|
||||||
|
float metallic = 1.0;
|
||||||
|
|
||||||
glm::vec3 spaceshipPos = glm::vec3(0.065808f, 1.250000f, -2.189549f);
|
glm::vec3 spaceshipPos = glm::vec3(0.065808f, 1.250000f, -2.189549f);
|
||||||
glm::vec3 spaceshipDir = glm::vec3(-0.490263f, 0.000000f, 0.871578f);
|
glm::vec3 spaceshipDir = glm::vec3(-0.490263f, 0.000000f, 0.871578f);
|
||||||
|
|
||||||
|
@ -41,8 +41,6 @@ GLuint programTex;
|
|||||||
|
|
||||||
Core::Shader_Loader shaderLoader;
|
Core::Shader_Loader shaderLoader;
|
||||||
|
|
||||||
Core::RenderContext shipContext;
|
|
||||||
Core::RenderContext sphereContext;
|
|
||||||
|
|
||||||
std::list<Planet*> planets;
|
std::list<Planet*> planets;
|
||||||
Sun* sun;
|
Sun* sun;
|
||||||
@ -56,6 +54,8 @@ glm::vec3 pointlightColor = glm::vec3(0.9, 0.6, 0.6);
|
|||||||
float lastTime = -1.f;
|
float lastTime = -1.f;
|
||||||
float deltaTime = 0.f;
|
float deltaTime = 0.f;
|
||||||
|
|
||||||
|
Spaceship& spaceship = Spaceship::getInstance();
|
||||||
|
|
||||||
void updateDeltaTime(float time) {
|
void updateDeltaTime(float time) {
|
||||||
if (lastTime < 0) {
|
if (lastTime < 0) {
|
||||||
lastTime = time;
|
lastTime = time;
|
||||||
@ -100,16 +100,16 @@ void renderScene(GLFWwindow* window)
|
|||||||
|
|
||||||
//drawObjectPBR(sphereContext, glm::translate(pointlightPos) * glm::scale(glm::vec3(1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(10.f, 0, 0)) * glm::scale(glm::vec3(0.3f)), glm::vec3(0.2, 0.7, 0.3), 0.3, 0.0, program);
|
//drawObjectPBR(sphereContext, glm::translate(pointlightPos) * glm::scale(glm::vec3(1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(10.f, 0, 0)) * glm::scale(glm::vec3(0.3f)), glm::vec3(0.2, 0.7, 0.3), 0.3, 0.0, program);
|
||||||
|
|
||||||
drawObjectPBR(sphereContext,
|
drawObjectPBR(models::sphereContext,
|
||||||
glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::eulerAngleY(time) * glm::translate(glm::vec3(1.f, 0, 0)) * glm::scale(glm::vec3(0.1f)),
|
glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::eulerAngleY(time) * glm::translate(glm::vec3(1.f, 0, 0)) * glm::scale(glm::vec3(0.1f)),
|
||||||
glm::vec3(0.5, 0.5, 0.5), 0.7, 0.0, program);
|
glm::vec3(0.5, 0.5, 0.5), 0.7, 0.0, program);
|
||||||
|
|
||||||
drawObjectPBR(models::marbleBustContext, glm::mat4(), glm::vec3(1.f, 1.f, 1.f), 0.5f, 1.0f, program);
|
drawObjectPBR(models::marbleBustContext, glm::mat4(), glm::vec3(1.f, 1.f, 1.f), 0.5f, 1.0f, program);
|
||||||
|
|
||||||
drawObjectPBR(shipContext,
|
drawObjectPBR(models::spaceshipContext,
|
||||||
Spaceship::getInstance().calculateModelMatrix(),
|
spaceship.calculateModelMatrix(),
|
||||||
glm::vec3(0.3, 0.3, 0.5),
|
spaceship.color,
|
||||||
0.2,1.0, program
|
spaceship.roughness, spaceship.metallic, program
|
||||||
);
|
);
|
||||||
|
|
||||||
glUseProgram(0);
|
glUseProgram(0);
|
||||||
@ -138,12 +138,12 @@ void loadModelToContext(std::string path, Core::RenderContext& context)
|
|||||||
void createSuns() {
|
void createSuns() {
|
||||||
GameUtils* gu = GameUtils::getInstance();
|
GameUtils* gu = GameUtils::getInstance();
|
||||||
sun = new Sun(programSun, models::sphereContext, glm::vec3(0, 2, 0), glm::vec3(-0.93633f, 0.351106, 0.003226f), glm::vec3(0.9f, 0.9f, 0.7f) * 5, 1);
|
sun = new Sun(programSun, models::sphereContext, glm::vec3(0, 2, 0), glm::vec3(-0.93633f, 0.351106, 0.003226f), glm::vec3(0.9f, 0.9f, 0.7f) * 5, 1);
|
||||||
Planet* planet = new Planet(sun, 20.f, 0.25f, 1.f, sphereContext);
|
Planet* planet = new Planet(sun, 20.f, 0.25f, 1.f, models::sphereContext);
|
||||||
planets.push_back(planet);
|
planets.push_back(planet);
|
||||||
Planet* moon = new Planet(planet, 5.f, 1.f, 0.2f, sphereContext);
|
Planet* moon = new Planet(planet, 5.f, 1.f, 0.2f, models::sphereContext);
|
||||||
planets.push_back(moon);
|
planets.push_back(moon);
|
||||||
gu->getSuns()->push_back(sun);
|
gu->getSuns()->push_back(sun);
|
||||||
Planet* planet2 = new Planet(sun, 50.f, 0.5f, 1.5f, sphereContext);
|
Planet* planet2 = new Planet(sun, 50.f, 0.5f, 1.5f, models::sphereContext);
|
||||||
planets.push_back(planet2);
|
planets.push_back(planet2);
|
||||||
/*suns.push_back(&Sun(programSun, models::sphereContext, glm::vec3(-80, 20, 50), glm::vec3(-0.93633f, 0.351106, 0.003226f), glm::vec3(1.0f, 0.8f, 0.2f), 4.0));
|
/*suns.push_back(&Sun(programSun, models::sphereContext, glm::vec3(-80, 20, 50), glm::vec3(-0.93633f, 0.351106, 0.003226f), glm::vec3(1.0f, 0.8f, 0.2f), 4.0));
|
||||||
suns.push_back(&Sun(programSun, models::sphereContext, glm::vec3(50, 40, -30), glm::vec3(-0.73633f, 0.451106, 0.023226f), glm::vec3(0.9f, 0.5f, 0.1f), 3.5));
|
suns.push_back(&Sun(programSun, models::sphereContext, glm::vec3(50, 40, -30), glm::vec3(-0.73633f, 0.451106, 0.023226f), glm::vec3(0.9f, 0.5f, 0.1f), 3.5));
|
||||||
@ -175,13 +175,13 @@ void init(GLFWwindow* window)
|
|||||||
programTest = shaderLoader.CreateProgram("shaders/test.vert", "shaders/test.frag");
|
programTest = shaderLoader.CreateProgram("shaders/test.vert", "shaders/test.frag");
|
||||||
programSun = shaderLoader.CreateProgram("shaders/shader_8_sun.vert", "shaders/shader_8_sun.frag");
|
programSun = shaderLoader.CreateProgram("shaders/shader_8_sun.vert", "shaders/shader_8_sun.frag");
|
||||||
|
|
||||||
loadModelToContext("./models/sphere.obj", sphereContext);
|
//loadModelToContext("./models/sphere.obj", sphereContext);
|
||||||
loadModelToContext("./models/spaceship.obj", shipContext);
|
//loadModelToContext("./models/spaceship.obj", spaceship.context);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
loadModelToContext("./models/marbleBust.obj", models::marbleBustContext);
|
loadModelToContext("./models/marbleBust.obj", models::marbleBustContext);
|
||||||
loadModelToContext("./models/GameUtils::spaceship.obj", models::spaceshipContext);
|
loadModelToContext("./models/spaceship.obj", models::spaceshipContext);
|
||||||
loadModelToContext("./models/sphere.obj", models::sphereContext);
|
loadModelToContext("./models/sphere.obj", models::sphereContext);
|
||||||
|
|
||||||
createSuns();
|
createSuns();
|
||||||
@ -203,8 +203,8 @@ void processInput(GLFWwindow* window)
|
|||||||
exposition += 0.05;*/
|
exposition += 0.05;*/
|
||||||
|
|
||||||
if (glfwGetKey(window, GLFW_KEY_3) == GLFW_PRESS) {
|
if (glfwGetKey(window, GLFW_KEY_3) == GLFW_PRESS) {
|
||||||
printf("GameUtils::spaceshipPos = glm::vec3(%ff, %ff, %ff);\n", Spaceship::getInstance().spaceshipPos.x, Spaceship::getInstance().spaceshipPos.y, Spaceship::getInstance().spaceshipPos.z);
|
printf("GameUtils::spaceshipPos = glm::vec3(%ff, %ff, %ff);\n",spaceship.spaceshipPos.x,spaceship.spaceshipPos.y,spaceship.spaceshipPos.z);
|
||||||
printf("GameUtils::spaceshipDir = glm::vec3(%ff, %ff, %ff);\n", Spaceship::getInstance().spaceshipDir.x, Spaceship::getInstance().spaceshipDir.y, Spaceship::getInstance().spaceshipDir.z);
|
printf("GameUtils::spaceshipDir = glm::vec3(%ff, %ff, %ff);\n",spaceship.spaceshipDir.x,spaceship.spaceshipDir.y,spaceship.spaceshipDir.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
//cameraDir = glm::normalize(-cameraPos);
|
//cameraDir = glm::normalize(-cameraPos);
|
||||||
|
Loading…
Reference in New Issue
Block a user