Support Forum       G3D Web Page     
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
G3D::ParticleSystem::ParticleBuffer Class Reference

Not threadsafe. More...

Public Member Functions

shared_ptr< Blockalloc (const shared_ptr< ParticleSystem > &particleSystem, const shared_ptr< ParticleSurface > &surface, int numElements)
 
void allocateVertexBuffer (const int newReserve)
 Allocate the vertexBuffer and all associated attribute arrays, throwing away all old data. More...
 
void compact (const int newReserveCount)
 
void free (const shared_ptr< Block > &block)
 
void removeUnusedBlocks ()
 Remove all blocks that are not in use because the underlying ParticleSurface referencing it is gone. More...
 
int reserve () const
 Total elements allocated, including those in use. More...
 

Public Attributes

Array< shared_ptr< Block > > blockArray
 A list of all Blocks in s_particleBuffer, which include potentially live ParticleSystems and where their particles are stored in s_particleBuffer. More...
 
int count
 Elements actually in use. More...
 
IndexStream indexStream
 Only used for sorted transparency. More...
 
AttributeArray materialProperties
 material index, texture-space width/height in pixels (packed to top-left), Entity expressive rendering flags (e.g. More...
 
AttributeArray normal
 GL_UNSIGNED_BYTE x 4. More...
 
AttributeArray position
 Center of each particle, world-space XYZ, and the angle in GL_FLOAT x 4. More...
 
AttributeArray shape
 world-space radius, coverage, userdata in GL_FLOAT x 3 More...
 
shared_ptr< VertexBuffervertexBuffer
 

Static Public Attributes

static const uint16 CASTS_SHADOWS = 0x1
 Mask for materialProperties[3]. More...
 
static const uint16 RECEIVES_SHADOWS = 0x2
 Mask for materialProperties[3]. More...
 

Detailed Description

Not threadsafe.

Member Function Documentation

◆ alloc()

shared_ptr<Block> G3D::ParticleSystem::ParticleBuffer::alloc ( const shared_ptr< ParticleSystem > &  particleSystem,
const shared_ptr< ParticleSurface > &  surface,
int  numElements 
)

◆ allocateVertexBuffer()

void G3D::ParticleSystem::ParticleBuffer::allocateVertexBuffer ( const int  newReserve)

Allocate the vertexBuffer and all associated attribute arrays, throwing away all old data.

◆ compact()

void G3D::ParticleSystem::ParticleBuffer::compact ( const int  newReserveCount)

◆ free()

void G3D::ParticleSystem::ParticleBuffer::free ( const shared_ptr< Block > &  block)

◆ removeUnusedBlocks()

void G3D::ParticleSystem::ParticleBuffer::removeUnusedBlocks ( )

Remove all blocks that are not in use because the underlying ParticleSurface referencing it is gone.

◆ reserve()

int G3D::ParticleSystem::ParticleBuffer::reserve ( ) const
inline

Total elements allocated, including those in use.

Member Data Documentation

◆ blockArray

Array<shared_ptr<Block> > G3D::ParticleSystem::ParticleBuffer::blockArray

A list of all Blocks in s_particleBuffer, which include potentially live ParticleSystems and where their particles are stored in s_particleBuffer.

Used for managing allocation of space within s_particleBuffer.

◆ CASTS_SHADOWS

const uint16 G3D::ParticleSystem::ParticleBuffer::CASTS_SHADOWS = 0x1
static

Mask for materialProperties[3].

◆ count

int G3D::ParticleSystem::ParticleBuffer::count

Elements actually in use.

◆ indexStream

IndexStream G3D::ParticleSystem::ParticleBuffer::indexStream

Only used for sorted transparency.

Recomputed for each draw call based on a depth sort. GL_UNSIGNED_INT

◆ materialProperties

AttributeArray G3D::ParticleSystem::ParticleBuffer::materialProperties

material index, texture-space width/height in pixels (packed to top-left), Entity expressive rendering flags (e.g.

: casts shadows, receives shadows), and userdataInt in GL_UNSIGNED_SHORT x 4 format

◆ normal

AttributeArray G3D::ParticleSystem::ParticleBuffer::normal

GL_UNSIGNED_BYTE x 4.

The fourth component indicates how much it should be used vs. the billboard normal for shading purposes (we could use the magnitude of the normal, but we need the fourth component for alignment anyway).

◆ position

AttributeArray G3D::ParticleSystem::ParticleBuffer::position

Center of each particle, world-space XYZ, and the angle in GL_FLOAT x 4.

Referenced by reserve().

◆ RECEIVES_SHADOWS

const uint16 G3D::ParticleSystem::ParticleBuffer::RECEIVES_SHADOWS = 0x2
static

Mask for materialProperties[3].

◆ shape

AttributeArray G3D::ParticleSystem::ParticleBuffer::shape

world-space radius, coverage, userdata in GL_FLOAT x 3

◆ vertexBuffer

shared_ptr<VertexBuffer> G3D::ParticleSystem::ParticleBuffer::vertexBuffer

documentation generated on Wed Nov 24 2021 08:01:58 using doxygen 1.8.15