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

auto AddRef() -> void override
auto Release() -> void pure virtual
auto func08h() -> bool pure virtual
auto func0Ch() -> void pure virtual
auto Reset() -> void pure virtual
auto func14h() -> void pure virtual
auto AddVisualEffect(cVisualEffectDescription* effect) -> int pure virtual
auto AddComponent(int type, IComponent* pComponent) -> int pure virtual
Adds the given IComponent to this directory.
auto GetComponent(int index, int type) -> IComponent* pure virtual
Gets the IComponent that is in the given index in the list of the specified type.
auto AddDescription(int type, cDescription* pDescription) -> int pure virtual
Adds the given cDescription to this directory.
auto GetDescription(int index, int type) -> cDescription* pure virtual
Gets the cDescription 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(eastl::string& dst, const char* pName) -> bool pure virtual
Tells whether an effect with this name is contained in this directory.
auto GetEffectNames(eastl::vector<eastl::string>& dst, const char* pPattern = nullptr) -> void pure virtual
Puts all the effect names contained in this directory into the given vector.
auto GetVisualEffect(size_t index) -> cVisualEffectDescription*
auto GetEffectIndex(uint32_t instanceID, uint32_t groupID) -> int

Protected variables

int mnRefCount
eastl::vector<eastl::vector<eastl::intrusive_ptr<IComponent>>> mComponents
eastl::vector<eastl::vector<eastl::intrusive_ptr<cDescription>>> mDescriptions
eastl::vector<cVisualEffectDescription> mVisualEffects
eastl::hash_map<eastl::string, size_t> mEffectNames
eastl::hash_map<ResourceID, size_t> mEffectIDs
eastl::vector<ResourceID> mImports

Function documentation

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

Adds the given IComponent to this directory.

Parameters
type The type of the component, in the enum Swarm::kEffectType... values.
pComponent The IComponent 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.

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

Gets the IComponent 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 IComponent at that index.

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

Adds the given cDescription to this directory.

Parameters
type The type of the component, in the enum Swarm::kDescType... values.
pDescription The cDescription 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.

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

Gets the cDescription 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 cDescription 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(eastl::string& dst, const char* pName) pure virtual

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

Parameters
dst out The destination eastl::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 eastl::string.

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

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

Parameters
dst A eastl::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.