dodane planety układu słonecznego z mapowaniem normalnych
@ -2,8 +2,10 @@
|
|||||||
main.cpp
|
main.cpp
|
||||||
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\shared\minwindef.h(130,1): warning C4005: "APIENTRY": ponowna definicja makra
|
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\shared\minwindef.h(130,1): warning C4005: "APIENTRY": ponowna definicja makra
|
||||||
D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123,1): message : zobacz poprzednią definicję „APIENTRY”
|
D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123,1): message : zobacz poprzednią definicję „APIENTRY”
|
||||||
D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\ex_7_1.hpp(78,10): warning C4305: "inicjowanie": obcięcie z "double" do "float"
|
D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\ex_7_1.hpp(91,10): warning C4305: "inicjowanie": obcięcie z "double" do "float"
|
||||||
D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\ex_7_1.hpp(154,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
|
D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\ex_7_1.hpp(166,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
|
||||||
|
D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\ex_7_1.hpp(184,29): warning C4305: "inicjowanie": obcięcie z "double" do "float"
|
||||||
|
D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\ex_7_1.hpp(187,29): warning C4305: "inicjowanie": obcięcie z "double" do "float"
|
||||||
Box.obj : warning LNK4075: zignorowano opcję „/EDITANDCONTINUE” z powodu określenia opcji „/INCREMENTAL:NO”
|
Box.obj : warning LNK4075: zignorowano opcję „/EDITANDCONTINUE” z powodu określenia opcji „/INCREMENTAL:NO”
|
||||||
LINK : warning LNK4098: domyślna biblioteka „MSVCRT” powoduje konflikt z innymi bibliotekami; użyj opcji /NODEFAULTLIB:biblioteka
|
LINK : warning LNK4098: domyślna biblioteka „MSVCRT” powoduje konflikt z innymi bibliotekami; użyj opcji /NODEFAULTLIB:biblioteka
|
||||||
grk-cw7.vcxproj -> D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\Debug\projekt_grk.exe
|
grk-cw7.vcxproj -> D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\Debug\projekt_grk.exe
|
||||||
|
@ -41,5 +41,4 @@ void main()
|
|||||||
gl_Position = transformation * vec4(vertexPosition, 1.0);
|
gl_Position = transformation * vec4(vertexPosition, 1.0);
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
}
|
}
|
||||||
|
@ -18,17 +18,30 @@
|
|||||||
|
|
||||||
|
|
||||||
namespace texture {
|
namespace texture {
|
||||||
|
GLuint mercury;
|
||||||
|
GLuint venus;
|
||||||
GLuint earth;
|
GLuint earth;
|
||||||
GLuint moon;
|
GLuint moon;
|
||||||
GLuint ship;
|
GLuint ship;
|
||||||
GLuint sun;
|
GLuint sun;
|
||||||
GLuint mars;
|
GLuint mars;
|
||||||
|
GLuint jupiter;
|
||||||
|
GLuint saturn;
|
||||||
|
GLuint uranus;
|
||||||
|
GLuint neptune;
|
||||||
|
|
||||||
GLuint grid;
|
GLuint mercuryNormal;
|
||||||
|
GLuint venusNormal;
|
||||||
GLuint earthNormal;
|
GLuint earthNormal;
|
||||||
GLuint asteroidNormal;
|
GLuint asteroidNormal;
|
||||||
GLuint shipNormal;
|
GLuint shipNormal;
|
||||||
|
GLuint marsNormal;
|
||||||
|
GLuint jupiterNormal;
|
||||||
|
GLuint saturnNormal;
|
||||||
|
GLuint uranusNormal;
|
||||||
|
GLuint neptuneNormal;
|
||||||
|
|
||||||
|
GLuint grid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -136,8 +149,10 @@ void drawObjectSkyBox(Core::RenderContext& context, glm::mat4 modelMatrix) {
|
|||||||
glUseProgram(programSkyBox);
|
glUseProgram(programSkyBox);
|
||||||
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
|
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
|
||||||
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
|
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
|
||||||
glUniformMatrix4fv(glGetUniformLocation(programSkyBox, "transformation"), 1, GL_FALSE, (float*)&transformation);
|
GLint transformLoc = glGetUniformLocation(programSkyBox, "transformation");
|
||||||
glUniformMatrix4fv(glGetUniformLocation(programSkyBox, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix);
|
glUniformMatrix4fv(transformLoc, 1, GL_FALSE, glm::value_ptr(transformation));
|
||||||
|
GLint modelLoc = glGetUniformLocation(programSkyBox, "modelMatrix");
|
||||||
|
glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(modelMatrix));
|
||||||
glUniform3f(glGetUniformLocation(programSkyBox, "lightPos"), 0, 0, 0);
|
glUniform3f(glGetUniformLocation(programSkyBox, "lightPos"), 0, 0, 0);
|
||||||
glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);
|
glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);
|
||||||
Core::DrawContext(context);
|
Core::DrawContext(context);
|
||||||
@ -146,23 +161,114 @@ void drawObjectSkyBox(Core::RenderContext& context, glm::mat4 modelMatrix) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void renderPlanets() {
|
||||||
|
float time = glfwGetTime();
|
||||||
|
|
||||||
|
float mercuryOrbitRadius = 1.0f;
|
||||||
|
float venusOrbitRadius = 2.0f;
|
||||||
|
float earthOrbitRadius = 5.0f;
|
||||||
|
float moonOrbitRadius = 0.8f;
|
||||||
|
float marsOrbitRadius = 8.0f;
|
||||||
|
float jupiterOrbitRadius = 10.0f;
|
||||||
|
float saturnOrbitRadius = 11.0f;
|
||||||
|
float uranusOrbitRadius = 12.5f;
|
||||||
|
float neptuneOrbitRadius = 13.0f;
|
||||||
|
|
||||||
|
// im mniejsze tym szybciej
|
||||||
|
float mercuryRotationSpeed = 1.0f / 10;
|
||||||
|
float venusRotationSpeed = 1.0f / 7;
|
||||||
|
float earthRotationSpeed = 1.0f / 5;
|
||||||
|
float moonRotationSpeed = 1.0f / 0.5;
|
||||||
|
float marsRotationSpeed = 1.0f / 4;
|
||||||
|
float jupiterRotationSpeed = 1.0f / 6.5;
|
||||||
|
float saturnRotationSpeed = 1.0f / 4;
|
||||||
|
float uranusRotationSpeed = 1.0f / 8;
|
||||||
|
float neptuneRotationSpeed = 1.0f / 8.5;
|
||||||
|
|
||||||
|
float mercuryScale = 0.11f;
|
||||||
|
float venusScale = 0.14f;
|
||||||
|
float earthScale = 0.3f;
|
||||||
|
float moonScale = 0.09f;
|
||||||
|
float marsScale = 0.2f;
|
||||||
|
float jupiterScale = 0.7f;
|
||||||
|
float saturnScale = 0.5f;
|
||||||
|
float uranusScale = 0.3f;
|
||||||
|
float neptuneScale = 0.32f;
|
||||||
|
|
||||||
|
|
||||||
|
//mercury
|
||||||
|
drawObjectTexture(sphereContext,
|
||||||
|
glm::eulerAngleY(time * mercuryRotationSpeed) * glm::translate(glm::vec3(mercuryOrbitRadius, 0, 0)) * glm::scale(glm::vec3(mercuryScale)),
|
||||||
|
texture::mercury,
|
||||||
|
texture::mercuryNormal);
|
||||||
|
|
||||||
|
//venus
|
||||||
|
drawObjectTexture(sphereContext,
|
||||||
|
glm::eulerAngleY(time * venusRotationSpeed) * glm::translate(glm::vec3(venusOrbitRadius, 0, 0)) * glm::scale(glm::vec3(venusScale)),
|
||||||
|
texture::venus,
|
||||||
|
texture::venusNormal);
|
||||||
|
|
||||||
|
//earth
|
||||||
|
drawObjectTexture(sphereContext,
|
||||||
|
glm::eulerAngleY(time * earthRotationSpeed) * glm::translate(glm::vec3(earthOrbitRadius, 0, 0)) * glm::scale(glm::vec3(earthScale)),
|
||||||
|
texture::earth,
|
||||||
|
texture::earthNormal);
|
||||||
|
|
||||||
|
//earths moon
|
||||||
|
drawObjectTexture(sphereContext,
|
||||||
|
glm::eulerAngleY(time * earthRotationSpeed) * glm::translate(glm::vec3(earthOrbitRadius, 0, 0)) * glm::eulerAngleY(time * moonRotationSpeed) * glm::translate(glm::vec3(moonOrbitRadius, 0, 0)) * glm::scale(glm::vec3(moonScale)),
|
||||||
|
texture::moon,
|
||||||
|
texture::asteroidNormal);
|
||||||
|
|
||||||
|
//mars
|
||||||
|
drawObjectTexture(sphereContext,
|
||||||
|
glm::eulerAngleY(time * marsRotationSpeed) * glm::translate(glm::vec3(marsOrbitRadius, 0, 0)) * glm::scale(glm::vec3(marsScale)),
|
||||||
|
texture::mars,
|
||||||
|
texture::marsNormal);
|
||||||
|
|
||||||
|
//jupiter
|
||||||
|
drawObjectTexture(sphereContext,
|
||||||
|
glm::eulerAngleY(time * jupiterRotationSpeed) * glm::translate(glm::vec3(jupiterOrbitRadius, 0, 0)) * glm::scale(glm::vec3(jupiterScale)),
|
||||||
|
texture::jupiter,
|
||||||
|
texture::jupiterNormal);
|
||||||
|
|
||||||
|
//saturn
|
||||||
|
drawObjectTexture(sphereContext,
|
||||||
|
glm::eulerAngleY(time * saturnRotationSpeed) * glm::translate(glm::vec3(saturnOrbitRadius, 0, 0)) * glm::scale(glm::vec3(saturnScale)),
|
||||||
|
texture::saturn,
|
||||||
|
texture::saturnNormal);
|
||||||
|
|
||||||
|
//uranus
|
||||||
|
drawObjectTexture(sphereContext,
|
||||||
|
glm::eulerAngleY(time * uranusRotationSpeed) * glm::translate(glm::vec3(uranusOrbitRadius, 0, 0)) * glm::scale(glm::vec3(uranusScale)),
|
||||||
|
texture::uranus,
|
||||||
|
texture::uranusNormal);
|
||||||
|
|
||||||
|
//neptune
|
||||||
|
drawObjectTexture(sphereContext,
|
||||||
|
glm::eulerAngleY(time * neptuneRotationSpeed) * glm::translate(glm::vec3(neptuneOrbitRadius, 0, 0)) * glm::scale(glm::vec3(neptuneScale)),
|
||||||
|
texture::neptune,
|
||||||
|
texture::neptuneNormal);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void renderScene(GLFWwindow* window)
|
void renderScene(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
glClearColor(0.0f, 0.3f, 0.3f, 1.0f);
|
glClearColor(0.0f, 0.3f, 0.3f, 1.0f);
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
glm::mat4 transformation;
|
|
||||||
float time = glfwGetTime();
|
|
||||||
|
|
||||||
|
|
||||||
|
//skybox
|
||||||
drawObjectSkyBox(cubeContext, glm::translate(cameraPos));
|
drawObjectSkyBox(cubeContext, glm::translate(cameraPos));
|
||||||
|
|
||||||
|
//sun
|
||||||
drawSun(sphereContext, glm::mat4(), texture::sun);
|
drawSun(sphereContext, glm::mat4(), texture::sun);
|
||||||
|
|
||||||
|
//rendering all the planets
|
||||||
|
renderPlanets();
|
||||||
|
|
||||||
drawObjectTexture(sphereContext, glm::mat4(), texture::ship, texture::asteroidNormal);
|
|
||||||
|
|
||||||
drawObjectTexture(sphereContext, glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::scale(glm::vec3(0.3f)), texture::earth, texture::earthNormal);
|
|
||||||
|
|
||||||
drawObjectTexture(sphereContext, 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)), texture::moon, texture::asteroidNormal);
|
|
||||||
|
|
||||||
glm::vec3 spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f)));
|
glm::vec3 spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f)));
|
||||||
glm::vec3 spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceshipDir));
|
glm::vec3 spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceshipDir));
|
||||||
@ -173,7 +279,7 @@ void renderScene(GLFWwindow* window)
|
|||||||
0.,0.,0.,1.,
|
0.,0.,0.,1.,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//spaceship drawing
|
||||||
drawObjectTexture(shipContext,
|
drawObjectTexture(shipContext,
|
||||||
glm::translate(spaceshipPos) * specshipCameraRotrationMatrix * glm::eulerAngleY(glm::pi<float>()),
|
glm::translate(spaceshipPos) * specshipCameraRotrationMatrix * glm::eulerAngleY(glm::pi<float>()),
|
||||||
texture::ship, texture::shipNormal
|
texture::ship, texture::shipNormal
|
||||||
@ -217,16 +323,28 @@ void init(GLFWwindow* window)
|
|||||||
loadModelToContext("./models/spaceship.obj", shipContext);
|
loadModelToContext("./models/spaceship.obj", shipContext);
|
||||||
loadModelToContext("./models/cube.obj", cubeContext);
|
loadModelToContext("./models/cube.obj", cubeContext);
|
||||||
|
|
||||||
|
texture::mercury = Core::LoadTexture("textures/mercury/mercury.jpg");
|
||||||
|
texture::venus = Core::LoadTexture("textures/venus/venus.jpg");
|
||||||
|
texture::earth = Core::LoadTexture("textures/earth/earth.png");
|
||||||
|
texture::ship = Core::LoadTexture("textures/spaceship/spaceship.jpg");
|
||||||
|
texture::moon = Core::LoadTexture("textures/earths_moon/moon.jpg");
|
||||||
|
texture::sun = Core::LoadTexture("textures/sun/sun.jpg");
|
||||||
|
texture::mars = Core::LoadTexture("textures/mars/mars.jpg");
|
||||||
|
texture::jupiter = Core::LoadTexture("textures/jupiter/jupiter.jpg");
|
||||||
|
texture::saturn = Core::LoadTexture("textures/saturn/saturn.jpg");
|
||||||
|
texture::uranus = Core::LoadTexture("textures/uranus/uranus.jpg");
|
||||||
|
texture::neptune = Core::LoadTexture("textures/neptune/neptune.jpg");
|
||||||
|
|
||||||
texture::earth = Core::LoadTexture("textures/earth2.png");
|
texture::mercuryNormal = Core::LoadTexture("textures/mercury/mercury_normal.png");
|
||||||
texture::ship = Core::LoadTexture("textures/spaceship.jpg");
|
texture::venusNormal = Core::LoadTexture("textures/venus/venus_normal.png");
|
||||||
texture::moon = Core::LoadTexture("textures/moon.jpg");
|
texture::earthNormal = Core::LoadTexture("textures/earth/earth_normal.png");
|
||||||
texture::sun = Core::LoadTexture("textures/sun.jpg");
|
texture::shipNormal = Core::LoadTexture("textures/spaceship/spaceship_normal.jpg");
|
||||||
texture::mars = Core::LoadTexture("textures/mars.jpg");
|
texture::asteroidNormal = Core::LoadTexture("textures/earths_moon/moon_normal.jpg");
|
||||||
|
texture::marsNormal = Core::LoadTexture("textures/mars/mars_normal.jpg");
|
||||||
texture::earthNormal = Core::LoadTexture("textures/earth2_normals.png");
|
texture::jupiterNormal = Core::LoadTexture("textures/jupiter/jupiter_normal.png");
|
||||||
texture::shipNormal = Core::LoadTexture("textures/spaceship_normal.jpg");
|
texture::saturnNormal = Core::LoadTexture("textures/saturn/saturn_normal.png");
|
||||||
texture::asteroidNormal = Core::LoadTexture("textures/moon_normal.jpg");
|
texture::uranusNormal = Core::LoadTexture("textures/uranus/uranus_normal.png");
|
||||||
|
texture::neptuneNormal = Core::LoadTexture("textures/neptune/neptune_normal.png");
|
||||||
|
|
||||||
|
|
||||||
//tutaj skybox start
|
//tutaj skybox start
|
||||||
@ -312,4 +430,3 @@ void renderLoop(GLFWwindow* window) {
|
|||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//}
|
|
Before Width: | Height: | Size: 148 KiB |
Before Width: | Height: | Size: 4.4 MiB After Width: | Height: | Size: 4.4 MiB |
Before Width: | Height: | Size: 3.0 MiB After Width: | Height: | Size: 3.0 MiB |
Before Width: | Height: | Size: 163 KiB |
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 374 KiB After Width: | Height: | Size: 374 KiB |
BIN
projekt_grk/textures/jupiter/jupiter.jpg
Normal file
After Width: | Height: | Size: 487 KiB |
BIN
projekt_grk/textures/jupiter/jupiter_normal.png
Normal file
After Width: | Height: | Size: 3.9 MiB |
Before Width: | Height: | Size: 733 KiB |
BIN
projekt_grk/textures/mars/mars.jpg
Normal file
After Width: | Height: | Size: 227 KiB |
BIN
projekt_grk/textures/mars/mars_normal.jpg
Normal file
After Width: | Height: | Size: 45 KiB |
BIN
projekt_grk/textures/mercury/mercury.jpg
Normal file
After Width: | Height: | Size: 852 KiB |
BIN
projekt_grk/textures/mercury/mercury_normal.png
Normal file
After Width: | Height: | Size: 5.0 MiB |
BIN
projekt_grk/textures/neptune/neptune.jpg
Normal file
After Width: | Height: | Size: 236 KiB |
BIN
projekt_grk/textures/neptune/neptune_normal.png
Normal file
After Width: | Height: | Size: 1.6 MiB |
BIN
projekt_grk/textures/saturn/saturn.jpg
Normal file
After Width: | Height: | Size: 195 KiB |
BIN
projekt_grk/textures/saturn/saturn_normal.png
Normal file
After Width: | Height: | Size: 1.8 MiB |
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
Before Width: | Height: | Size: 3.3 MiB After Width: | Height: | Size: 3.3 MiB |
Before Width: | Height: | Size: 803 KiB After Width: | Height: | Size: 803 KiB |
BIN
projekt_grk/textures/sun/sun_normal.jpg
Normal file
After Width: | Height: | Size: 275 KiB |
BIN
projekt_grk/textures/uranus/uranus.jpg
Normal file
After Width: | Height: | Size: 76 KiB |
BIN
projekt_grk/textures/uranus/uranus_normal.png
Normal file
After Width: | Height: | Size: 128 KiB |
BIN
projekt_grk/textures/venus/venus.jpg
Normal file
After Width: | Height: | Size: 864 KiB |
BIN
projekt_grk/textures/venus/venus_normal.png
Normal file
After Width: | Height: | Size: 4.3 MiB |