group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
ImpactEffect.cpp File Reference

Implementation of spark burst and impact flash effect. More...

#include "ImpactEffect.hpp"
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <glm/gtc/constants.hpp>
Include dependency graph for ImpactEffect.cpp:

Classes

struct  SurfaceParams
 Visual tuning parameters for a single surface material type. More...

Functions

static float randf ()
 Return a random float in [0, 1].
static float randRange (float lo, float hi)
 Return a random float in [lo, hi].
static void spawnBloodBurst (ParticlePool< BillboardParticle, 4096 > &pool, glm::vec3 pos, glm::vec3 normal, float frameDt)
 Spawn a juicy blood burst for flesh impacts.

Variables

static constexpr SurfaceParams k_surfaces []

Detailed Description

Implementation of spark burst and impact flash effect.

Function Documentation

◆ randf()

float randf ( )
static

Return a random float in [0, 1].

Here is the caller graph for this function:

◆ randRange()

float randRange ( float lo,
float hi )
static

Return a random float in [lo, hi].

Parameters
loLower bound (inclusive).
hiUpper bound (inclusive).
Returns
Random value uniformly distributed between lo and hi.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ spawnBloodBurst()

void spawnBloodBurst ( ParticlePool< BillboardParticle, 4096 > & pool,
glm::vec3 pos,
glm::vec3 normal,
float frameDt )
static

Spawn a juicy blood burst for flesh impacts.

Three layers: 1) Fast splatter streaks — bright red, high speed, elongated by velocity. 2) Slow blood mist — large, dark, lingering cloud. 3) Heavy droplets — medium speed, strong gravity, drip downward.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ k_surfaces

SurfaceParams k_surfaces[]
staticconstexpr
Initial value:
= {
{{1.0f, 0.90f, 0.60f, 1.0f}, 300.f, 600.f, 0.8f, 1.5f, 14},
{{0.7f, 0.65f, 0.60f, 1.0f}, 150.f, 350.f, 1.2f, 2.5f, 10},
{{0.8f, 0.10f, 0.10f, 1.0f}, 80.f, 200.f, 2.0f, 4.5f, 0},
{{0.6f, 0.40f, 0.20f, 1.0f}, 120.f, 300.f, 1.0f, 2.0f, 10},
{{0.2f, 0.80f, 1.00f, 1.0f}, 400.f, 700.f, 0.5f, 1.2f, 16},
}