summary refs log tree commit diff
path: root/src/Particle.h
diff options
context:
space:
mode:
authorWlodekM <[email protected]>2024-06-16 10:35:45 +0300
committerWlodekM <[email protected]>2024-06-16 10:35:45 +0300
commitabef6da56913f1c55528103e60a50451a39628b1 (patch)
treeb3c8092471ecbb73e568cd0d336efa0e7871ee8d /src/Particle.h
initial commit
Diffstat (limited to 'src/Particle.h')
-rw-r--r--src/Particle.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/Particle.h b/src/Particle.h
new file mode 100644
index 0000000..f322bbc
--- /dev/null
+++ b/src/Particle.h
@@ -0,0 +1,46 @@
+#ifndef CC_PARTICLE_H
+#define CC_PARTICLE_H
+#include "Vectors.h"
+#include "PackedCol.h"
+/* 
+Represents particle effects, and manages rendering and spawning particles
+Copyright 2014-2023 ClassiCube | Licensed under BSD-3
+*/
+
+struct IGameComponent;
+struct VertexTextured;
+struct ScheduledTask;
+extern struct IGameComponent Particles_Component;
+
+struct Particle {
+	Vec3 velocity;
+	float lifetime;
+	Vec3 lastPos, nextPos;
+	float size;
+};
+
+struct CustomParticleEffect {
+	TextureRec rec;
+	PackedCol tintCol;
+	cc_uint8 frameCount;
+	cc_uint8 particleCount;
+	cc_uint8 collideFlags;
+	cc_bool fullBright;
+	float size;
+	float sizeVariation;
+	float spread; /* how far from the spawnpoint their location can vary */
+	float speed; /* how fast they move away/towards the origin */
+	float gravity;
+	float baseLifetime; /* how long (in seconds) the particle lives for */
+	float lifetimeVariation;
+};
+
+extern struct CustomParticleEffect Particles_CustomEffects[256];
+
+/* http://www.opengl-tutorial.org/intermediate-tutorials/billboards-particles/billboards/ */
+void Particle_DoRender(const Vec2* size, const Vec3* pos, const TextureRec* rec, PackedCol col, struct VertexTextured* vertices);
+void Particles_Render(float t);
+void Particles_BreakBlockEffect(IVec3 coords, BlockID oldBlock, BlockID block);
+void Particles_RainSnowEffect(float x, float y, float z);
+void Particles_CustomEffect(int effectID, float x, float y, float z, float originX, float originY, float originZ);
+#endif