Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
ParticleBuffer Class Reference

#include <particles.h>

+ Inheritance diagram for ParticleBuffer:
+ Collaboration diagram for ParticleBuffer:

Public Member Functions

 ParticleBuffer (ClientEnvironment *env, const video::SMaterial &material)
 
std::optional< u16 > allocate ()
 Reserves one more slot for a particle (4 vertices, 6 indices)
 
void release (u16 index)
 Frees the particle at index
 
video::S3DVertex * getVertices (u16 index)
 
bool isEmpty () const
 
virtual video::SMaterial & getMaterial (u32 num) override
 
virtual u32 getMaterialCount () const override
 
virtual const core::aabbox3df & getBoundingBox () const override
 
virtual void render () override
 
virtual void OnRegisterSceneNode () override
 

Static Public Attributes

static constexpr u16 MAX_PARTICLES_PER_BUFFER = 16000
 

Private Attributes

irr_ptr< scene::SMeshBuffer > m_mesh_buffer
 
std::vector< u16 > m_free_list
 
float m_usage_timer = 0
 
u16 m_count = 0
 
bool m_bounding_box_dirty = true
 

Friends

class ParticleManager
 

Constructor & Destructor Documentation

◆ ParticleBuffer()

ParticleBuffer::ParticleBuffer ( ClientEnvironment * env,
const video::SMaterial & material )

References m_mesh_buffer.

Member Function Documentation

◆ allocate()

std::optional< u16 > ParticleBuffer::allocate ( )

Reserves one more slot for a particle (4 vertices, 6 indices)

Returns
particle index within buffer

References m_count, m_free_list, m_mesh_buffer, m_usage_timer, MAX_PARTICLES_PER_BUFFER, and quad_indices.

Referenced by Particle::attachToBuffer().

+ Here is the caller graph for this function:

◆ getBoundingBox()

const core::aabbox3df & ParticleBuffer::getBoundingBox ( ) const
overridevirtual

◆ getMaterial()

virtual video::SMaterial & ParticleBuffer::getMaterial ( u32 num)
inlineoverridevirtual

References m_mesh_buffer.

◆ getMaterialCount()

virtual u32 ParticleBuffer::getMaterialCount ( ) const
inlineoverridevirtual

◆ getVertices()

video::S3DVertex * ParticleBuffer::getVertices ( u16 index)
Returns
video::S3DVertex[4]

References m_bounding_box_dirty, m_count, and m_mesh_buffer.

Referenced by Particle::updateVertices().

+ Here is the caller graph for this function:

◆ isEmpty()

bool ParticleBuffer::isEmpty ( ) const
inline

References m_count, and m_free_list.

Referenced by render().

+ Here is the caller graph for this function:

◆ OnRegisterSceneNode()

void ParticleBuffer::OnRegisterSceneNode ( )
overridevirtual

◆ release()

void ParticleBuffer::release ( u16 index)

Frees the particle at index

References m_count, m_free_list, and m_mesh_buffer.

Referenced by Particle::~Particle().

+ Here is the caller graph for this function:

◆ render()

void ParticleBuffer::render ( )
overridevirtual

References isEmpty(), and m_mesh_buffer.

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ ParticleManager

friend class ParticleManager
friend

Member Data Documentation

◆ m_bounding_box_dirty

bool ParticleBuffer::m_bounding_box_dirty = true
mutableprivate

Referenced by getBoundingBox(), and getVertices().

◆ m_count

u16 ParticleBuffer::m_count = 0
private

◆ m_free_list

std::vector<u16> ParticleBuffer::m_free_list
private

Referenced by allocate(), isEmpty(), and release().

◆ m_mesh_buffer

irr_ptr<scene::SMeshBuffer> ParticleBuffer::m_mesh_buffer
private

◆ m_usage_timer

float ParticleBuffer::m_usage_timer = 0
private

Referenced by allocate().

◆ MAX_PARTICLES_PER_BUFFER

u16 ParticleBuffer::MAX_PARTICLES_PER_BUFFER = 16000
staticconstexpr

Referenced by allocate().


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