Atoms Crowd  7.0.0
CacheReaderOperator.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 #include <AtomsGraph/Ports.h>
11 #include <Atoms/Globals.h>
12 #include <Atoms/Graph/Operator.h>
13 #include <Atoms/AtomsCache.h>
14 #include <AtomsCore/Metadata/Vector3Metadata.h>
15 
16 
17 namespace Atoms
18 {
19  class ATOMS_EXPORT CacheReaderOperator : public Operator
20  {
21  public:
22 
23  NODE_STANDARD_MEMBERS
24 
26 
27  virtual ~CacheReaderOperator();
28 
29  bool compute(const AtomsGraph::ComputeData* computeData);
30 
31  void reset();
32 
33  void setCache(const std::string& cachePath, const std::string& cacheName, int startFrame, int endFrame);
34 
35  void setMatrix(const AtomsCore::Matrix& matrix);
36 
37  void setLocalMatrix(const AtomsCore::Matrix& matrix);
38 
39  void transformVectorMetadata(AtomsPtr<AtomsCore::Vector3Metadata>& vectorPtr);
40 
41  void setMetadataExlusionList(const std::vector<std::string>& vec);
42 
43  inline void setAgentCacheId(long id) { m_agentCacheIdPort->set(id); }
44 
45  inline void setApplyScaleToInitPosition(bool value) { m_applyScaleToInitPosition = value; }
46 
47  private:
48 
49  AtomsGraph::StringPort* m_cachePathPort;
50 
51  AtomsGraph::StringPort* m_cacheNamePort;
52 
53  AtomsGraph::DoublePort* m_timePort;
54 
55  AtomsGraph::DoublePort* m_timeOffsetPort;
56 
57  AtomsGraph::DoublePort* m_scaleMultiplierPort;
58 
59  AtomsGraph::StringArrayPort* m_metadataExclusion;
60 
61  AtomsGraph::LongPort* m_startFramePort;
62 
63  AtomsGraph::LongPort* m_endFramePort;
64 
65  AtomsGraph::MatrixPort* m_matrixPort;
66 
67  AtomsGraph::MatrixPort* m_localMatrixPort;
68 
69  AtomsGraph::LongPort* m_agentCacheIdPort;
70 
71  AtomsGraph::BooleanPort* m_timeOffsetInPlace;
72 
73  private:
74 
75  AtomsCore::Vector3 m_initPosition;
76 
77  AtomsCore::Vector3 m_startCachePosition;
78 
79  double m_currentFrame;
80 
81  double m_initTimeOffset;
82  double m_initTime;
83 
84  bool m_init;
85 
86  bool m_applyScaleToInitPosition;
87  };
88 }
Definition: CacheReaderOperator.h:20
void reset()
Operator reset function.
bool compute(const AtomsGraph::ComputeData *computeData)
Compute function.
Operator node.
Definition: Operator.h:26
Definition: Node.h:21
Generic node port class.
Definition: PortTemplate.h:24
AtomsMath::Vector3 Vector3
Vector3 class.
Definition: AtomsMath.h:57
AtomsMath::Matrix Matrix
Matrix class.
Definition: AtomsMath.h:63
Atoms namespace.
Definition: Agent.h:29