Atoms Crowd  4.1.0
Atoms::AtomsCache Class Reference

Classes

class  FrameData
 

Public Member Functions

 AtomsCache ()
 Constructor.
 
 AtomsCache (const std::string &cachePath, const std::string &cacheName)
 Constructor.
 
 AtomsCache (const std::string &cachePath, const std::string &cacheName, const std::vector< int > &agents)
 Constructor.
 
 ~AtomsCache ()
 Destructor.
 
bool openCache (const std::string &cachePath, const std::string &cacheName)
 Opens a cache. More...
 
bool openCache (const std::string &cachePath, const std::string &cacheName, const std::vector< int > &agents)
 Opens a cache. More...
 
void loadPrevFrame (int frame)
 Loads a cache frame and store in the previous frame (usually used for the previous frame during the motion blur computation)
 
void loadFrame (int frame)
 Loads a cache frame and stores the current frame data. More...
 
void loadNextFrame (int frame)
 Loads a cache frame and stores the next frame data (usually used for the next frame during the motion blur computation)
 
void loadPrevFrameHeader (int frame)
 Loads a cache frame header and store in the previuos frame (usually used for the previous frame during the motion blur computation)
 
void loadFrameHeader (int frame)
 Loads a cache frame header and stores the current frame data. More...
 
void loadNextFrameHeader (int frame)
 Loads a cache frame and stores the next frame data (usually used for the next frame during the motion blur computation)
 
size_t numAgents () const
 Get the number of agents.
 
int startFrame () const
 Get the start frame.
 
int endFrame () const
 Get the end frame.
 
int currentFrame () const
 Get the current frame.
 
int prevFrame () const
 Get the previous frame.
 
int nextFrame () const
 Get the next frame.
 
FrameDataprevFrameData ()
 Get the previous frame data.
 
FrameDataframeData ()
 Get the current frame data.
 
FrameDatanextFrameData ()
 Get the next frame data.
 
void loadBoundingBox (double time, AtomsCore::Box3 &box) const
 Loads bbox. More...
 
void loadAgent (double time, unsigned int agentId, Atoms::Agent &agent) const
 Loads all data for an agent. More...
 
void loadAgentBoundingBox (double time, unsigned int agentId, AtomsCore::Box3 &box) const
 Loads an agent bbox. More...
 
void loadAgentPose (double time, unsigned int agentId, AtomsCore::Pose &pose) const
 Loads an agent pose. More...
 
void loadAgentMetadata (double time, unsigned int agentId, AtomsCore::MapMetadata &metadata) const
 Loads an agent metadata. More...
 
void clear ()
 Clear all the loaded frames.
 
void processMetadata (AtomsCore::MapMetadata &outMetadata, std::vector< const AtomsCore::MapMetadata * > &inMetadatas, const std::vector< double > &inputWeightVector) const
 Blends multiple mapmetadata.
 
void blendPose (size_t numJoints, std::vector< const AtomsCore::Pose * > &posePorts, std::vector< double > &weightPorts, AtomsCore::Pose &outPose) const
 Blends pose.
 
const std::string & agentType (double time, unsigned int agentId) const
 Gets the agent type.
 
const AtomsCore::Vector3agentPosition (double time, unsigned int agentId) const
 Gets the agent position.
 
const std::string & agentVariation (double time, unsigned int agentId) const
 Get the agent variation.
 
int agentColorVariation (double time, unsigned int agentId) const
 Get the agent variation.
 
const std::string & agentLod (double time, unsigned int agentId) const
 Get the agent lod.
 
const AtomsCore::Vector3agentVelocity (double time, unsigned int agentId) const
 Gets the agent velocity.
 
const std::vector< int > & agentIds (double time) const
 Gets agent ids.
 
const std::vector< int > & agentsCreated (double time) const
 Gets the list of agent created.
 
const std::vector< int > & agentsDeleted (double time) const
 Gets the list of agent deleted.
 
size_t numAgentsCreated (double time) const
 Gets the number of agents created.
 
size_t numAgentsDeleted (double time) const
 Gets the number of agent deleted.
 
void setAgentsToLoad (const std::vector< int > &agents)
 Sets the agents to be loaded from the cache.
 
const std::string & cacheName () const
 Return the cache name.
 
const std::string & cachePath () const
 Return the cache path.
 
AgentTypePtr loadAgentType (const std::string &agentTypeName, bool asGlobal=true)
 Load and get an agent type.
 
AgentTypesagentTypes ()
 Return the local agent types object.
 
const AgentTypesagentTypes () const
 Return the local agent types object.
 

Static Public Member Functions

static bool exportCacheFrame (const std::string &cachePath, const std::string &cacheName, long frame, const std::vector< AtomsPtr< Atoms::AgentGroup >> &agentGroups, std::unordered_map< size_t, size_t > &cacheIdMap, std::set< std::string > &agentTypes, size_t tags, bool useSkinMeshBBox=false)
 Exports a single frame cache file. More...
 

Member Function Documentation

◆ exportCacheFrame()

static bool Atoms::AtomsCache::exportCacheFrame ( const std::string &  cachePath,
const std::string &  cacheName,
long  frame,
const std::vector< AtomsPtr< Atoms::AgentGroup >> &  agentGroups,
std::unordered_map< size_t, size_t > &  cacheIdMap,
std::set< std::string > &  agentTypes,
size_t  tags,
bool  useSkinMeshBBox = false 
)
static

Exports a single frame cache file.

Parameters
filePathcache file path
agentGroupsAgent group to export

◆ loadAgent()

void Atoms::AtomsCache::loadAgent ( double  time,
unsigned int  agentId,
Atoms::Agent agent 
) const

Loads all data for an agent.

Parameters
timeCache frame, this is must always be a value between the prev, current and next frame. You should load the correct frames before calling this function
agentIdCache agent id
agentAgent loaded

◆ loadAgentBoundingBox()

void Atoms::AtomsCache::loadAgentBoundingBox ( double  time,
unsigned int  agentId,
AtomsCore::Box3 box 
) const

Loads an agent bbox.

Parameters
timeCache frame, this is must always be a value between the prev, current and next frame. You should load the correct frames before calling this function
agentIdCache agent id
boxBBox loaded

◆ loadAgentMetadata()

void Atoms::AtomsCache::loadAgentMetadata ( double  time,
unsigned int  agentId,
AtomsCore::MapMetadata metadata 
) const

Loads an agent metadata.

Parameters
timeCache frame, this is must always be a value between the prev, current and next frame. You should load the correct frames before calling this function
agentIdCache agent id
metadataAgent metadata loaded

◆ loadAgentPose()

void Atoms::AtomsCache::loadAgentPose ( double  time,
unsigned int  agentId,
AtomsCore::Pose pose 
) const

Loads an agent pose.

Parameters
timeCache frame, this is must always be a value between the prev, current and next frame. You should load the correct frames before calling this function
agentIdCache agent id
poseAgent pose loaded

◆ loadBoundingBox()

void Atoms::AtomsCache::loadBoundingBox ( double  time,
AtomsCore::Box3 box 
) const

Loads bbox.

Parameters
timeCache frame, this is must always be a value between the prev, current and next frame. You should load the correct frames before calling this function
boxBBox loaded

◆ loadFrame()

void Atoms::AtomsCache::loadFrame ( int  frame)

Loads a cache frame and stores the current frame data.

If a frame was already loaded then the old frame data is moved to the previous frame slot

◆ loadFrameHeader()

void Atoms::AtomsCache::loadFrameHeader ( int  frame)

Loads a cache frame header and stores the current frame data.

If a frame was already loaded then the old frame data is moved to the previous frame slot

◆ openCache() [1/2]

bool Atoms::AtomsCache::openCache ( const std::string &  cachePath,
const std::string &  cacheName 
)

Opens a cache.

Only the header is loaded

◆ openCache() [2/2]

bool Atoms::AtomsCache::openCache ( const std::string &  cachePath,
const std::string &  cacheName,
const std::vector< int > &  agents 
)

Opens a cache.

Only the header is loaded

Parameters
agentsAgents ids, it loads only those agents from the cache

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