group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
BulletHoleDecal Class Reference

Ring-buffer pool of 512 world-space decal quads (bullet holes, scorch marks). More...

#include <BulletHoleDecal.hpp>

Public Member Functions

void spawn (glm::vec3 pos, glm::vec3 normal, WeaponType wt)
 Place a new decal at pos oriented by normal.
void update (float dt)
 Fade all active decals over time.
const DecalInstancedata () const
uint32_t count () const

Private Attributes

std::array< DecalInstance, k_maxslots_ {}
uint32_t head_ = 0
 Ring-buffer insertion pointer.

Static Private Attributes

static constexpr uint32_t k_max = 512

Detailed Description

Ring-buffer pool of 512 world-space decal quads (bullet holes, scorch marks).

Oldest decal is overwritten when the pool is full. All 512 slots are uploaded to the GPU every frame (24 KB – cheap) so there is no kill/compact logic.

Member Function Documentation

◆ count()

uint32_t BulletHoleDecal::count ( ) const
inlinenodiscard

◆ data()

const DecalInstance * BulletHoleDecal::data ( ) const
inlinenodiscard

◆ spawn()

void BulletHoleDecal::spawn ( glm::vec3 pos,
glm::vec3 normal,
WeaponType wt )

Place a new decal at pos oriented by normal.

Parameters
posWorld-space decal center.
normalSurface normal for decal orientation.
wtWeapon type controlling decal size.

◆ update()

void BulletHoleDecal::update ( float dt)

Fade all active decals over time.

Parameters
dtFrame delta time in seconds.

Member Data Documentation

◆ head_

uint32_t BulletHoleDecal::head_ = 0
private

Ring-buffer insertion pointer.

◆ k_max

uint32_t BulletHoleDecal::k_max = 512
staticconstexprprivate

◆ slots_

std::array<DecalInstance, k_max> BulletHoleDecal::slots_ {}
private

The documentation for this class was generated from the following files: