change particle graphic and add to ship

This commit is contained in:
Matraf 2022-01-26 15:15:41 +01:00
parent dcdbcb9588
commit 2f7d3260ad
6 changed files with 7 additions and 6 deletions

View File

@ -6,7 +6,6 @@
#include "freeglut.h"
#include "glm.hpp"
#include "../glm/gtx/norm.hpp"
#include <algorithm>
#include <iostream>
#include <cmath>
@ -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;

View File

@ -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);

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 593 B