CUGL 3.0
Cornell University Game Library
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
cugl::scene3::ParticleBatch Class Reference

#include <CUParticleBatch.h>

Inheritance diagram for cugl::scene3::ParticleBatch:
cugl::scene3::Scene3Batch

Public Member Functions

 ParticleBatch ()
 
 ~ParticleBatch ()
 
void dispose () override
 
bool init ()
 
bool init (Uint32 key, Uint32 priority) override
 
void append (const std::shared_ptr< SceneNode > &node, const Mat4 &transform) override
 
void flush (const std::shared_ptr< Camera > &camera) override
 
void clear () override
 
- Public Member Functions inherited from cugl::scene3::Scene3Batch
 Scene3Batch ()
 
virtual void dispose ()
 
virtual bool init (Uint32 key, Uint32 priority)
 
Uint32 getBatchKey () const
 
Uint32 getPriority () const
 
virtual void append (const std::shared_ptr< SceneNode > &node, const Mat4 &transform)=0
 
virtual void flush (const std::shared_ptr< Camera > &camera)=0
 
virtual void clear ()=0
 

Static Public Member Functions

static std::shared_ptr< ParticleBatchalloc ()
 
static std::shared_ptr< ParticleBatchalloc (Uint32 key, Uint32 priority)
 

Static Public Attributes

static const Uint32 BATCH_KEY = 3
 

Additional Inherited Members

- Protected Attributes inherited from cugl::scene3::Scene3Batch
Uint32 _batchkey
 
Uint32 _priority
 

Detailed Description

This class is a batch for drawing ParticleNode objects.

This class is only designed for ParticleNode objects. Attempts to apply it to any other SceneNode will be ignored. Objects are sorted by z-order (relative to the camera) before they are drawn.

Constructor & Destructor Documentation

◆ ParticleBatch()

cugl::scene3::ParticleBatch::ParticleBatch ( )
inline

Creates a new degenerate batch on the stack.

The batch has no shader, and therefore cannot draw anything.

NEVER USE A CONSTRUCTOR WITH NEW. If you want to allocate an object on the heap, use one of the static constructors instead.

◆ ~ParticleBatch()

cugl::scene3::ParticleBatch::~ParticleBatch ( )
inline

Deletes this batch, disposing all resources

Member Function Documentation

◆ alloc() [1/2]

static std::shared_ptr< ParticleBatch > cugl::scene3::ParticleBatch::alloc ( )
inlinestatic

Returns a newly allocated particle batch with the default key and priority.

This method can fail is the shader fails to compile.

Returns
a newly allocated particle batch with the default key and priority.

◆ alloc() [2/2]

static std::shared_ptr< ParticleBatch > cugl::scene3::ParticleBatch::alloc ( Uint32  key,
Uint32  priority 
)
inlinestatic

Returns a newly allocated particle batch with the given key and priority.

This method can fail is the shader fails to compile.

Parameters
keyThe batch key
priorityThe batch priority
Returns
a newly allocated particle batch with the given key and priority.

◆ append()

void cugl::scene3::ParticleBatch::append ( const std::shared_ptr< SceneNode > &  node,
const Mat4 transform 
)
overridevirtual

Appends a scene node to this batch for drawing.

The scene node will be ignored if is not an instance of ParticleNode. Nodes will be sorted by relative z-order before they are drawn.

Parameters
nodeThe node to draw
transformThe global transform

Implements cugl::scene3::Scene3Batch.

◆ clear()

void cugl::scene3::ParticleBatch::clear ( )
inlineoverridevirtual

Removes all appended nodes without drawing them.

Calling flush after this method will draw nothing.

Implements cugl::scene3::Scene3Batch.

◆ dispose()

void cugl::scene3::ParticleBatch::dispose ( )
inlineoverridevirtual

Disposes all of the resources used by this batch.

A disposed batch can be safely reinitialized. Any shader owned by this batch will be released. It will be deleted if no other object owns it.

Reimplemented from cugl::scene3::Scene3Batch.

◆ flush()

void cugl::scene3::ParticleBatch::flush ( const std::shared_ptr< Camera > &  camera)
overridevirtual

Draws all appended nodes.

Nodes will be sorted by relative z-order before they are drawn.

Parameters
cameraThe camera to draw with

Implements cugl::scene3::Scene3Batch.

◆ init() [1/2]

bool cugl::scene3::ParticleBatch::init ( )
inline

Initializes a new particle batch with the default key and priority.

This method can fail is the shader fails to compile.

Returns
true if initialization was successful.

◆ init() [2/2]

bool cugl::scene3::ParticleBatch::init ( Uint32  key,
Uint32  priority 
)
overridevirtual

Initializes a new particle batch with the given key and priority.

This method can fail is the shader fails to compile.

Parameters
keyThe batch key
priorityThe batch priority
Returns
true if initialization was successful.

Reimplemented from cugl::scene3::Scene3Batch.

Member Data Documentation

◆ BATCH_KEY

const Uint32 cugl::scene3::ParticleBatch::BATCH_KEY = 3
static

The key for this batch type


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