Swarm::EffectDirectory class

An EffectDirectory is a file that contains one or multiple effect declarations.

They correspond to the .EFFDIR file format. Effect directories contain all the components used (particles, sounds, models, etc) and the effect declarations themselves, along with associations that define an ID for each effect.

Base classes

class IEffectDirectory
class IVirtual
A default interface that provides a virtual destructor, it should only be used internally.

Public functions

void AddRef() pure virtual
void Release() pure virtual
auto func08h() -> bool pure virtual
void func0Ch() pure virtual
void Reset() pure virtual
void func14h() pure virtual
auto AddVisualEffect(Components::VisualEffect* effect) -> int pure virtual
auto AddComponent(int type, Components::IEffectComponent* pComponent) -> int pure virtual
Adds the given IEffectComponent to this directory.
auto GetComponent(int index, int type) -> Components::IEffectComponent* pure virtual
Gets the IEffectComponent that is in the given index in the list of the specified type.
auto AddDescription(int type, Components::IEffectDescription* pDescription) -> int pure virtual
Adds the given IEffectDescription to this directory.
auto GetDescription(int index, int type) -> Components::IEffectDescription* pure virtual
Gets the IEffectDescription that is in the given index in the list of the specified type.
auto func2Ch(int index, int pDst, int) -> size_t pure virtual
auto Read(IO::IStream* pInputStream) -> bool pure virtual
Reads all the effects into this directory from the specified IStream.
auto Write(IO::IStream* pOutputStream) -> bool pure virtual
Writes all the effects of this directory into the specified IStream.
auto Compile() -> bool pure virtual
Deleted method, does nothing.
auto HasEffectName(string& dst, const char* pName) -> bool pure virtual
Tells whether an effect with this name is contained in this directory.
void GetEffectNames(vector<string>& dst, const char* pPattern = nullptr) pure virtual
Puts all the effect names contained in this directory into the given vector.
auto GetVisualEffect(size_t index) -> Components::VisualEffect*
auto GetEffectIndex(uint32_t instanceID, uint32_t groupID) -> int

Protected variables

int mnRefCount
vector<vector<intrusive_ptr<Components::IEffectComponent>>> mComponents
vector<vector<intrusive_ptr<Components::IEffectDescription>>> mDescriptions
vector<Components::VisualEffect> mVisualEffects
hash_map<string, size_t> mEffectNames
hash_map<ResourceID, size_t> mEffectIDs
vector<ResourceID> mImports

Function documentation

int Swarm::EffectDirectory::AddComponent(int type, Components::IEffectComponent* pComponent) pure virtual

Adds the given IEffectComponent to this directory.

Parameters
type The type of the component, in the enum Swarm::kEffectType... values.
pComponent The IEffectComponent to add.
Returns The index of the component in the list of the appropiate type.

The component will be stored in a list of the specified type.

Components::IEffectComponent* Swarm::EffectDirectory::GetComponent(int index, int type) pure virtual

Gets the IEffectComponent that is in the given index in the list of the specified type.

Parameters
index The index of the component (e.g. the one returned by AddComponent()).
type The type of the component, in the enum Swarm::kEffectType... values.
Returns The IEffectComponent at that index.

int Swarm::EffectDirectory::AddDescription(int type, Components::IEffectDescription* pDescription) pure virtual

Adds the given IEffectDescription to this directory.

Parameters
type The type of the component, in the enum Swarm::kDescType... values.
pDescription The IEffectDescription to add.
Returns The index of the component in the list of the appropiate type.

The component will be stored in a list of the specified type.

Components::IEffectDescription* Swarm::EffectDirectory::GetDescription(int index, int type) pure virtual

Gets the IEffectDescription that is in the given index in the list of the specified type.

Parameters
index The index of the component (e.g. the one returned by AddDescription()).
type The type of the component, in the enum Swarm::kDescType... values.
Returns The IEffectDescription at that index.

bool Swarm::EffectDirectory::Read(IO::IStream* pInputStream) pure virtual

Reads all the effects into this directory from the specified IStream.

Parameters
pInputStream The input IStream where the data will be read.
Returns True if there were no errors.

bool Swarm::EffectDirectory::Write(IO::IStream* pOutputStream) pure virtual

Writes all the effects of this directory into the specified IStream.

Parameters
pOutputStream The output IStream where the data will be written.
Returns True if there were no errors.

bool Swarm::EffectDirectory::HasEffectName(string& dst, const char* pName) pure virtual

Tells whether an effect with this name is contained in this directory.

Parameters
dst out The destination string where the name will be written.
pName The name of the effect to find.
Returns True if the effect exists, false otherwise.

If it is, the name will be written into the given string.

void Swarm::EffectDirectory::GetEffectNames(vector<string>& dst, const char* pPattern = nullptr) pure virtual

Puts all the effect names contained in this directory into the given vector.

Parameters
dst A string vector where the names will be output.
pPattern [Optional] The pattern names must match in order to be added to the list.

Note that not all effects use names; inf act, most of them use IDs. Optionally, a pattern can be specified to only get certain names. The pattern uses the character '?' to allow any character, and '*' to allow any sequence of characters.