Support Forum G3D Web Page |
For efficiency, individual Particles use materials that have been pre-registered with the ParticleSystem that are addressed with these handles. More...
Inherits G3D::ReferenceCountedObject.
Public Member Functions | |
~ParticleMaterial () | |
No garbage collection of now-unused materials is performed during the destructor because that would slow scene loading. More... | |
Static Public Member Functions | |
static shared_ptr< ParticleMaterial > | create (const UniversalMaterial::Specification &material) |
Allocates a material handle for use with particles. More... | |
static shared_ptr< ParticleMaterial > | create (const shared_ptr< UniversalMaterial > &material) |
Allocates a material handle for use with particles. More... | |
static void | freeAllUnusedMaterials () |
Protected Member Functions | |
ParticleMaterial (int index, int texelWidth) | |
Static Protected Member Functions | |
template<class T , class ... ArgTypes> | |
static shared_ptr< T > | createShared (ArgTypes &&... args) |
Like std::make_shared, but works for protected constructors. More... | |
static int | insertMaterial (const shared_ptr< UniversalMaterial > &newMaterial) |
Adds in newMaterial to the s_material array, and returns the layer it resides on. More... | |
Protected Attributes | |
int | m_texelWidth |
Width in texels of the part of the layer that is used by this ParticleMaterial. More... | |
int | m_textureIndex |
Index into the s_material 2D_ARRAY texture layer. More... | |
Static Protected Attributes | |
static shared_ptr< UniversalMaterial > | s_material |
A single material for all particle systems, using a 2D_ARRAY texture. More... | |
static Array< weak_ptr< ParticleMaterial > > | s_materialArray |
Back-pointers used for reallocating slots in s_material when it is garbage collected. More... | |
Friends | |
class | ParticleSurface |
class | ParticleSystem |
For efficiency, individual Particles use materials that have been pre-registered with the ParticleSystem that are addressed with these handles.
Particle Materials are not collected until the Entity that registered them is no longer in memory, even if no individual Particle uses that Material. Particle materials are packed into a single large texture array, so the memory requirements are that of the largest material times the number of materials.
|
inlineprotected |
G3D::ParticleMaterial::~ParticleMaterial | ( | ) |
No garbage collection of now-unused materials is performed during the destructor because that would slow scene loading.
Instead, unused materials are repurposed during creation of new materials. You can force reallocation to clear memory by invoking ParticleMaterial::freeAllUnusedMaterials
|
static |
Allocates a material handle for use with particles.
This call is very slow and should not be made per frame.
|
static |
Allocates a material handle for use with particles.
This call is very slow and should not be made per frame.
|
inlinestaticprotectedinherited |
Like std::make_shared, but works for protected constructors.
Call as createShared<myclass>.
|
static |
|
staticprotected |
Adds in newMaterial to the s_material array, and returns the layer it resides on.
|
friend |
|
friend |
|
protected |
Width in texels of the part of the layer that is used by this ParticleMaterial.
|
protected |
Index into the s_material 2D_ARRAY texture layer.
|
staticprotected |
A single material for all particle systems, using a 2D_ARRAY texture.
|
staticprotected |
Back-pointers used for reallocating slots in s_material when it is garbage collected.