diff --git a/grafika_projekt/Debug/Render_Utils.obj b/grafika_projekt/Debug/Render_Utils.obj index 3a93e65..d62ae44 100644 Binary files a/grafika_projekt/Debug/Render_Utils.obj and b/grafika_projekt/Debug/Render_Utils.obj differ diff --git a/grafika_projekt/src/Particle.cpp b/grafika_projekt/src/Particle.cpp index e47bc62..0687c33 100644 --- a/grafika_projekt/src/Particle.cpp +++ b/grafika_projekt/src/Particle.cpp @@ -6,7 +6,6 @@ #include "freeglut.h" #include "glm.hpp" #include "../glm/gtx/norm.hpp" - #include #include #include @@ -177,7 +176,7 @@ GLuint loadDDS(const char* imagepath) } void initParticles() { - particleTexture = loadDDS("textures/particle_original.DDS"); + particleTexture = loadDDS("textures/particle.dds"); g_particule_position_size_data = new GLfloat[MaxParticles * 4]; g_particule_color_data = new GLubyte[MaxParticles * 4]; @@ -238,7 +237,7 @@ void spawnParticles(double deltaTime, glm::vec3 sourcePosition, double amount, f ParticlesContainer[particleIndex].r = 200; ParticlesContainer[particleIndex].g = 200; ParticlesContainer[particleIndex].b = 255; - ParticlesContainer[particleIndex].a = (rand() % 256) / 3; + ParticlesContainer[particleIndex].a = (rand() % 32) / 3 + 100; ParticlesContainer[particleIndex].size = (rand() % 1000) / 100000.0f + 0.05f; diff --git a/grafika_projekt/src/main.cpp b/grafika_projekt/src/main.cpp index 5bc004b..23378a7 100644 --- a/grafika_projekt/src/main.cpp +++ b/grafika_projekt/src/main.cpp @@ -13,6 +13,9 @@ #include "Camera.h" #include "SOIL/stb_image_aug.h" #include "Particle.h" +#include "../glm/gtx/matrix_decompose.hpp" + +glm::vec4 particlePos; GLuint skyboxProgram, skyboxBuffer; GLuint bubbleProgram; @@ -215,7 +218,7 @@ void keyboard(unsigned char key, int x, int y) nextPosition = cameraPos + (cameraDir * moveSpeed); if (isInBoundaries(nextPosition)) { cameraPos = nextPosition; - addParticleSource(cameraPos, 1000.0f, 0.6f); + addParticleSource(glm::vec3(particlePos.x, particlePos.y, particlePos.z), 1000.0f, 0.6f); } break; case 's': @@ -223,7 +226,6 @@ void keyboard(unsigned char key, int x, int y) nextPosition = cameraPos - (cameraDir * moveSpeed); if (isInBoundaries(nextPosition)) { cameraPos = nextPosition; - addParticleSource(cameraPos, 1000.0f, 0.6f); } break; case 'd': @@ -377,7 +379,7 @@ void renderScene() glm::mat4 submarineInitialTransformation = glm::translate(glm::vec3(0, -0.5, -0.4)) * glm::rotate(glm::radians(180.0f), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(0.25f)); glm::mat4 submarineModelMatrix = glm::translate(cameraPos + cameraDir) * glm::mat4_cast(glm::inverse(rotation)) * submarineInitialTransformation; - + particlePos = submarineModelMatrix * glm::vec4(0, 0.7, 0.3, 1); glm::mat4 bubbleInitialTransformation = glm::translate(glm::vec3(0, -0.5, -0.4)) * glm::rotate(glm::radians(180.0f), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(0.5f)); glm::vec3 change1 = glm::vec3(0, 3, 0); diff --git a/grafika_projekt/textures/particle.dds b/grafika_projekt/textures/particle.dds new file mode 100644 index 0000000..4960aee Binary files /dev/null and b/grafika_projekt/textures/particle.dds differ diff --git a/grafika_projekt/textures/particle.png b/grafika_projekt/textures/particle.png deleted file mode 100644 index 966f139..0000000 Binary files a/grafika_projekt/textures/particle.png and /dev/null differ diff --git a/grafika_projekt/textures/particle_original.DDS b/grafika_projekt/textures/particle_original.DDS deleted file mode 100644 index 7dd0856..0000000 Binary files a/grafika_projekt/textures/particle_original.DDS and /dev/null differ