Untold Engine  Beta v0.0.16
docs
U4DEngine::U4DParticleSystem Class Reference

The U4DParticleSystem class is in charge of creating 3D particles. More...

Inherits U4DEngine::U4DVisibleEntity.

Public Member Functions

 U4DParticleSystem ()
 class constructor
 
 ~U4DParticleSystem ()
 class destructor
 
void render (id< MTLRenderCommandEncoder > uRenderEncoder)
 Renders the current entity. More...
 
bool loadParticle (const char *uParticleAssetFile)
 loads the particles parameter. It loads the data from Particle Designer. More...
 
void update (double dt)
 Uupdates the state of the particle system. More...
 
void setMaxNumberOfParticles (int uMaxNumberOfParticles)
 Sets the maximum number of particles to render. More...
 
int getMaxNumberOfParticles ()
 Gets the current maximum number of particles the system will render. More...
 
int getNumberOfEmittedParticles ()
 gets the number of emitted particles More...
 
void setHasTexture (bool uValue)
 sets whether or not the particle system has a texture for the particles More...
 
bool getHasTexture ()
 gets whether or not the particle system has a texture for the particles More...
 
std::vector< PARTICLERENDERDATAgetParticleRenderDataContainer ()
 gets the vector containing the 3D particle data such as position, start color, end color, etc More...
 
void removeDeadParticle ()
 Removes dead particles. More...
 
void removeAllParticles ()
 removes all particles More...
 
void initializeParticleEmitter (PARTICLESYSTEMDATA &uParticleSystemData)
 Initializes the particle emitter with data such as start color, end color, emition angle, speed, particle life, etc. More...
 
void setEnableAdditiveRendering (bool uValue)
 sets whether additive rendering should be enabled. More...
 
bool getEnableAdditiveRendering ()
 gets whether additive rendering was enabled More...
 
void setEnableNoise (bool uValue)
 sets if Noise should be enabled More...
 
bool getEnableNoise ()
 gets if Noise was enabled More...
 
void setNoiseDetail (float uNoiseDetail)
 sets the Noise Detail factor More...
 
float getNoiseDetail ()
 gets the Noise Detail factor More...
 
void play ()
 Initiates the emittion of particles from the particle system.
 
void stop ()
 Stops the emittion of particles from the particle system.
 
void setParticleDimension (float uWidth, float uHeight)
 sets the particle dimension More...
 
U4DVector3n getViewInDirection ()
 returns the view direction the particle is facing
 
void viewInDirection (U4DVector3n &uDestinationPoint)
 sets the view direction the particle should face More...
 
int getBlendingFactorSource ()
 gets the blending source factor
 
int getBlendingFactorDest ()
 gets the blending destination factor
 
- Public Member Functions inherited from U4DEngine::U4DVisibleEntity
 U4DVisibleEntity ()
 Constructor for the class.
 
virtual ~U4DVisibleEntity ()
 Destructor for the class.
 
 U4DVisibleEntity (const U4DVisibleEntity &value)
 Copy constructor for the visible entity.
 
U4DVisibleEntityoperator= (const U4DVisibleEntity &value)
 Copy constructor for the visible entity. More...
 
virtual void updateAllUniforms ()
 
void loadRenderingInformation ()
 Method which loads all rendering information for the entiy.
 
std::string getFragmentShader ()
 get the name of the fragment shader More...
 
U4DRenderEntitygetRenderEntity ()
 
void setPipelineForPass (std::string uPipelineName, int uRenderPassKey)
 
void setPipeline (std::string uPipelineName)
 sets the pipeline for the default final pass More...
 
- Public Member Functions inherited from U4DEngine::U4DEntity
 U4DEntity ()
 Entity Constructor. It creates the entity with the local orientation set to zero and local position set to the origin. The forwad vector is set to (0.0,0.0,-1.0). Parent and Next pointer set to null.
 
 ~U4DEntity ()
 Entity Destructor.
 
 U4DEntity (const U4DEntity &value)
 Entity Copy Constructor.
 
U4DEntityoperator= (const U4DEntity &value)
 Entity Copy Constructor. More...
 
void setName (std::string uName)
 Method which sets the name of the Entity. More...
 
std::string getName ()
 Method which returns the name of the Entity. More...
 
void setEntityType (ENTITYTYPE uType)
 Method which sets the type of the Entity. More...
 
ENTITYTYPE getEntityType ()
 Method which returns the type of the Entity. More...
 
void setLocalSpace (U4DDualQuaternion &uLocalSpace)
 Method which sets the local space of the Entity. More...
 
void setLocalSpace (U4DMatrix4n &uMatrix)
 Method which sets the local space of the Entity. More...
 
U4DDualQuaternion getLocalSpace ()
 
U4DDualQuaternion getAbsoluteSpace ()
 Method which returns the absolute space of the Entity. More...
 
U4DQuaternion getLocalSpaceOrientation ()
 Method which returns the local orientation space of the Entity. More...
 
U4DQuaternion getLocalSpacePosition ()
 Method which returns the local position space of the Entity. More...
 
U4DQuaternion getAbsoluteSpaceOrientation ()
 Method which returns the absolute orientation space of the Entity. More...
 
U4DQuaternion getAbsoluteSpacePosition ()
 Method which returns the absolute position space of the Entity. More...
 
void setLocalSpaceOrientation (U4DQuaternion &uOrientation)
 Method which sets the local space orientation of the Entity. More...
 
void setLocalSpacePosition (U4DQuaternion &uPosition)
 Method which sets the local space position of the Entity. More...
 
U4DVector3n getLocalOrientation ()
 Method which returns the Local orientation of the Entity. More...
 
U4DVector3n getLocalPosition ()
 Method which returns the local position of the Entity. More...
 
U4DVector3n getAbsoluteOrientation ()
 Method which returns the absolute orientation of the Entity. More...
 
U4DVector3n getAbsolutePosition ()
 Method which returns the absolute position of the Entity. More...
 
U4DVector3n getEntityForwardVector ()
 Method which returns the forwad vector of the Entity. More...
 
void setEntityForwardVector (U4DVector3n &uForwardVector)
 Method which sets the forward vectof of the Entity. The default value is (0.0,0.0,-1.0) More...
 
U4DMatrix3n getAbsoluteMatrixOrientation ()
 Method which returns the absolute orientation of the Entity. More...
 
U4DMatrix3n getLocalMatrixOrientation ()
 Method which returns the local orientation of the Entity. More...
 
void translateTo (U4DVector3n &translation)
 Method which translates entity to a new position. More...
 
void translateTo (float x, float y, float z)
 Method which translates entity to a new position. More...
 
void translateTo (U4DVector2n &translation)
 Method which translates entity to a new position. More...
 
void translateBy (float x, float y, float z)
 Method which translates entity by certain amount. More...
 
void translateBy (U4DVector3n &translation)
 Method which translates entity by a certain amount. More...
 
void rotateTo (U4DQuaternion &rotation)
 Method which rotates entity to a new orientation. More...
 
void rotateBy (U4DQuaternion &rotation)
 Method which rotates entity by a certain amount. More...
 
void rotateTo (float angle, U4DVector3n &axis)
 Method which rotates entity to a new orientation. More...
 
void rotateBy (float angle, U4DVector3n &axis)
 Method which rotates entity by certain amount. More...
 
void rotateTo (float angleX, float angleY, float angleZ)
 Method which rotates entity to a new orientation. More...
 
void rotateBy (float angleX, float angleY, float angleZ)
 Method which rotates entity by a certain amount. More...
 
void rotateAboutAxis (float angle, U4DVector3n &axisOrientation, U4DVector3n &axisPosition)
 Method which rotates entity about an axis. More...
 
void rotateAboutAxis (U4DQuaternion &uOrientation, U4DVector3n &axisPosition)
 Method which rotates entity about an axis. More...
 
void setZDepth (int uZDepth)
 Loads all rendering information for the entiy ‍/ virtual void loadRenderingInformation(){};. More...
 
int getZDepth ()
 Gets the z-depth value used for rendering ordering. More...
 
virtual bool changeState (INPUTELEMENTACTION uInputAction, U4DVector2n uPosition)
 
- Public Member Functions inherited from U4DEngine::U4DEntityNode< U4DEntity >
 U4DEntityNode ()
 Constructor for the class.
 
 U4DEntityNode (std::string uNodeName)
 
 ~U4DEntityNode ()
 Destructor for the class.
 
void addChild (U4DEntity *uChild)
 Method which adds a child node to a scenegraph. More...
 
void addChild (U4DEntity *uChild, U4DEntity *uNext)
 
void addChild (U4DEntity *uChild, int uZDepth)
 Method which adds a child entity to a scenegraph at a particular location. More...
 
void removeChild (U4DEntity *uChild)
 Method which removes a child node from the scenegraph. More...
 
void changeLastDescendant (U4DEntity *uNewLastDescendant)
 Method which changes the node's last descendant in the scenegraph. More...
 
U4DEntitygetFirstChild ()
 Method which returns the node's first child in the scenegraph. More...
 
U4DEntitygetLastChild ()
 Method which returns the node's last child in the scenegraph. More...
 
U4DEntitygetNextSibling ()
 Method which returns the node's next sibling in the scenegraph. More...
 
U4DEntitygetPrevSibling ()
 Method which returns the node's previous sibling in the scenegraph. More...
 
U4DEntityprevInPreOrderTraversal ()
 Method which returns the node's previous sibling in pre-order traversal order. More...
 
U4DEntitynextInPreOrderTraversal ()
 Method which returns the node's next pointer in pre-order traversal order. More...
 
bool isLeaf ()
 Method which returns true if the node represents a leaf node in the scenegraph. More...
 
bool isRoot ()
 Method which returns true if the node represents a root node in the scenegraph. More...
 
U4DEntitygetParent ()
 Gets the parent to the entity. More...
 
U4DEntitygetRootParent ()
 Gets the root parent (top parent in the scenegraph) of the entity. More...
 
U4DEntitysearchChild (std::string uName)
 

Public Attributes

U4DVertexData bodyCoordinates
 Object which contains attribute data such as vertices, and uv-coordinates.
 
U4DTextureData textureInformation
 Object which contains texture information.
 
U4DEngine::PARTICLESYSTEMDATA particleSystemData
 structure containing information about the particle, emitter and particle system
 
- Public Attributes inherited from U4DEngine::U4DVisibleEntity
U4DRenderEntityrenderEntity
 pointer to the rendering entity
 
- Public Attributes inherited from U4DEngine::U4DEntity
U4DDualQuaternion localSpace
 Local Space of the entity.
 
U4DDualQuaternion absoluteSpace
 Absolute Space of the entity.
 
U4DTransformationtransformation
 U4DTransformation object pointer in charge of translating/rotating the entity.
 
U4DVector3n entityForwardVector
 Forward vector of the entity. This is used to compute the view-direction vector.
 
int zDepth
 z-depth used for rendering ordering
 
- Public Attributes inherited from U4DEngine::U4DEntityNode< U4DEntity >
U4DEntityparent
 Tree parent pointer.
 
U4DEntityprevSibling
 Tree previous sibling pointer.
 
U4DEntitynext
 Tree next pointer.
 
U4DEntitylastDescendant
 Tree last descendant pointer.
 

Additional Inherited Members

- Protected Attributes inherited from U4DEngine::U4DEntity
U4DVector3n localOrientation
 Entity local orientation.
 
U4DVector3n localPosition
 Entity local position.
 
U4DVector3n absoluteOrientation
 Entity absolute orientation.
 
U4DVector3n absolutePosition
 Entity absolute position.
 

Detailed Description

The U4DParticleSystem class is in charge of creating 3D particles.

Member Function Documentation

◆ getEnableAdditiveRendering()

bool U4DEngine::U4DParticleSystem::getEnableAdditiveRendering ( )

gets whether additive rendering was enabled

If additive rendering is enabled, then the particles will blend their colors among each other

Returns
true if additive rendering is enabled

◆ getEnableNoise()

bool U4DEngine::U4DParticleSystem::getEnableNoise ( )

gets if Noise was enabled

Noise is created using the Perlin Noise function

Returns
true if Noise is enabled

◆ getHasTexture()

bool U4DEngine::U4DParticleSystem::getHasTexture ( )

gets whether or not the particle system has a texture for the particles

Returns
true if texture is provided

◆ getMaxNumberOfParticles()

int U4DEngine::U4DParticleSystem::getMaxNumberOfParticles ( )

Gets the current maximum number of particles the system will render.

Returns
max number of particles

◆ getNoiseDetail()

float U4DEngine::U4DParticleSystem::getNoiseDetail ( )

gets the Noise Detail factor

The higher the noise detail, the more noise is generated in the texture. Value ranges are [1,16]. Defaut is 4.0

Returns
Current noise factor

◆ getNumberOfEmittedParticles()

int U4DEngine::U4DParticleSystem::getNumberOfEmittedParticles ( )

gets the number of emitted particles

Returns
number of emitted particles

◆ getParticleRenderDataContainer()

std::vector< PARTICLERENDERDATA > U4DEngine::U4DParticleSystem::getParticleRenderDataContainer ( )

gets the vector containing the 3D particle data such as position, start color, end color, etc

Returns
vector with 3D particle data

◆ initializeParticleEmitter()

void U4DEngine::U4DParticleSystem::initializeParticleEmitter ( PARTICLESYSTEMDATA uParticleSystemData)

Initializes the particle emitter with data such as start color, end color, emition angle, speed, particle life, etc.

Parameters
uParticleSystemDataReference to the particle system data object

◆ loadParticle()

bool U4DEngine::U4DParticleSystem::loadParticle ( const char *  uParticleAssetFile)

loads the particles parameter. It loads the data from Particle Designer.

Parameters
uParticleAssetFileU4D file containing the particle data. You must export this file from particle designer
Returns
true if the data was read correctly

◆ removeAllParticles()

void U4DEngine::U4DParticleSystem::removeAllParticles ( )

removes all particles

The engine removes all particles from the rendering process

◆ removeDeadParticle()

void U4DEngine::U4DParticleSystem::removeDeadParticle ( )

Removes dead particles.

Once a particle is dead, the engine removes it from its rendering process

◆ render()

void U4DEngine::U4DParticleSystem::render ( id< MTLRenderCommandEncoder >  uRenderEncoder)
virtual

Renders the current entity.

Updates the space matrix, any rendering flags. It encodes the pipeline, buffers and issues the draw command

Parameters
uRenderEncoderMetal encoder object for the current entity

Reimplemented from U4DEngine::U4DVisibleEntity.

◆ setEnableAdditiveRendering()

void U4DEngine::U4DParticleSystem::setEnableAdditiveRendering ( bool  uValue)

sets whether additive rendering should be enabled.

If additive rendering is enabled, then the particles will blend their colors among each other. Default is true

Parameters
uValuetrue or false. true means additive rendering is enabled

◆ setEnableNoise()

void U4DEngine::U4DParticleSystem::setEnableNoise ( bool  uValue)

sets if Noise should be enabled

Noise is created using the Perlin Noise function

Parameters
uValuetrue if Noise is enabled

◆ setHasTexture()

void U4DEngine::U4DParticleSystem::setHasTexture ( bool  uValue)

sets whether or not the particle system has a texture for the particles

Parameters
uValuetrue if texture is provided

◆ setMaxNumberOfParticles()

void U4DEngine::U4DParticleSystem::setMaxNumberOfParticles ( int  uMaxNumberOfParticles)

Sets the maximum number of particles to render.

Parameters
uMaxNumberOfParticlesmax number of particles

◆ setNoiseDetail()

void U4DEngine::U4DParticleSystem::setNoiseDetail ( float  uNoiseDetail)

sets the Noise Detail factor

The higher the noise detail, the more noise is generated in the texture. Value ranges are [1,16]. Defaut is 4.0

Parameters
uNoiseDetailthe allowed values ranges are [1,16]. Defaut is 4.0

◆ setParticleDimension()

void U4DEngine::U4DParticleSystem::setParticleDimension ( float  uWidth,
float  uHeight 
)

sets the particle dimension

Parameters
uWidthwidth of the particle
uHeightheight of the particle

◆ update()

void U4DEngine::U4DParticleSystem::update ( double  dt)
virtual

Uupdates the state of the particle system.

Parameters
dtTime-step value

Reimplemented from U4DEngine::U4DVisibleEntity.

◆ viewInDirection()

void U4DEngine::U4DParticleSystem::viewInDirection ( U4DVector3n uDestinationPoint)
virtual

sets the view direction the particle should face

Parameters
uDestinationPointvector to face to

Reimplemented from U4DEngine::U4DEntity.