Atoms Crowd  7.0.0
DirectionField.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 #include <AtomsModules/Globals.h>
10 #include <Atoms/BehaviourModule.h>
11 #include <AtomsUtils/Mesh.h>
12 #include <AtomsUtils/KdTreePoint.h>
13 
14 namespace AtomsModules
15 {
16  class ATOMSMODULES_EXPORT DirectionFieldModule : public Atoms::BehaviourModule
17  {
18  public:
19 
21 
22  virtual ~DirectionFieldModule();
23 
24  void initSimulation(Atoms::AgentGroup* agentGroup);
25 
26  void initFrame(const std::vector<Atoms::Agent*>& agents, Atoms::AgentGroup* agentGroup);
27 
28  void draw(Atoms::DrawContext* context, const std::vector<Atoms::Agent*>& agents, Atoms::AgentGroup* agentGroup = nullptr);
29 
30  static Atoms::BehaviourModule* creator(const std::string& parameter);
31 
32  inline const std::vector<AtomsCore::Vector3>& samples() const { return m_samples; }
33 
34  inline const AtomsCore::MapMetadata& tangentSamples() const { return m_tangentSamples; }
35 
36  inline void setTangentSamples(const AtomsCore::MapMetadata& tSamples) { m_tangentSamples = tSamples; }
37 
38  inline AtomsPtr<AtomsUtils::Mesh> mesh() { return m_mesh; }
39 
40  private:
41 
42  std::vector<AtomsCore::Vector3> m_samples;
43 
44  std::vector<AtomsCore::Vector3> m_samplePoints;
45 
46  std::vector<AtomsCore::Vector3> m_debugDirectionPoints;
47 
48  std::vector<AtomsCore::Vector3> m_debugInfluencesPoints;
49 
50  std::vector<std::pair<int,std::string>> m_samplesKeys;
51 
52  AtomsCore::MapMetadata m_tangentSamples;
53 
55 
56  AtomsPtr<AtomsUtils::Mesh> m_mesh;
57 
58  bool m_debugActive;
59  };
60 }
61 
Agent group.
Definition: AgentGroup.h:36
Behaviour module.
Definition: BehaviourModule.h:32
Definition: DrawContext.h:17
MapMetadata class.
Definition: MapMetadata.h:24
Definition: DirectionField.h:17
void draw(Atoms::DrawContext *context, const std::vector< Atoms::Agent * > &agents, Atoms::AgentGroup *agentGroup=nullptr)
Draw.
void initSimulation(Atoms::AgentGroup *agentGroup)
Init simulation.
void initFrame(const std::vector< Atoms::Agent * > &agents, Atoms::AgentGroup *agentGroup)
Init frame.
Definition: KdTreePoint.h:19