Wasabi
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
WParticles Class Reference

#include <WParticles.hpp>

Inheritance diagram for WParticles:
WBase WOrientation WMaterialsStore

Public Member Functions

virtual std::string GetTypeName () const override
 
virtual void SetID (uint32_t newID) override
 
virtual void SetName (std::string newName) override
 
WError Create (uint32_t maxParticles=5000, WParticlesBehavior *behavior=nullptr)
 
WParticlesBehaviorGetBehavior () const
 
bool WillRender (class WRenderTarget *rt)
 
void Render (class WRenderTarget *rt, class WMaterial *material=nullptr)
 
void SetPriority (uint32_t priority)
 
uint32_t GetPriority () const
 
W_DEFAULT_PARTICLE_EFFECT_TYPE GetEffectType () const
 
void Show ()
 
void Hide ()
 
bool Hidden () const
 
void EnableFrustumCulling ()
 
void DisableFrustumCulling ()
 
bool InCameraView (class WCamera *cam)
 
WMatrix GetWorldMatrix ()
 
bool UpdateLocals ()
 
virtual bool Valid () const override
 
virtual void OnStateChange (STATE_CHANGE_TYPE type) override
 
- Public Member Functions inherited from WBase
 WBase (class Wasabi *const app, uint32_t ID=0)
 
uint32_t GetID () const
 
std::string GetName () const
 
class WasabiGetAppPtr () const
 
void AddReference ()
 
void RemoveReference ()
 
- Public Member Functions inherited from WOrientation
void SetPosition (float x, float y, float z)
 
void SetPosition (const WVector3 pos)
 
void Point (float x, float y, float z)
 
void Point (WVector3 target)
 
void SetAngle (WQuaternion quat)
 
void SetToRotation (const WOrientation *const device)
 
void SetULRVectors (WVector3 up, WVector3 look, WVector3 right)
 
void SetToTransformation (WMatrix mtx)
 
void Yaw (float angle)
 
void Roll (float angle)
 
void Pitch (float angle)
 
void Move (float units)
 
void Strafe (float units)
 
void Fly (float units)
 
float GetPositionX () const
 
float GetPositionY () const
 
float GetPositionZ () const
 
WVector3 GetPosition () const
 
float GetAngleX () const
 
float GetAngleY () const
 
float GetAngleZ () const
 
WQuaternion GetRotation () const
 
WVector3 GetUVector () const
 
WVector3 GetLVector () const
 
WVector3 GetRVector () const
 
virtual void SetBindingMatrix (WMatrix mtx)
 
void RemoveBinding ()
 
WMatrix GetBindingMatrix () const
 
bool IsBound () const
 
WMatrix ComputeTransformation () const
 
WMatrix ComputeInverseTransformation () const
 
- Public Member Functions inherited from WMaterialsStore
void AddEffect (class WEffect *effect, uint32_t bindingSet=0)
 
void RemoveEffect (class WEffect *effect)
 
void RemoveEffect (class WMaterial *material)
 
void ClearEffects ()
 
class WMaterialGetMaterial (class WEffect *effect)
 
class WMaterialCollectionGetMaterials ()
 

Static Public Member Functions

static std::string _GetTypeName ()
 

Protected Member Functions

 WParticles (class Wasabi *const app, W_DEFAULT_PARTICLE_EFFECT_TYPE type, uint32_t ID=0)
 
- Protected Member Functions inherited from WMaterialsStore
void _AddMaterial (class WMaterial *material)
 
virtual void OnMaterialAdded (class WMaterial *newMaterial)
 

Friends

class WParticlesManager
 

Additional Inherited Members

- Protected Attributes inherited from WBase
class Wasabim_app
 
uint32_t m_ID
 
std::string m_name
 
- Protected Attributes inherited from WMaterialsStore
std::unordered_map< class WEffect *, class WMaterial * > m_materialMap
 
class WMaterialCollectionm_materialsCollection
 

Detailed Description

This represents a particles system and is responsible for animating and rendering it.

Member Function Documentation

◆ _GetTypeName()

static std::string WParticles::_GetTypeName ( )
static

Returns "Particles" string.

Returns
Returns "Particles" string

◆ Create()

WError WParticles::Create ( uint32_t  maxParticles = 5000,
WParticlesBehavior behavior = nullptr 
)

Initializes the particle system. This must be called for a WParticles object to be Valid().

Parameters
maxParticlesMaximum number of particles that the system can render simultaneously. Pass 0 to free resources and uninitialize the system
behaviorBehavior object for this system, pass nullptr to use WDefaultParticleBehavior
Returns
Error code, see WError.h

◆ DisableFrustumCulling()

void WParticles::DisableFrustumCulling ( )

Disables frustum culling, see EnableFrustumCulling() for more info.

◆ EnableFrustumCulling()

void WParticles::EnableFrustumCulling ( )

Enables frustum culling. Frustum culling causes the particle system to only be rendered if part of its geometry is within the viewing frustum of the camera.

◆ GetBehavior()

WParticlesBehavior* WParticles::GetBehavior ( ) const

Retrieves the behavior object for this particle system.

Returns
The particle system's behavior

◆ GetEffectType()

W_DEFAULT_PARTICLE_EFFECT_TYPE WParticles::GetEffectType ( ) const
Returns
the effect type of this particles system

◆ GetPriority()

uint32_t WParticles::GetPriority ( ) const

Retrieves the current priority of the sprite. See SetPriority().

Returns
The current priority of the sprite

◆ GetTypeName()

virtual std::string WParticles::GetTypeName ( ) const
overridevirtual

This function must be implemented by a child class. This is used for debugging, in which a class should return its name.

Returns
The name of the class

Implements WBase.

◆ GetWorldMatrix()

WMatrix WParticles::GetWorldMatrix ( )

Retrieves the world matrix for the particle system.

Returns
World matrix for the particle system

◆ Hidden()

bool WParticles::Hidden ( ) const

Checks if the particle system is hidden.

Returns
true if the particle system is hidden, false otherwise

◆ Hide()

void WParticles::Hide ( )

Hides the particle system.

◆ InCameraView()

bool WParticles::InCameraView ( class WCamera cam)

Checks if the particle system appears anywhere in the view of the camera

Parameters
camCamera to check against
Returns
true if the particle system is in the viewing frustum of cam, false otherwise

◆ OnStateChange()

virtual void WParticles::OnStateChange ( STATE_CHANGE_TYPE  type)
overridevirtual

A callback called by this class when the entity changes its position or orientation.

Parameters
typeOrientation change type

Reimplemented from WOrientation.

◆ Render()

void WParticles::Render ( class WRenderTarget rt,
class WMaterial material = nullptr 
)

Renders the particle system to the given render target. If a material is provided, the following variables will be set:

  • "worldMatrix": World matrix of the particles
  • "viewMatrix": View matrix of the camera of rt
  • "projectionMatrix": Projection matrix of the camera of rt @params rt Render target to render to
    Parameters
    materialMaterial to set its variables and bind (if provided)

◆ SetID()

virtual void WParticles::SetID ( uint32_t  newID)
overridevirtual

Sets the ID of this object and notifies its manager.

Parameters
newIDNew ID

Implements WBase.

◆ SetName()

virtual void WParticles::SetName ( std::string  newName)
overridevirtual

Sets the name of this object.

Parameters
nameNew name for the object

Implements WBase.

◆ SetPriority()

void WParticles::SetPriority ( uint32_t  priority)

Sets the priority of the particles. Particles with higher priority will render on top of those with lower priority (i.e. renders after after).

Parameters
priorityNew priority to set

◆ Show()

void WParticles::Show ( )

Shows the particle system so that it can be rendered.

◆ UpdateLocals()

bool WParticles::UpdateLocals ( )

Updates the world matrix of the particle system.

Returns
true if the matrix has changed, false otherwise

◆ Valid()

virtual bool WParticles::Valid ( ) const
overridevirtual
Returns
Whether or not the particles system will render properly

Implements WBase.

◆ WillRender()

bool WParticles::WillRender ( class WRenderTarget rt)

Checks whether a call to Render() will cause any rendering (draw call) to happen.


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