1
0

Finished for Abgabe

This commit is contained in:
Niklas Birk 2020-04-01 22:17:35 +02:00
parent 0ac020d531
commit 33329c10d0
14 changed files with 20 additions and 33 deletions

View File

@ -48,12 +48,12 @@ int main()
emitter *e;
particle *p;
vector3f *pos;
for (int j = 0; j < ps->eamount; j++)
for (int y = 0; y < ps->eamount; y++)
{
e = (ps->emitters)[j];
for (int i = 0; i < e->pamount; i++)
e = (ps->emitters)[y];
for (int x = 0; x < e->pamount; x++)
{
p = (e->particles)[i];
p = (e->particles)[x];
pos = p->position;
glColor3f(p->color->x, p->color->y, p->color->z);
@ -86,4 +86,4 @@ void calcCol(particle *p)
p->color->x -= 0.00001f;
p->color->y -= 0.00001f;
p->color->z -= 0.00001f;
}
}

View File

@ -112,4 +112,4 @@ void deleteShaders(GLuint *shaders, GLsizei count)
{
glDeleteShader(shaders[i]);
}
}
}

View File

@ -1,11 +1,7 @@
#include "glad/glad.h"
#include <GLFW/glfw3.h>
#ifndef INFORMATIKPROJEKT_INITOPENGL_H
#define INFORMATIKPROJEKT_INITOPENGL_H
void initGlad();
void initGLFW();
@ -20,6 +16,4 @@ void framebufferSizeCallback(GLFWwindow *window, int width, int height);
GLuint compileShader(const GLchar *shaderSource, GLenum shaderType);
GLuint linkShaders(GLuint *shaders, GLsizei count);
void deleteShaders(GLuint *shaders, GLsizei count);
#endif //INFORMATIKPROJEKT_INITOPENGL_H
void deleteShaders(GLuint *shaders, GLsizei count);

View File

@ -14,7 +14,7 @@
#define ENGINE_NAME "rwu_particles"
#define ENGINE_VERSION VK_MAKE_VERSION(0, 0, 0)
#define PARTICLE_AMOUNT 10000000
#define PARTICLE_AMOUNT 1000000
#define PARTICLE_SIZE (3 * sizeof(vector3f) + sizeof(float))
#define WORKGROUP_SIZE_Y 1
#define WORKGROUP_SIZE_Z 1
@ -143,6 +143,4 @@ void createGraphicsCommandBuffers(Graphics *graphics);
// Else
void mapBufferMemory(Compute *compute, VkDeviceMemory memory, void *inputData, uint32_t dataSize);
void createSemaphore(VkDevice device, VkSemaphore *semaphore);
void createSemaphore(VkDevice device, VkSemaphore *semaphore);

View File

@ -102,6 +102,7 @@ int main()
glfwPollEvents();
}
//END
deleteShaders(renderShaders, 2);
glDeleteProgram(renderShaderProgram);

View File

@ -42,7 +42,7 @@ particle_system *initParticleSystem(int eamount)
/*
* Updates particles
*/
int updateParticles(float dt, particle_system *ps, CalculatePositionFunction calculatePosition, CalculateColorFunction calculateColor)
void updateParticles(float dt, particle_system *ps, CalculatePositionFunction calculatePosition, CalculateColorFunction calculateColor)
{
emitter *e;
particle *p;
@ -208,4 +208,4 @@ void initRandomParticles(emitter *e)
((float) (rand() % 255)) / 255);
(e->particles)[i] = initParticle(pos, dir, color, (float) (rand() % (UPPER_AGE - LOWER_AGE + 1) + LOWER_AGE));
}
}
}

View File

@ -69,7 +69,7 @@ particle_system *initParticleSystem(int eamount);
/*
* Updates particle
*/
int updateParticles(float dt, particle_system *particleSystem, CalculatePositionFunction calculatePosition, CalculateColorFunction calculateColor);
void updateParticles(float dt, particle_system *particleSystem, CalculatePositionFunction calculatePosition, CalculateColorFunction calculateColor);
/*
* Resets a particle to seed at emitter's position

View File

@ -85,4 +85,4 @@ void main()
p[gid] = part;
}
}
}

View File

@ -6,7 +6,4 @@ layout(location = 0) out vec4 colOut;
void main(void)
{
colOut = vec4(colV, 1);
}
}

View File

@ -9,6 +9,4 @@ void main(void)
{
colV = colIn;
gl_Position = vec4(pos, 1);
}
}

View File

@ -93,4 +93,4 @@ void main()
p[gid] = part;
}
}
}

View File

@ -6,4 +6,4 @@ layout(location = 0) out vec4 colOut;
void main(void)
{
colOut = vec4(colV, 1);
}
}

View File

@ -33,4 +33,4 @@ char *readFile(char *filename, char *mode, size_t *size)
}
return buffer;
}
}

View File

@ -142,5 +142,4 @@ int main()
shutdownGLFW(window);
return SUCCESS;
}
}