载入中...
搜索中...
未找到

Runtime instance of a versioned, multi-emitter particle effect asset. 更多...

#include <ParticleEffect.h>

Public 成员函数

 ~ParticleEffect ()
 Destroy the group and every emitter it owns.
 
 ParticleEffect (const ParticleEffect &)=delete
 
ParticleEffect & operator= (const ParticleEffect &)=delete
 
int getVersion () const
 Return the asset schema version.
 
std::string getSourcePath () const
 Return the source file path, or empty text for an in-memory asset.
 
int getEmitterCount () const
 Return the number of named emitter layers.
 
std::string getEmitterName (int index) const
 Return a stable layer name by index, or empty text.
 
ParticleEmitter * getEmitter (int index) const
 Return an emitter layer by index, or null.
 
ParticleEmitter * getEmitterByName (const std::string &name) const
 Return an emitter layer by name, or null.
 
std::span< const ParticleEffectEventRoute > eventRoutes () const
 Return authored event routes (borrowed snapshot of asset data).
 
const ParticleEffectTimeline & timeline () const
 Return authored timeline controls.
 
float getTimelineSeconds () const
 Return the current effect-local timeline clock in seconds.
 
bool isTimelinePlaying () const
 Return true while the effect timeline is advancing.
 
Result< Duration > naturalDuration () const
 Calculate when every enabled finite emitter and its particles have ended.
 
Result< void > reloadFromText (const std::string &json)
 Atomically replace this instance from JSON text.
 
Result< void > reloadFromFile (const std::string &path={})
 Atomically reload from sourcePath, or an explicit path override.
 
Result< void > advanceTimeline (const SimulationStep &step)
 Advance the effect-local timeline and fire due cues.
 
void updateTimeline (float dt)
 Legacy seconds facade for timeline cues; consumes Result internally.
 
void setPosition (float x, float y)
 Set the group transform origin in world space.
 
float getX () const
 Return the group origin X coordinate.
 
float getY () const
 Return the group origin Y coordinate.
 
void setRotation (float radians)
 Rotate local offsets and emitter directions in radians.
 
float getRotation () const
 Return the group rotation in radians.
 
void setScale (float scale)
 Scale local emitter offsets.
 
float getScale () const
 Return the local-offset scale.
 
void setLayer (int layer)
 Offset all emitter render layers while preserving asset-local ordering.
 
int getLayer () const
 Return the group render-layer offset.
 
void setVisible (bool visible)
 Set visibility for every emitter layer.
 
bool isVisible () const
 Return the group visibility state.
 
void start ()
 Start every enabled emitter and the effect timeline clock.
 
void stop ()
 Stop every emitter timeline and the effect clock.
 
void pause ()
 Pause every emitter timeline and the effect clock.
 
void reset ()
 Reset every emitter timeline, clear particles, and rewind cues.
 
bool emit (const std::string &emitterName, int count)
 Emit a manual burst from one named layer.
 
void setFloatParameter (const std::string &name, float value)
 Set one gameplay parameter on every layer that declares or binds it.
 
float getFloatParameter (const std::string &name) const
 Return an effect parameter value, or zero when unknown.
 
bool hasFloatParameter (const std::string &name) const
 Return true when the asset declares the parameter.
 

静态 Public 成员函数

static ParticleEffect * fromText (const std::string &json, const std::string &sourcePath, std::string *error=nullptr)
 Parse and instantiate an effect asset from JSON text.
 
static ParticleEffect * fromFile (const std::string &path, std::string *error=nullptr)
 Read, parse, and instantiate an effect asset.
 
static Result< ParticleEffect * > tryFromText (const std::string &json, const std::string &sourcePath={})
 Parse an effect asset and return a structured Result.
 
static Result< ParticleEffect * > tryFromFile (const std::string &path)
 Load an effect asset file and return a structured Result.
 
static void tickRegisteredTimelines (float dt)
 Advance every effect that auto-registered a playing timeline.
 
static Result< void > advanceRegisteredTimelines (const SimulationStep &step)
 Advance registered timelines from an injected scheduler step.
 

静态 Public 属性

static constexpr int kMaxSupportedVersion = 2
 Highest schema version accepted by this build.
 
static constexpr int kMinSupportedVersion = 1
 Lowest schema version accepted by this build.
 

详细描述

Runtime instance of a versioned, multi-emitter particle effect asset.

The instance owns every emitter created by the asset. Its transform, playback, visibility, layer, exposed parameters, event routes, and timeline controls are applied to the group as a unit.

@ownership Caller owns the ParticleEffect; it owns every layer emitter. @thread Owner thread only. Not reentrant from particle/sub-emitter callbacks.

在文件 ParticleEffect.h 第 68 行定义.

构造及析构函数说明

◆ ~ParticleEffect()

eve::particles::ParticleEffect::~ParticleEffect ( )

Destroy the group and every emitter it owns.

在文件 ParticleEffect.cpp 第 305 行定义.

引用了 layer.

◆ ParticleEffect()

eve::particles::ParticleEffect::ParticleEffect ( const ParticleEffect &  )
delete

成员函数说明

◆ advanceRegisteredTimelines()

Result< void > eve::particles::ParticleEffect::advanceRegisteredTimelines ( const SimulationStep &  step)
static

Advance registered timelines from an injected scheduler step.

在文件 ParticleEffect.cpp 第 525 行定义.

引用了 advanceTimeline(), eve::Applied, effect, eve::Result< void >::ignore(), eve::NoOp, step, eve::Status::success() , 以及 eve::Result< T >::success().

被这些函数引用 eve::particles::Particles::advance().

◆ advanceTimeline()

Result< void > eve::particles::ParticleEffect::advanceTimeline ( const SimulationStep &  step)

Advance the effect-local timeline and fire due cues.

参数
stepInjected scheduler step; invalid durations are rejected.

在文件 ParticleEffect.cpp 第 471 行定义.

引用了 eve::Applied, eve::particles::ParticleEffectTimeline::duration, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::particles::ParticleEffectTimeline::looping, eve::NoOp, previous, step, eve::Status::success() , 以及 eve::Result< T >::success().

被这些函数引用 advanceRegisteredTimelines() , 以及 updateTimeline().

◆ emit()

bool eve::particles::ParticleEffect::emit ( const std::string &  emitterName,
int  count 
)

Emit a manual burst from one named layer.

在文件 ParticleEffect.cpp 第 682 行定义.

引用了 count, emitter , 以及 getEmitterByName().

◆ eventRoutes()

std::span< const ParticleEffectEventRoute > eve::particles::ParticleEffect::eventRoutes ( ) const

Return authored event routes (borrowed snapshot of asset data).

在文件 ParticleEffect.cpp 第 385 行定义.

◆ fromFile()

ParticleEffect * eve::particles::ParticleEffect::fromFile ( const std::string &  path,
std::string *  error = nullptr 
)
static

Read, parse, and instantiate an effect asset.

备注
Compatibility facade; prefer tryFromFile for structured errors.

在文件 ParticleEffect.cpp 第 329 行定义.

引用了 error, path , 以及 tryFromFile().

被这些函数引用 eve::particles::Particles::newEffectFromFile().

◆ fromText()

ParticleEffect * eve::particles::ParticleEffect::fromText ( const std::string &  json,
const std::string &  sourcePath,
std::string *  error = nullptr 
)
static

Parse and instantiate an effect asset from JSON text.

备注
Compatibility facade; prefer tryFromText for structured errors.

在文件 ParticleEffect.cpp 第 313 行定义.

引用了 error, sourcePath , 以及 tryFromText().

被这些函数引用 eve::particles::Particles::newEffectFromText().

◆ getEmitter()

ParticleEmitter * eve::particles::ParticleEffect::getEmitter ( int  index) const

Return an emitter layer by index, or null.

在文件 ParticleEffect.cpp 第 375 行定义.

引用了 emitter, getEmitterCount() , 以及 index.

◆ getEmitterByName()

ParticleEmitter * eve::particles::ParticleEffect::getEmitterByName ( const std::string &  name) const

Return an emitter layer by name, or null.

在文件 ParticleEffect.cpp 第 380 行定义.

引用了 layer , 以及 value.

被这些函数引用 emit().

◆ getEmitterCount()

int eve::particles::ParticleEffect::getEmitterCount ( ) const

Return the number of named emitter layers.

在文件 ParticleEffect.cpp 第 368 行定义.

被这些函数引用 getEmitter() , 以及 getEmitterName().

◆ getEmitterName()

std::string eve::particles::ParticleEffect::getEmitterName ( int  index) const

Return a stable layer name by index, or empty text.

在文件 ParticleEffect.cpp 第 370 行定义.

引用了 getEmitterCount(), index , 以及 name.

◆ getFloatParameter()

float eve::particles::ParticleEffect::getFloatParameter ( const std::string &  name) const

Return an effect parameter value, or zero when unknown.

在文件 ParticleEffect.cpp 第 695 行定义.

引用了 name.

◆ getLayer()

int eve::particles::ParticleEffect::getLayer ( ) const
inline

Return the group render-layer offset.

在文件 ParticleEffect.h 第 173 行定义.

◆ getRotation()

float eve::particles::ParticleEffect::getRotation ( ) const
inline

Return the group rotation in radians.

在文件 ParticleEffect.h 第 165 行定义.

◆ getScale()

float eve::particles::ParticleEffect::getScale ( ) const
inline

Return the local-offset scale.

在文件 ParticleEffect.h 第 169 行定义.

◆ getSourcePath()

std::string eve::particles::ParticleEffect::getSourcePath ( ) const
inline

Return the source file path, or empty text for an in-memory asset.

在文件 ParticleEffect.h 第 102 行定义.

◆ getTimelineSeconds()

float eve::particles::ParticleEffect::getTimelineSeconds ( ) const
inline

Return the current effect-local timeline clock in seconds.

在文件 ParticleEffect.h 第 117 行定义.

◆ getVersion()

int eve::particles::ParticleEffect::getVersion ( ) const
inline

Return the asset schema version.

在文件 ParticleEffect.h 第 100 行定义.

◆ getX()

float eve::particles::ParticleEffect::getX ( ) const
inline

Return the group origin X coordinate.

在文件 ParticleEffect.h 第 159 行定义.

◆ getY()

float eve::particles::ParticleEffect::getY ( ) const
inline

Return the group origin Y coordinate.

在文件 ParticleEffect.h 第 161 行定义.

◆ hasFloatParameter()

bool eve::particles::ParticleEffect::hasFloatParameter ( const std::string &  name) const

Return true when the asset declares the parameter.

在文件 ParticleEffect.cpp 第 700 行定义.

引用了 name.

◆ isTimelinePlaying()

bool eve::particles::ParticleEffect::isTimelinePlaying ( ) const
inline

Return true while the effect timeline is advancing.

在文件 ParticleEffect.h 第 119 行定义.

◆ isVisible()

bool eve::particles::ParticleEffect::isVisible ( ) const
inline

Return the group visibility state.

在文件 ParticleEffect.h 第 177 行定义.

◆ naturalDuration()

Result< Duration > eve::particles::ParticleEffect::naturalDuration ( ) const

Calculate when every enabled finite emitter and its particles have ended.

返回
Maximum non-looping lifetime, or one loop period when every enabled layer loops.
备注
Owner-thread-only. Unbounded emitters return Unsupported instead of a guessed duration. When an authored timeline duration is set, the larger of the two values is returned.

在文件 ParticleEffect.cpp 第 389 行定义.

引用了 duration, eve::particles::ParticleEffectTimeline::duration, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Duration::fromSeconds(), eve::InvalidArgument, layer, eve::NotFound, eve::Result< T >::success() , 以及 eve::Unsupported.

◆ operator=()

ParticleEffect & eve::particles::ParticleEffect::operator= ( const ParticleEffect &  )
delete

◆ pause()

void eve::particles::ParticleEffect::pause ( )

Pause every emitter timeline and the effect clock.

在文件 ParticleEffect.cpp 第 668 行定义.

引用了 layer.

◆ reloadFromFile()

Result< void > eve::particles::ParticleEffect::reloadFromFile ( const std::string &  path = {})

Atomically reload from sourcePath, or an explicit path override.

备注
On failure the live emitters and clock are unchanged.

在文件 ParticleEffect.cpp 第 431 行定义.

引用了 eve::Applied, eve::Result< T >::failure(), path, eve::Status::success(), eve::Result< T >::success() , 以及 tryFromFile().

◆ reloadFromText()

Result< void > eve::particles::ParticleEffect::reloadFromText ( const std::string &  json)

Atomically replace this instance from JSON text.

备注
On failure the live emitters and clock are unchanged. On success world transform, visibility, and layer offset are preserved.

在文件 ParticleEffect.cpp 第 423 行定义.

引用了 eve::Applied, eve::Result< T >::failure(), eve::Status::success(), eve::Result< T >::success() , 以及 tryFromText().

◆ reset()

void eve::particles::ParticleEffect::reset ( )

Reset every emitter timeline, clear particles, and rewind cues.

在文件 ParticleEffect.cpp 第 674 行定义.

引用了 layer.

◆ setFloatParameter()

void eve::particles::ParticleEffect::setFloatParameter ( const std::string &  name,
float  value 
)

Set one gameplay parameter on every layer that declares or binds it.

在文件 ParticleEffect.cpp 第 689 行定义.

引用了 layer, name , 以及 value.

◆ setLayer()

void eve::particles::ParticleEffect::setLayer ( int  layer)

Offset all emitter render layers while preserving asset-local ordering.

在文件 ParticleEffect.cpp 第 641 行定义.

引用了 layer.

◆ setPosition()

void eve::particles::ParticleEffect::setPosition ( float  x,
float  y 
)

Set the group transform origin in world space.

在文件 ParticleEffect.cpp 第 625 行定义.

引用了 x , 以及 y.

◆ setRotation()

void eve::particles::ParticleEffect::setRotation ( float  radians)

Rotate local offsets and emitter directions in radians.

在文件 ParticleEffect.cpp 第 631 行定义.

◆ setScale()

void eve::particles::ParticleEffect::setScale ( float  scale)

Scale local emitter offsets.

在文件 ParticleEffect.cpp 第 636 行定义.

引用了 scale.

◆ setVisible()

void eve::particles::ParticleEffect::setVisible ( bool  visible)

Set visibility for every emitter layer.

在文件 ParticleEffect.cpp 第 646 行定义.

引用了 layer , 以及 visible.

◆ start()

void eve::particles::ParticleEffect::start ( )

Start every enabled emitter and the effect timeline clock.

在文件 ParticleEffect.cpp 第 651 行定义.

引用了 eve::Result< void >::ignore() , 以及 layer.

◆ stop()

void eve::particles::ParticleEffect::stop ( )

Stop every emitter timeline and the effect clock.

在文件 ParticleEffect.cpp 第 661 行定义.

引用了 layer.

◆ tickRegisteredTimelines()

void eve::particles::ParticleEffect::tickRegisteredTimelines ( float  dt)
static

Advance every effect that auto-registered a playing timeline.

在文件 ParticleEffect.cpp 第 518 行定义.

引用了 effect.

被这些函数引用 eve::particles::Particles::update().

◆ timeline()

const ParticleEffectTimeline & eve::particles::ParticleEffect::timeline ( ) const
inline

Return authored timeline controls.

在文件 ParticleEffect.h 第 115 行定义.

◆ tryFromFile()

Result< ParticleEffect * > eve::particles::ParticleEffect::tryFromFile ( const std::string &  path)
static

Load an effect asset file and return a structured Result.

在文件 ParticleEffect.cpp 第 349 行定义.

引用了 eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), eve::InvalidArgument, eve::NotFound, path , 以及 tryFromText().

被这些函数引用 fromFile() , 以及 reloadFromFile().

◆ tryFromText()

Result< ParticleEffect * > eve::particles::ParticleEffect::tryFromText ( const std::string &  json,
const std::string &  sourcePath = {} 
)
static

Parse an effect asset and return a structured Result.

在文件 ParticleEffect.cpp 第 345 行定义.

引用了 sourcePath.

被这些函数引用 fromText(), reloadFromText() , 以及 tryFromFile().

◆ updateTimeline()

void eve::particles::ParticleEffect::updateTimeline ( float  dt)

Legacy seconds facade for timeline cues; consumes Result internally.

备注
Prefer advanceTimeline. No-op when the timeline is stopped or paused.

在文件 ParticleEffect.cpp 第 506 行定义.

引用了 advanceTimeline(), eve::SimulationStep::delta, duration, eve::Duration::fromSeconds(), eve::Result< void >::ignore() , 以及 step.

类成员变量说明

◆ kMaxSupportedVersion

constexpr int eve::particles::ParticleEffect::kMaxSupportedVersion = 2
staticconstexpr

Highest schema version accepted by this build.

在文件 ParticleEffect.h 第 71 行定义.

◆ kMinSupportedVersion

constexpr int eve::particles::ParticleEffect::kMinSupportedVersion = 1
staticconstexpr

Lowest schema version accepted by this build.

在文件 ParticleEffect.h 第 73 行定义.


该类的文档由以下文件生成: