diff --git a/grk/cw 6/src/Planet.hpp b/grk/cw 6/src/Planet.hpp index e5bbc5b..ef4296e 100644 --- a/grk/cw 6/src/Planet.hpp +++ b/grk/cw 6/src/Planet.hpp @@ -15,14 +15,45 @@ #include -namespace texture { +namespace texturePlanets { GLuint earth; - GLuint clouds; - GLuint moon; + GLuint planet; GLuint mercury; GLuint venus; GLuint mars; - GLuint sun; + GLuint alpine; + GLuint ceres; + GLuint eris; + GLuint haumea; + GLuint icy; + GLuint jupiter; + GLuint makemake; + GLuint martian; + GLuint neptune; + GLuint saturn; + GLuint savannah; + GLuint swamp; + GLuint tropical; + GLuint uranus; + GLuint venusian; + GLuint volcanic; +} + +namespace textureSuns { + GLuint sun1; + GLuint sun2; + GLuint sun3; + GLuint sun4; +} + +namespace textureMoons { + GLuint moon1; + GLuint moon2; + GLuint moon3; +} + +namespace textureMaterials { + GLuint clouds; } GLuint program; @@ -53,8 +84,7 @@ int HDR_HEIGHT = 1024; glm::vec3 lightColor = glm::vec3(50, 50, 50); -glm::mat4 createCameraMatrix() -{ +glm::mat4 createCameraMatrix() { glm::vec3 cameraSide = glm::normalize(glm::cross(cameraDir, glm::vec3(0.f, 1.f, 0.f))); glm::vec3 cameraUp = glm::normalize(glm::cross(cameraSide, cameraDir)); @@ -72,9 +102,7 @@ glm::mat4 createCameraMatrix() return cameraMatrix; } -glm::mat4 createPerspectiveMatrix() -{ - +glm::mat4 createPerspectiveMatrix() { glm::mat4 perspectiveMatrix; float n = 0.05f; float f = 20.f; @@ -89,7 +117,6 @@ glm::mat4 createPerspectiveMatrix() 0.,0.,-1.,0., }); - perspectiveMatrix = glm::transpose(perspectiveMatrix); return perspectiveMatrix; @@ -191,8 +218,7 @@ void drawObjectPBR(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec } */ -void renderScene(GLFWwindow* window) -{ +void renderScene(GLFWwindow* window) { glClearColor(0.0f, 0.0f, 0.15f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glm::mat4 transformation; @@ -201,25 +227,23 @@ void renderScene(GLFWwindow* window) glm::mat4 sunScale = glm::scale(glm::vec3(0.04f)); glm::mat4 sunTranslate = glm::translate(sunPosition); - drawSun(sphereContext, sunTranslate * sunScale, texture::sun); + drawSun(sphereContext, sunTranslate * sunScale, textureSuns::sun1); glm::mat4 planetScale = glm::scale(glm::vec3(0.005f)); // model jest bardzo duży, dlatego taka niska skala glm::mat4 planetRotate = glm::rotate(time * 0.0416f, glm::vec3(0, 1, 0)); // 1 godzina mija w 1 sekundę, obrót z zachodu na wschód glm::mat4 planetTranslate = glm::translate(glm::vec3(0, 0, 0)); // zostaje na domyślnej pozycji - drawObjectTexture(sphereContext, planetTranslate * planetRotate * planetScale, texture::earth); + drawObjectTexture(sphereContext, planetTranslate * planetRotate * planetScale, texturePlanets::earth); glfwSwapBuffers(window); } -void framebuffer_size_callback(GLFWwindow* window, int width, int height) -{ +void framebuffer_size_callback(GLFWwindow* window, int width, int height) { aspectRatio = float(width) / float(height); glViewport(0, 0, width, height); } -void loadModelToContext(std::string path, Core::RenderContext& context) -{ +void loadModelToContext(std::string path, Core::RenderContext& context) { Assimp::Importer import; const aiScene* scene = import.ReadFile(path, aiProcess_Triangulate | aiProcess_CalcTangentSpace); @@ -231,8 +255,7 @@ void loadModelToContext(std::string path, Core::RenderContext& context) context.initFromAssimpMesh(scene->mMeshes[0]); } -void init(GLFWwindow* window) -{ +void init(GLFWwindow* window) { glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); glEnable(GL_DEPTH_TEST); @@ -246,21 +269,44 @@ void init(GLFWwindow* window) loadModelToContext("./models/sphere.obj", sphereContext); - texture::earth = Core::LoadTexture("./textures/earth2.png"); - texture::clouds = Core::LoadTexture("./textures/clouds.jpg"); - texture::sun = Core::LoadTexture("./textures/sun.jpg"); + texturePlanets::earth = Core::LoadTexture("./textures/planets/earth2.png"); + /*texturePlanets::planet = Core::LoadTexture("./textures/planets/planet.png"); + texturePlanets::mercury = Core::LoadTexture("./textures/planets/mercury1.jpg"); + texturePlanets::venus = Core::LoadTexture("./textures/planets/earth2.png"); + texturePlanets::mars = Core::LoadTexture("./textures/planets/mars.jpg"); + texturePlanets::alpine = Core::LoadTexture("./textures/planets/Alpine.png"); + texturePlanets::ceres = Core::LoadTexture("./textures/planets/ceres_fictional.jpg"); + texturePlanets::eris = Core::LoadTexture("./textures/planets/eris_fictional.jpg"); + texturePlanets::haumea = Core::LoadTexture("./textures/planets/haumea_fictional.jpg"); + texturePlanets::icy = Core::LoadTexture("./textures/planets/Icy.png"); + texturePlanets::jupiter = Core::LoadTexture("./textures/planets/jupiter.jpg"); + texturePlanets::makemake = Core::LoadTexture("./textures/planets/makemake_fictional.jpg"); + texturePlanets::martian = Core::LoadTexture("./textures/planets/Martian.png"); + texturePlanets::neptune = Core::LoadTexture("./textures/planets/neptune.jpg"); + texturePlanets::saturn = Core::LoadTexture("./textures/planets/saturn.jpg"); + texturePlanets::savannah = Core::LoadTexture("./textures/planets/Savannah.png"); + texturePlanets::swamp = Core::LoadTexture("./textures/planets/Swamp.png"); + texturePlanets::tropical = Core::LoadTexture("./textures/planets/Tropical.png"); + texturePlanets::uranus = Core::LoadTexture("./textures/planets/uranus.jpg"); + texturePlanets::venusian = Core::LoadTexture("./textures/planets/Venusian.png"); + texturePlanets::volcanic = Core::LoadTexture("./textures/planets/Volcanic.png");*/ + + textureSuns::sun1 = Core::LoadTexture("./textures/suns/sun1.jpg"); + /*textureSuns::sun2 = Core::LoadTexture("./textures/suns/sun2.jpg"); + textureSuns::sun3 = Core::LoadTexture("./textures/suns/sun3.jpg"); + textureSuns::sun4 = Core::LoadTexture("./textures/suns/sun4.jpg");*/ + + textureMaterials::clouds = Core::LoadTexture("./textures/planets/clouds.jpg"); } -void shutdown(GLFWwindow* window) -{ +void shutdown(GLFWwindow* window) { shaderLoader.DeleteProgram(programDepth); shaderLoader.DeleteProgram(programTex); shaderLoader.DeleteProgram(programSun); } //obsluga wejscia -void processInput(GLFWwindow* window) -{ +void processInput(GLFWwindow* window) { glm::vec3 cameraSide = glm::normalize(glm::cross(cameraDir, glm::vec3(0.f, 1.f, 0.f))); float angleSpeed = 0.002f; diff --git a/grk/cw 6/textures/mars.jpg b/grk/cw 6/textures/mars.jpg deleted file mode 100644 index 09a804b..0000000 Binary files a/grk/cw 6/textures/mars.jpg and /dev/null differ diff --git a/grk/cw 6/textures/rust_normal.jpg b/grk/cw 6/textures/materials/normalne/rust_normal.jpg similarity index 100% rename from grk/cw 6/textures/rust_normal.jpg rename to grk/cw 6/textures/materials/normalne/rust_normal.jpg diff --git a/grk/cw 6/textures/spaceship_normal.jpg b/grk/cw 6/textures/materials/normalne/spaceship_normal.jpg similarity index 100% rename from grk/cw 6/textures/spaceship_normal.jpg rename to grk/cw 6/textures/materials/normalne/spaceship_normal.jpg diff --git a/grk/cw 6/textures/rust.jpg b/grk/cw 6/textures/materials/rust.jpg similarity index 100% rename from grk/cw 6/textures/rust.jpg rename to grk/cw 6/textures/materials/rust.jpg diff --git a/grk/cw 6/textures/scratches.jpg b/grk/cw 6/textures/materials/scratches.jpg similarity index 100% rename from grk/cw 6/textures/scratches.jpg rename to grk/cw 6/textures/materials/scratches.jpg diff --git a/grk/cw 6/textures/spaceship.jpg b/grk/cw 6/textures/materials/spaceship.jpg similarity index 100% rename from grk/cw 6/textures/spaceship.jpg rename to grk/cw 6/textures/materials/spaceship.jpg diff --git a/grk/cw 6/textures/moons/moon1.jpg b/grk/cw 6/textures/moons/moon1.jpg new file mode 100644 index 0000000..8a1de86 Binary files /dev/null and b/grk/cw 6/textures/moons/moon1.jpg differ diff --git a/grk/cw 6/textures/moon.jpg b/grk/cw 6/textures/moons/moon2.jpg similarity index 100% rename from grk/cw 6/textures/moon.jpg rename to grk/cw 6/textures/moons/moon2.jpg diff --git a/grk/cw 6/textures/moon.png b/grk/cw 6/textures/moons/moon3.png similarity index 100% rename from grk/cw 6/textures/moon.png rename to grk/cw 6/textures/moons/moon3.png diff --git a/grk/cw 6/textures/moon_normals.png b/grk/cw 6/textures/moons/normalne/moon_normals.png similarity index 100% rename from grk/cw 6/textures/moon_normals.png rename to grk/cw 6/textures/moons/normalne/moon_normals.png diff --git a/grk/cw 6/textures/planets/Alpine.png b/grk/cw 6/textures/planets/Alpine.png new file mode 100644 index 0000000..527ba8b Binary files /dev/null and b/grk/cw 6/textures/planets/Alpine.png differ diff --git a/grk/cw 6/textures/planets/Icy.png b/grk/cw 6/textures/planets/Icy.png new file mode 100644 index 0000000..eb776be Binary files /dev/null and b/grk/cw 6/textures/planets/Icy.png differ diff --git a/grk/cw 6/textures/planets/Martian.png b/grk/cw 6/textures/planets/Martian.png new file mode 100644 index 0000000..db4c183 Binary files /dev/null and b/grk/cw 6/textures/planets/Martian.png differ diff --git a/grk/cw 6/textures/planets/Savannah.png b/grk/cw 6/textures/planets/Savannah.png new file mode 100644 index 0000000..31f12f5 Binary files /dev/null and b/grk/cw 6/textures/planets/Savannah.png differ diff --git a/grk/cw 6/textures/planets/Swamp.png b/grk/cw 6/textures/planets/Swamp.png new file mode 100644 index 0000000..ed5d37b Binary files /dev/null and b/grk/cw 6/textures/planets/Swamp.png differ diff --git a/grk/cw 6/textures/planets/Tropical.png b/grk/cw 6/textures/planets/Tropical.png new file mode 100644 index 0000000..802a534 Binary files /dev/null and b/grk/cw 6/textures/planets/Tropical.png differ diff --git a/grk/cw 6/textures/planets/Venusian.png b/grk/cw 6/textures/planets/Venusian.png new file mode 100644 index 0000000..bee66be Binary files /dev/null and b/grk/cw 6/textures/planets/Venusian.png differ diff --git a/grk/cw 6/textures/planets/Volcanic.png b/grk/cw 6/textures/planets/Volcanic.png new file mode 100644 index 0000000..4ca5795 Binary files /dev/null and b/grk/cw 6/textures/planets/Volcanic.png differ diff --git a/grk/cw 6/textures/planets/ceres_fictional.jpg b/grk/cw 6/textures/planets/ceres_fictional.jpg new file mode 100644 index 0000000..1019e23 Binary files /dev/null and b/grk/cw 6/textures/planets/ceres_fictional.jpg differ diff --git a/grk/cw 6/textures/clouds.jpg b/grk/cw 6/textures/planets/clouds.jpg similarity index 100% rename from grk/cw 6/textures/clouds.jpg rename to grk/cw 6/textures/planets/clouds.jpg diff --git a/grk/cw 6/textures/earth.png b/grk/cw 6/textures/planets/earth.png similarity index 100% rename from grk/cw 6/textures/earth.png rename to grk/cw 6/textures/planets/earth.png diff --git a/grk/cw 6/textures/earth2.png b/grk/cw 6/textures/planets/earth2.png similarity index 100% rename from grk/cw 6/textures/earth2.png rename to grk/cw 6/textures/planets/earth2.png diff --git a/grk/cw 6/textures/planets/earth_nightmap.jpg b/grk/cw 6/textures/planets/earth_nightmap.jpg new file mode 100644 index 0000000..863be2c Binary files /dev/null and b/grk/cw 6/textures/planets/earth_nightmap.jpg differ diff --git a/grk/cw 6/textures/planets/eris_fictional.jpg b/grk/cw 6/textures/planets/eris_fictional.jpg new file mode 100644 index 0000000..eccc3ba Binary files /dev/null and b/grk/cw 6/textures/planets/eris_fictional.jpg differ diff --git a/grk/cw 6/textures/planets/haumea_fictional.jpg b/grk/cw 6/textures/planets/haumea_fictional.jpg new file mode 100644 index 0000000..da3ccc3 Binary files /dev/null and b/grk/cw 6/textures/planets/haumea_fictional.jpg differ diff --git a/grk/cw 6/textures/planets/jupiter.jpg b/grk/cw 6/textures/planets/jupiter.jpg new file mode 100644 index 0000000..21f1951 Binary files /dev/null and b/grk/cw 6/textures/planets/jupiter.jpg differ diff --git a/grk/cw 6/textures/planets/makemake_fictional.jpg b/grk/cw 6/textures/planets/makemake_fictional.jpg new file mode 100644 index 0000000..a0719ab Binary files /dev/null and b/grk/cw 6/textures/planets/makemake_fictional.jpg differ diff --git a/grk/cw 6/textures/planets/mars.jpg b/grk/cw 6/textures/planets/mars.jpg new file mode 100644 index 0000000..b3654a9 Binary files /dev/null and b/grk/cw 6/textures/planets/mars.jpg differ diff --git a/grk/cw 6/textures/planets/mercury1.jpg b/grk/cw 6/textures/planets/mercury1.jpg new file mode 100644 index 0000000..eebaed9 Binary files /dev/null and b/grk/cw 6/textures/planets/mercury1.jpg differ diff --git a/grk/cw 6/textures/mercury.jpg b/grk/cw 6/textures/planets/mercury2.jpg similarity index 100% rename from grk/cw 6/textures/mercury.jpg rename to grk/cw 6/textures/planets/mercury2.jpg diff --git a/grk/cw 6/textures/planets/neptune.jpg b/grk/cw 6/textures/planets/neptune.jpg new file mode 100644 index 0000000..30e7ac5 Binary files /dev/null and b/grk/cw 6/textures/planets/neptune.jpg differ diff --git a/grk/cw 6/textures/earth2_normals.png b/grk/cw 6/textures/planets/normalne/earth2_normals.png similarity index 100% rename from grk/cw 6/textures/earth2_normals.png rename to grk/cw 6/textures/planets/normalne/earth2_normals.png diff --git a/grk/cw 6/textures/earth_normalmap.png b/grk/cw 6/textures/planets/normalne/earth_normalmap.png similarity index 100% rename from grk/cw 6/textures/earth_normalmap.png rename to grk/cw 6/textures/planets/normalne/earth_normalmap.png diff --git a/grk/cw 6/textures/planets/planet.png b/grk/cw 6/textures/planets/planet.png new file mode 100644 index 0000000..f1554a9 Binary files /dev/null and b/grk/cw 6/textures/planets/planet.png differ diff --git a/grk/cw 6/textures/planets/saturn.jpg b/grk/cw 6/textures/planets/saturn.jpg new file mode 100644 index 0000000..d8b23df Binary files /dev/null and b/grk/cw 6/textures/planets/saturn.jpg differ diff --git a/grk/cw 6/textures/planets/saturn_ring_alpha.png b/grk/cw 6/textures/planets/saturn_ring_alpha.png new file mode 100644 index 0000000..ce82586 Binary files /dev/null and b/grk/cw 6/textures/planets/saturn_ring_alpha.png differ diff --git a/grk/cw 6/textures/planets/uranus.jpg b/grk/cw 6/textures/planets/uranus.jpg new file mode 100644 index 0000000..d0abf4c Binary files /dev/null and b/grk/cw 6/textures/planets/uranus.jpg differ diff --git a/grk/cw 6/textures/planets/venus.jpg b/grk/cw 6/textures/planets/venus.jpg new file mode 100644 index 0000000..a26a410 Binary files /dev/null and b/grk/cw 6/textures/planets/venus.jpg differ diff --git a/grk/cw 6/textures/sun.jpg b/grk/cw 6/textures/suns/sun1.jpg similarity index 100% rename from grk/cw 6/textures/sun.jpg rename to grk/cw 6/textures/suns/sun1.jpg diff --git a/grk/cw 6/textures/suns/sun2.jpg b/grk/cw 6/textures/suns/sun2.jpg new file mode 100644 index 0000000..045493a Binary files /dev/null and b/grk/cw 6/textures/suns/sun2.jpg differ diff --git a/grk/cw 6/textures/suns/sun3.jpg b/grk/cw 6/textures/suns/sun3.jpg new file mode 100644 index 0000000..9f8d78c Binary files /dev/null and b/grk/cw 6/textures/suns/sun3.jpg differ diff --git a/grk/cw 6/textures/suns/sun4.png b/grk/cw 6/textures/suns/sun4.png new file mode 100644 index 0000000..e460188 Binary files /dev/null and b/grk/cw 6/textures/suns/sun4.png differ diff --git a/grk/cw 6/textures/suns/sun5.png b/grk/cw 6/textures/suns/sun5.png new file mode 100644 index 0000000..ae3426b Binary files /dev/null and b/grk/cw 6/textures/suns/sun5.png differ diff --git a/grk/cw 6/textures/venus.jpg b/grk/cw 6/textures/venus.jpg deleted file mode 100644 index 95a5a50..0000000 Binary files a/grk/cw 6/textures/venus.jpg and /dev/null differ