Skylicht Engine
Loading...
Searching...
No Matches
Skylicht::Particle::CMeshParticleRenderer Class Reference

Renderer that uses hardware instancing to draw 3D meshes as particles. More...

#include <ParticleSystem/Particles/Renderers/CMeshParticleRenderer.h>

Inheritance diagram for Skylicht::Particle::CMeshParticleRenderer:
Skylicht::Particle::IRenderer Skylicht::Particle::CParticleSerializable

Public Types

enum  EBaseShaderType { Soild , SoildColor , Additive , Transparent }
 Blending modes for mesh particles. More...

Public Member Functions

virtual void getParticleBuffer (IMeshBuffer *buffer)
 Internal: merges prefab meshes into a single buffer.
virtual CObjectSerializablecreateSerializable ()
 Creates a serializable object for property editing or saving.
virtual void loadSerializable (CObjectSerializable *object)
 Loads properties from a serializable object.
bool loadMesh (const char *meshFile)
 Loads a 3D model (FBX, DAE, OBJ) to be used as a particle.
void setVelocityDirection (bool b)
 Enables/disables velocity-based orientation.
void setMaterialType (EBaseShaderType shader)
 Configures blending mode and shader.
const SColorgetDissolveColor ()
 Gets dissolve edge color.
void setDissolveColor (const SColor &c)
 Sets dissolve edge color.
core::vector3dfgetNoiseScale ()
 Gets dissolve noise scale.
void setNoiseScale (const core::vector3df &n)
 Sets dissolve noise scale.
float getDissolveCutoff ()
 Gets current dissolve progression.
void setDissolveCutoff (float d)
 Sets dissolve progression (0.0 to 1.0).
Public Member Functions inherited from Skylicht::Particle::IRenderer
 IRenderer (ERenderer type)
ERenderer getType ()
 Gets renderer type enum.
CMaterialgetMaterial ()
 Gets active material (custom or default).
CMaterialgetDefaultMaterial ()
 Gets default internal material.
CMaterialgetCustomMaterial ()
 Gets custom material if set.
void setTexturePath (const char *path)
 Loads and sets the main texture.
void setTexture (int slot, ITexture *texture)
 Sets texture for a specific slot.
void setEmission (bool b)
 Enables/disables emission.
bool isEmission ()
 Checks emission status.
bool useInstancing ()
 Checks instancing support.
void setEmissionIntensity (float b)
 Sets emission intensity.
float getEmissionIntensity ()
 Gets emission intensity.
bool needUpdateMesh ()
 Checks if internal mesh requires rebuilding.
const wchar_t * getName ()
 Gets display name.
void setAtlas (u32 x, u32 y)
 Configures texture atlas dimensions.
u32 getAtlasX ()
 Gets atlas column count.
u32 getAtlasY ()
 Gets atlas row count.
u32 getTotalFrames ()
 Gets total frames in atlas.
float getFrameWidth ()
 Gets UV width of a single frame.
float getFrameHeight ()
 Gets UV height of a single frame.

Protected Member Functions

void initFromPrefab (CEntityPrefab *prefab)
 Internal: extracts static meshes from a prefab.
void addMesh (const core::matrix4 &transform, CMesh *mesh)
 Internal: adds a transformed mesh to the instancing buffer.

Protected Attributes

std::string m_meshFile
 Path to the source mesh file.
IMeshBufferm_meshBuffer
 Aggregated mesh buffer for instancing.
EBaseShaderType m_baseShaderType
 Current shader mode.
core::vector3df m_noiseScale
 Scale for dissolve noise effect.
SColor m_dissolveColor
 Edge color for dissolve effect.
float m_dissolve
 Cutoff value for dissolve effect.
bool m_velocityDirection
 Whether to align mesh Z-axis to particle velocity.
Protected Attributes inherited from Skylicht::Particle::IRenderer
ERenderer m_type
 Type of the renderer.
CMaterialm_material
 Default material for the particles.
CMaterialm_customMaterial
 Optional custom material.
bool m_useCustomMaterial
 Whether custom material is enabled.
bool m_useInstancing
 Whether this renderer uses hardware instancing.
bool m_emission
 Whether the particles have emission.
bool m_ztest
 Depth test flag.
float m_emissionIntensity
 Emission intensity multiplier.
std::string m_texturePath
 Primary texture path.
u32 m_atlasNx
 Atlas horizontal frame count.
u32 m_atlasNy
 Atlas vertical frame count.
std::string m_materialPath
 Path to custom material file.
bool m_needUpdateMesh
 Internal: flag to trigger mesh buffer updates.

Additional Inherited Members

Public Attributes inherited from Skylicht::Particle::IRenderer
float SizeX
 Default base scale X.
float SizeY
 Default base scale Y.
float SizeZ
 Default base scale Z.

Detailed Description

Renderer that uses hardware instancing to draw 3D meshes as particles.

Example

Particle::CMeshParticleRenderer *renderer = factory->createMeshParticleRenderer();
renderer->loadMesh("Models/Stone/stone.fbx");
group->setRenderer(renderer);
Renderer that uses hardware instancing to draw 3D meshes as particles.
Definition CMeshParticleRenderer.h:48
bool loadMesh(const char *meshFile)
Loads a 3D model (FBX, DAE, OBJ) to be used as a particle.
void setMaterialType(EBaseShaderType shader)
Configures blending mode and shader.
@ Soild
Definition CMeshParticleRenderer.h:56

Member Enumeration Documentation

◆ EBaseShaderType

Blending modes for mesh particles.

Enumerator
Soild 

Opaque mesh.

SoildColor 

Opaque with vertex color.

Additive 

Additive blending.

Transparent 

Alpha blending.

Member Function Documentation

◆ createSerializable()

virtual CObjectSerializable * Skylicht::Particle::CMeshParticleRenderer::createSerializable ( )
virtual

Creates a serializable object for property editing or saving.

Returns
Pointer to a new CObjectSerializable instance.

Reimplemented from Skylicht::Particle::IRenderer.

◆ getParticleBuffer()

virtual void Skylicht::Particle::CMeshParticleRenderer::getParticleBuffer ( IMeshBuffer * buffer)
virtual

Internal: merges prefab meshes into a single buffer.

Implements Skylicht::Particle::IRenderer.

◆ loadSerializable()

virtual void Skylicht::Particle::CMeshParticleRenderer::loadSerializable ( CObjectSerializable * object)
virtual

Loads properties from a serializable object.

Parameters
objectThe serializable data to load.

Reimplemented from Skylicht::Particle::IRenderer.


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