mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Add smoke particle emitters with ember sparks and enable 4x MSAA
Replace UV scroll workaround for chimney smoke with proper GL_POINTS particle system. Smoke particles rise, expand, drift, and fade over 4-7 seconds. One in eight particles spawns as a bright orange/red ember spark. Enable 4x multisample antialiasing for smoother edges on player models, fences, and foliage.
This commit is contained in:
parent
11a4958e84
commit
c9adcd3d96
4 changed files with 249 additions and 36 deletions
|
|
@ -9,6 +9,7 @@
|
|||
#include <vector>
|
||||
#include <string>
|
||||
#include <optional>
|
||||
#include <random>
|
||||
|
||||
namespace wowee {
|
||||
|
||||
|
|
@ -93,6 +94,19 @@ struct M2Instance {
|
|||
void updateModelMatrix();
|
||||
};
|
||||
|
||||
/**
|
||||
* A single smoke particle emitted from a chimney or similar M2 model
|
||||
*/
|
||||
struct SmokeParticle {
|
||||
glm::vec3 position;
|
||||
glm::vec3 velocity;
|
||||
float life = 0.0f;
|
||||
float maxLife = 3.0f;
|
||||
float size = 1.0f;
|
||||
float isSpark = 0.0f; // 0 = smoke, 1 = ember/spark
|
||||
uint32_t instanceId = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* M2 Model Renderer
|
||||
*
|
||||
|
|
@ -144,6 +158,11 @@ public:
|
|||
*/
|
||||
void render(const Camera& camera, const glm::mat4& view, const glm::mat4& projection);
|
||||
|
||||
/**
|
||||
* Render smoke particles (call after render())
|
||||
*/
|
||||
void renderSmokeParticles(const Camera& camera, const glm::mat4& view, const glm::mat4& projection);
|
||||
|
||||
/**
|
||||
* Remove a specific instance by ID
|
||||
* @param instanceId Instance ID returned by createInstance()
|
||||
|
|
@ -258,6 +277,15 @@ private:
|
|||
// Collision query profiling (per frame).
|
||||
mutable double queryTimeMs = 0.0;
|
||||
mutable uint32_t queryCallCount = 0;
|
||||
|
||||
// Smoke particle system
|
||||
std::vector<SmokeParticle> smokeParticles;
|
||||
GLuint smokeVAO = 0;
|
||||
GLuint smokeVBO = 0;
|
||||
std::unique_ptr<Shader> smokeShader;
|
||||
static constexpr int MAX_SMOKE_PARTICLES = 1000;
|
||||
float smokeEmitAccum = 0.0f;
|
||||
std::mt19937 smokeRng{42};
|
||||
};
|
||||
|
||||
} // namespace rendering
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue