diff --git a/.vs/grk-cw/FileContentIndex/6a4ff066-4293-4640-ae6d-f631428a46d1.vsidx b/.vs/grk-cw/FileContentIndex/6a4ff066-4293-4640-ae6d-f631428a46d1.vsidx deleted file mode 100644 index f5bf411..0000000 Binary files a/.vs/grk-cw/FileContentIndex/6a4ff066-4293-4640-ae6d-f631428a46d1.vsidx and /dev/null differ diff --git a/.vs/grk-cw/FileContentIndex/6c735bb9-7fc6-4e2a-adaf-0d3842fb8152.vsidx b/.vs/grk-cw/FileContentIndex/6c735bb9-7fc6-4e2a-adaf-0d3842fb8152.vsidx new file mode 100644 index 0000000..8de057c Binary files /dev/null and b/.vs/grk-cw/FileContentIndex/6c735bb9-7fc6-4e2a-adaf-0d3842fb8152.vsidx differ diff --git a/.vs/grk-cw/FileContentIndex/4669a94d-e85f-4cda-b95c-f552b66b1dd4.vsidx b/.vs/grk-cw/FileContentIndex/d3226d83-419b-4771-a864-0f35c833afe4.vsidx similarity index 67% rename from .vs/grk-cw/FileContentIndex/4669a94d-e85f-4cda-b95c-f552b66b1dd4.vsidx rename to .vs/grk-cw/FileContentIndex/d3226d83-419b-4771-a864-0f35c833afe4.vsidx index 993418a..b429017 100644 Binary files a/.vs/grk-cw/FileContentIndex/4669a94d-e85f-4cda-b95c-f552b66b1dd4.vsidx and b/.vs/grk-cw/FileContentIndex/d3226d83-419b-4771-a864-0f35c833afe4.vsidx differ diff --git a/.vs/grk-cw/v17/.suo b/.vs/grk-cw/v17/.suo index 70b28e2..7e56a92 100644 Binary files a/.vs/grk-cw/v17/.suo and b/.vs/grk-cw/v17/.suo differ diff --git a/.vs/grk-cw/v17/Browse.VC.db b/.vs/grk-cw/v17/Browse.VC.db index cf243a9..43b1694 100644 Binary files a/.vs/grk-cw/v17/Browse.VC.db and b/.vs/grk-cw/v17/Browse.VC.db differ diff --git a/.vs/grk-cw/v17/ipch/AutoPCH/3af4a585019c4035/MAIN.ipch b/.vs/grk-cw/v17/ipch/AutoPCH/3af4a585019c4035/MAIN.ipch index 3cad65e..374a5c1 100644 Binary files a/.vs/grk-cw/v17/ipch/AutoPCH/3af4a585019c4035/MAIN.ipch and b/.vs/grk-cw/v17/ipch/AutoPCH/3af4a585019c4035/MAIN.ipch differ diff --git a/Debug/projekt_grk.exe b/Debug/projekt_grk.exe index d41c48b..5ceffa5 100644 Binary files a/Debug/projekt_grk.exe and b/Debug/projekt_grk.exe differ diff --git a/Debug/projekt_grk.pdb b/Debug/projekt_grk.pdb index 2d61a7b..21c4ea3 100644 Binary files a/Debug/projekt_grk.pdb and b/Debug/projekt_grk.pdb differ diff --git a/projekt_grk/Debug/grk-cw7.log b/projekt_grk/Debug/grk-cw7.log index 43dfb42..6963b03 100644 --- a/projekt_grk/Debug/grk-cw7.log +++ b/projekt_grk/Debug/grk-cw7.log @@ -2,8 +2,10 @@ 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 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(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(91,10): warning C4305: "inicjowanie": obcięcie z "double" do "float" +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” 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 diff --git a/projekt_grk/Debug/main.obj b/projekt_grk/Debug/main.obj index ccca9b4..b37a8d1 100644 Binary files a/projekt_grk/Debug/main.obj and b/projekt_grk/Debug/main.obj differ diff --git a/projekt_grk/Debug/vc143.idb b/projekt_grk/Debug/vc143.idb index da8b222..518d019 100644 Binary files a/projekt_grk/Debug/vc143.idb and b/projekt_grk/Debug/vc143.idb differ diff --git a/projekt_grk/Debug/vc143.pdb b/projekt_grk/Debug/vc143.pdb index e87b151..e78bedf 100644 Binary files a/projekt_grk/Debug/vc143.pdb and b/projekt_grk/Debug/vc143.pdb differ diff --git a/projekt_grk/shaders/shader_5_1_tex_copy.vert b/projekt_grk/shaders/shader_5_1_tex_copy.vert index dac1d5f..ed43c4a 100644 --- a/projekt_grk/shaders/shader_5_1_tex_copy.vert +++ b/projekt_grk/shaders/shader_5_1_tex_copy.vert @@ -41,5 +41,4 @@ void main() gl_Position = transformation * vec4(vertexPosition, 1.0); - // } diff --git a/projekt_grk/src/ex_7_1.hpp b/projekt_grk/src/ex_7_1.hpp index 190f512..0f36693 100644 --- a/projekt_grk/src/ex_7_1.hpp +++ b/projekt_grk/src/ex_7_1.hpp @@ -18,17 +18,30 @@ namespace texture { + GLuint mercury; + GLuint venus; GLuint earth; GLuint moon; GLuint ship; GLuint sun; GLuint mars; + GLuint jupiter; + GLuint saturn; + GLuint uranus; + GLuint neptune; - GLuint grid; - + GLuint mercuryNormal; + GLuint venusNormal; GLuint earthNormal; GLuint asteroidNormal; 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); glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix(); glm::mat4 transformation = viewProjectionMatrix * modelMatrix; - glUniformMatrix4fv(glGetUniformLocation(programSkyBox, "transformation"), 1, GL_FALSE, (float*)&transformation); - glUniformMatrix4fv(glGetUniformLocation(programSkyBox, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix); + GLint transformLoc = glGetUniformLocation(programSkyBox, "transformation"); + 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); glBindTexture(GL_TEXTURE_CUBE_MAP, textureID); 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) { glClearColor(0.0f, 0.3f, 0.3f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glm::mat4 transformation; - float time = glfwGetTime(); + + //skybox drawObjectSkyBox(cubeContext, glm::translate(cameraPos)); + //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 spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceshipDir)); @@ -173,7 +279,7 @@ void renderScene(GLFWwindow* window) 0.,0.,0.,1., }); - + //spaceship drawing drawObjectTexture(shipContext, glm::translate(spaceshipPos) * specshipCameraRotrationMatrix * glm::eulerAngleY(glm::pi()), texture::ship, texture::shipNormal @@ -217,16 +323,28 @@ void init(GLFWwindow* window) loadModelToContext("./models/spaceship.obj", shipContext); 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::ship = Core::LoadTexture("textures/spaceship.jpg"); - texture::moon = Core::LoadTexture("textures/moon.jpg"); - texture::sun = Core::LoadTexture("textures/sun.jpg"); - texture::mars = Core::LoadTexture("textures/mars.jpg"); - - texture::earthNormal = Core::LoadTexture("textures/earth2_normals.png"); - texture::shipNormal = Core::LoadTexture("textures/spaceship_normal.jpg"); - texture::asteroidNormal = Core::LoadTexture("textures/moon_normal.jpg"); + texture::mercuryNormal = Core::LoadTexture("textures/mercury/mercury_normal.png"); + texture::venusNormal = Core::LoadTexture("textures/venus/venus_normal.png"); + texture::earthNormal = Core::LoadTexture("textures/earth/earth_normal.png"); + texture::shipNormal = Core::LoadTexture("textures/spaceship/spaceship_normal.jpg"); + texture::asteroidNormal = Core::LoadTexture("textures/earths_moon/moon_normal.jpg"); + texture::marsNormal = Core::LoadTexture("textures/mars/mars_normal.jpg"); + texture::jupiterNormal = Core::LoadTexture("textures/jupiter/jupiter_normal.png"); + texture::saturnNormal = Core::LoadTexture("textures/saturn/saturn_normal.png"); + texture::uranusNormal = Core::LoadTexture("textures/uranus/uranus_normal.png"); + texture::neptuneNormal = Core::LoadTexture("textures/neptune/neptune_normal.png"); //tutaj skybox start @@ -312,4 +430,3 @@ void renderLoop(GLFWwindow* window) { glfwPollEvents(); } } -//} \ No newline at end of file diff --git a/projekt_grk/textures/earth.png b/projekt_grk/textures/earth.png deleted file mode 100644 index 2aed90c..0000000 Binary files a/projekt_grk/textures/earth.png and /dev/null differ diff --git a/projekt_grk/textures/earth2.png b/projekt_grk/textures/earth/earth.png similarity index 100% rename from projekt_grk/textures/earth2.png rename to projekt_grk/textures/earth/earth.png diff --git a/projekt_grk/textures/earth2_normals.png b/projekt_grk/textures/earth/earth_normal.png similarity index 100% rename from projekt_grk/textures/earth2_normals.png rename to projekt_grk/textures/earth/earth_normal.png diff --git a/projekt_grk/textures/earth_normalmap.png b/projekt_grk/textures/earth_normalmap.png deleted file mode 100644 index 6437240..0000000 Binary files a/projekt_grk/textures/earth_normalmap.png and /dev/null differ diff --git a/projekt_grk/textures/moon.jpg b/projekt_grk/textures/earths_moon/moon.jpg similarity index 100% rename from projekt_grk/textures/moon.jpg rename to projekt_grk/textures/earths_moon/moon.jpg diff --git a/projekt_grk/textures/moon_normal.jpg b/projekt_grk/textures/earths_moon/moon_normal.jpg similarity index 100% rename from projekt_grk/textures/moon_normal.jpg rename to projekt_grk/textures/earths_moon/moon_normal.jpg diff --git a/projekt_grk/textures/jupiter/jupiter.jpg b/projekt_grk/textures/jupiter/jupiter.jpg new file mode 100644 index 0000000..21f1951 Binary files /dev/null and b/projekt_grk/textures/jupiter/jupiter.jpg differ diff --git a/projekt_grk/textures/jupiter/jupiter_normal.png b/projekt_grk/textures/jupiter/jupiter_normal.png new file mode 100644 index 0000000..94c5848 Binary files /dev/null and b/projekt_grk/textures/jupiter/jupiter_normal.png differ diff --git a/projekt_grk/textures/mars.jpg b/projekt_grk/textures/mars.jpg deleted file mode 100644 index b3654a9..0000000 Binary files a/projekt_grk/textures/mars.jpg and /dev/null differ diff --git a/projekt_grk/textures/mars/mars.jpg b/projekt_grk/textures/mars/mars.jpg new file mode 100644 index 0000000..0b0545c Binary files /dev/null and b/projekt_grk/textures/mars/mars.jpg differ diff --git a/projekt_grk/textures/mars/mars_normal.jpg b/projekt_grk/textures/mars/mars_normal.jpg new file mode 100644 index 0000000..93fcf4e Binary files /dev/null and b/projekt_grk/textures/mars/mars_normal.jpg differ diff --git a/projekt_grk/textures/mercury/mercury.jpg b/projekt_grk/textures/mercury/mercury.jpg new file mode 100644 index 0000000..eebaed9 Binary files /dev/null and b/projekt_grk/textures/mercury/mercury.jpg differ diff --git a/projekt_grk/textures/mercury/mercury_normal.png b/projekt_grk/textures/mercury/mercury_normal.png new file mode 100644 index 0000000..bc5f43d Binary files /dev/null and b/projekt_grk/textures/mercury/mercury_normal.png differ diff --git a/projekt_grk/textures/neptune/neptune.jpg b/projekt_grk/textures/neptune/neptune.jpg new file mode 100644 index 0000000..30e7ac5 Binary files /dev/null and b/projekt_grk/textures/neptune/neptune.jpg differ diff --git a/projekt_grk/textures/neptune/neptune_normal.png b/projekt_grk/textures/neptune/neptune_normal.png new file mode 100644 index 0000000..c753178 Binary files /dev/null and b/projekt_grk/textures/neptune/neptune_normal.png differ diff --git a/projekt_grk/textures/saturn/saturn.jpg b/projekt_grk/textures/saturn/saturn.jpg new file mode 100644 index 0000000..d8b23df Binary files /dev/null and b/projekt_grk/textures/saturn/saturn.jpg differ diff --git a/projekt_grk/textures/saturn/saturn_normal.png b/projekt_grk/textures/saturn/saturn_normal.png new file mode 100644 index 0000000..7dfcd3b Binary files /dev/null and b/projekt_grk/textures/saturn/saturn_normal.png differ diff --git a/projekt_grk/textures/spaceship.jpg b/projekt_grk/textures/spaceship/spaceship.jpg similarity index 100% rename from projekt_grk/textures/spaceship.jpg rename to projekt_grk/textures/spaceship/spaceship.jpg diff --git a/projekt_grk/textures/spaceship_normal.jpg b/projekt_grk/textures/spaceship/spaceship_normal.jpg similarity index 100% rename from projekt_grk/textures/spaceship_normal.jpg rename to projekt_grk/textures/spaceship/spaceship_normal.jpg diff --git a/projekt_grk/textures/sun.jpg b/projekt_grk/textures/sun/sun.jpg similarity index 100% rename from projekt_grk/textures/sun.jpg rename to projekt_grk/textures/sun/sun.jpg diff --git a/projekt_grk/textures/sun/sun_normal.jpg b/projekt_grk/textures/sun/sun_normal.jpg new file mode 100644 index 0000000..3e0b520 Binary files /dev/null and b/projekt_grk/textures/sun/sun_normal.jpg differ diff --git a/projekt_grk/textures/uranus/uranus.jpg b/projekt_grk/textures/uranus/uranus.jpg new file mode 100644 index 0000000..d0abf4c Binary files /dev/null and b/projekt_grk/textures/uranus/uranus.jpg differ diff --git a/projekt_grk/textures/uranus/uranus_normal.png b/projekt_grk/textures/uranus/uranus_normal.png new file mode 100644 index 0000000..b759a4c Binary files /dev/null and b/projekt_grk/textures/uranus/uranus_normal.png differ diff --git a/projekt_grk/textures/venus/venus.jpg b/projekt_grk/textures/venus/venus.jpg new file mode 100644 index 0000000..a26a410 Binary files /dev/null and b/projekt_grk/textures/venus/venus.jpg differ diff --git a/projekt_grk/textures/venus/venus_normal.png b/projekt_grk/textures/venus/venus_normal.png new file mode 100644 index 0000000..d701dc1 Binary files /dev/null and b/projekt_grk/textures/venus/venus_normal.png differ