Atoms Crowd  7.0.0
AtomsClothCaches.h
1 #pragma once
2 // ===========================================================================
3 // Copyright (c) 2015 Toolchefs Ltd. All rights reserved.
4 //
5 // Use of this software is subject to the terms of the Toolchefs license
6 // agreement provided at the time of installation or download, or which
7 // otherwise accompanies this software in either electronic or hard copy form.
8 // ===========================================================================
9 
10 
11 #include <Atoms/AtomsClothCache.h>
12 #include <vector>
13 
14 namespace Atoms
15 {
16  class ATOMS_EXPORT AtomsClothCaches
17  {
18  public:
19 
21 
23 
24  bool openCache(const std::string& cachePath, const std::string& cacheName);
25 
26  bool openCache(const std::string& cachePath, const std::string& cacheName, const std::vector<int>& agents);
27 
29  void loadTime(double time);
30 
32  void loadPrevFrame(int frame);
33 
35 
36  void loadFrame(int frame);
37 
39  void loadNextFrame(int frame);
40 
42  int startFrame() const;
43 
45  int endFrame() const;
46 
48  int currentFrame() const;
49 
51  int prevFrame() const;
52 
54  int nextFrame() const;
55 
57 
61  void loadBoundingBox(double time, AtomsCore::Box3& box) const;
62 
64 
69  void loadAgentClothBoundingBox(double time, unsigned int agentId, AtomsCore::Box3& box) const;
70 
72 
78  void loadAgentClothMeshBoundingBox(double time, unsigned int agentId, const std::string& meshName, AtomsCore::Box3& box) const;
79 
81 
88  void loadAgentClothMesh(double time,
89  unsigned int agentId,
90  const std::string& meshName,
91  std::vector<AtomsCore::Vector3>& points,
92  std::vector<AtomsCore::Vector3>& normals
93  ) const;
94 
96 
101  std::string getAgentClothMeshStackOrder(double time,
102  unsigned int agentId,
103  const std::string& meshName
104  ) const;
105 
107 
112  bool hasAgentClothMesh(double time, unsigned int agentId, const std::string& meshName) const;
113 
115  void clear();
116 
118  std::vector<int> agentIds(double time) const;
119 
121  std::vector<std::string> agentClothMeshNames(double time, unsigned int agentId) const;
122 
123  void setAgentsToLoad(const std::vector<int>& agents);
124 
125  void removeAllCaches();
126 
127  void removeCache(const std::string& cachePath, const std::string& cacheName);
128 
129  std::vector<std::pair<std::string, std::string>> getCachePaths() const;
130 
131  private:
132 
133  std::vector<AtomsClothCache> m_clothCaches;
134  };
135 }
Definition: AtomsClothCaches.h:17
int currentFrame() const
Get the current frame.
bool hasAgentClothMesh(double time, unsigned int agentId, const std::string &meshName) const
Check if a mesh for an egent exist inside the cache.
int prevFrame() const
Get the previous frame.
int nextFrame() const
Get the next frame.
std::vector< std::string > agentClothMeshNames(double time, unsigned int agentId) const
Gets agent cloth mesh names.
void loadFrame(int frame)
Loads a cache frame and stores the current frame data.
void clear()
Clear all the loaded frames.
void loadPrevFrame(int frame)
Loads a cache frame and store in the previous frame (usually used for the previous frame during the m...
std::string getAgentClothMeshStackOrder(double time, unsigned int agentId, const std::string &meshName) const
Get cloth mesh stack order.
void loadAgentClothMeshBoundingBox(double time, unsigned int agentId, const std::string &meshName, AtomsCore::Box3 &box) const
Loads an agent bbox.
int endFrame() const
Get the end frame.
void loadAgentClothBoundingBox(double time, unsigned int agentId, AtomsCore::Box3 &box) const
Loads an agent bbox.
void loadNextFrame(int frame)
Loads a cache frame and stores the next frame data (usually used for the next frame during the motion...
std::vector< int > agentIds(double time) const
Gets agent ids.
int startFrame() const
Get the start frame.
void loadTime(double time)
Loads the pre/next and current frame given the input time.
void loadBoundingBox(double time, AtomsCore::Box3 &box) const
Loads bbox.
void loadAgentClothMesh(double time, unsigned int agentId, const std::string &meshName, std::vector< AtomsCore::Vector3 > &points, std::vector< AtomsCore::Vector3 > &normals) const
Loads all data for an agent.
AtomsMath::Box3 Box3
Bounding box class.
Definition: AtomsMath.h:74
Atoms namespace.
Definition: Agent.h:29