Finished for Abgabe
This commit is contained in:
parent
0ac020d531
commit
33329c10d0
10
cpuMain.c
10
cpuMain.c
@ -48,12 +48,12 @@ int main()
|
|||||||
emitter *e;
|
emitter *e;
|
||||||
particle *p;
|
particle *p;
|
||||||
vector3f *pos;
|
vector3f *pos;
|
||||||
for (int j = 0; j < ps->eamount; j++)
|
for (int y = 0; y < ps->eamount; y++)
|
||||||
{
|
{
|
||||||
e = (ps->emitters)[j];
|
e = (ps->emitters)[y];
|
||||||
for (int i = 0; i < e->pamount; i++)
|
for (int x = 0; x < e->pamount; x++)
|
||||||
{
|
{
|
||||||
p = (e->particles)[i];
|
p = (e->particles)[x];
|
||||||
pos = p->position;
|
pos = p->position;
|
||||||
|
|
||||||
glColor3f(p->color->x, p->color->y, p->color->z);
|
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->x -= 0.00001f;
|
||||||
p->color->y -= 0.00001f;
|
p->color->y -= 0.00001f;
|
||||||
p->color->z -= 0.00001f;
|
p->color->z -= 0.00001f;
|
||||||
}
|
}
|
@ -112,4 +112,4 @@ void deleteShaders(GLuint *shaders, GLsizei count)
|
|||||||
{
|
{
|
||||||
glDeleteShader(shaders[i]);
|
glDeleteShader(shaders[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,7 @@
|
|||||||
|
|
||||||
#include "glad/glad.h"
|
#include "glad/glad.h"
|
||||||
|
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
#ifndef INFORMATIKPROJEKT_INITOPENGL_H
|
|
||||||
#define INFORMATIKPROJEKT_INITOPENGL_H
|
|
||||||
|
|
||||||
void initGlad();
|
void initGlad();
|
||||||
|
|
||||||
void initGLFW();
|
void initGLFW();
|
||||||
@ -20,6 +16,4 @@ void framebufferSizeCallback(GLFWwindow *window, int width, int height);
|
|||||||
|
|
||||||
GLuint compileShader(const GLchar *shaderSource, GLenum shaderType);
|
GLuint compileShader(const GLchar *shaderSource, GLenum shaderType);
|
||||||
GLuint linkShaders(GLuint *shaders, GLsizei count);
|
GLuint linkShaders(GLuint *shaders, GLsizei count);
|
||||||
void deleteShaders(GLuint *shaders, GLsizei count);
|
void deleteShaders(GLuint *shaders, GLsizei count);
|
||||||
|
|
||||||
#endif //INFORMATIKPROJEKT_INITOPENGL_H
|
|
@ -14,7 +14,7 @@
|
|||||||
#define ENGINE_NAME "rwu_particles"
|
#define ENGINE_NAME "rwu_particles"
|
||||||
#define ENGINE_VERSION VK_MAKE_VERSION(0, 0, 0)
|
#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 PARTICLE_SIZE (3 * sizeof(vector3f) + sizeof(float))
|
||||||
#define WORKGROUP_SIZE_Y 1
|
#define WORKGROUP_SIZE_Y 1
|
||||||
#define WORKGROUP_SIZE_Z 1
|
#define WORKGROUP_SIZE_Z 1
|
||||||
@ -143,6 +143,4 @@ void createGraphicsCommandBuffers(Graphics *graphics);
|
|||||||
|
|
||||||
// Else
|
// Else
|
||||||
void mapBufferMemory(Compute *compute, VkDeviceMemory memory, void *inputData, uint32_t dataSize);
|
void mapBufferMemory(Compute *compute, VkDeviceMemory memory, void *inputData, uint32_t dataSize);
|
||||||
void createSemaphore(VkDevice device, VkSemaphore *semaphore);
|
void createSemaphore(VkDevice device, VkSemaphore *semaphore);
|
||||||
|
|
||||||
|
|
@ -102,6 +102,7 @@ int main()
|
|||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//END
|
//END
|
||||||
deleteShaders(renderShaders, 2);
|
deleteShaders(renderShaders, 2);
|
||||||
glDeleteProgram(renderShaderProgram);
|
glDeleteProgram(renderShaderProgram);
|
||||||
|
@ -42,7 +42,7 @@ particle_system *initParticleSystem(int eamount)
|
|||||||
/*
|
/*
|
||||||
* Updates particles
|
* 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;
|
emitter *e;
|
||||||
particle *p;
|
particle *p;
|
||||||
@ -208,4 +208,4 @@ void initRandomParticles(emitter *e)
|
|||||||
((float) (rand() % 255)) / 255);
|
((float) (rand() % 255)) / 255);
|
||||||
(e->particles)[i] = initParticle(pos, dir, color, (float) (rand() % (UPPER_AGE - LOWER_AGE + 1) + LOWER_AGE));
|
(e->particles)[i] = initParticle(pos, dir, color, (float) (rand() % (UPPER_AGE - LOWER_AGE + 1) + LOWER_AGE));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -69,7 +69,7 @@ particle_system *initParticleSystem(int eamount);
|
|||||||
/*
|
/*
|
||||||
* Updates particle
|
* 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
|
* Resets a particle to seed at emitter's position
|
||||||
|
@ -85,4 +85,4 @@ void main()
|
|||||||
|
|
||||||
p[gid] = part;
|
p[gid] = part;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,7 +6,4 @@ layout(location = 0) out vec4 colOut;
|
|||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
colOut = vec4(colV, 1);
|
colOut = vec4(colV, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -9,6 +9,4 @@ void main(void)
|
|||||||
{
|
{
|
||||||
colV = colIn;
|
colV = colIn;
|
||||||
gl_Position = vec4(pos, 1);
|
gl_Position = vec4(pos, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -93,4 +93,4 @@ void main()
|
|||||||
|
|
||||||
p[gid] = part;
|
p[gid] = part;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,4 +6,4 @@ layout(location = 0) out vec4 colOut;
|
|||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
colOut = vec4(colV, 1);
|
colOut = vec4(colV, 1);
|
||||||
}
|
}
|
2
utils.c
2
utils.c
@ -33,4 +33,4 @@ char *readFile(char *filename, char *mode, size_t *size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
@ -142,5 +142,4 @@ int main()
|
|||||||
shutdownGLFW(window);
|
shutdownGLFW(window);
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user