Atoms Crowd  7.0.0
ProximityMetadataModule.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 <Atoms/BehaviourModule.h>
11 #include <AtomsCore/Metadata/Vector3Metadata.h>
12 
13 namespace AtomsModules
14 {
16  {
17  public:
18 
19  struct DebugData
20  {
22  AtomsCore::Vector3 color;
23  double radius;
24  bool valid;
25  int targetId;
26  AtomsCore::Vector3 targetPosition;
27  };
28 
29  struct Priority {
30  double lastAffectedTme;
31  int id;
32  };
33 
35 
37 
38  void initFrame(const std::vector<Atoms::Agent*>& agents, Atoms::AgentGroup* agentGroup = nullptr);
39 
40  void endFrame(const std::vector<Atoms::Agent*>& agents, Atoms::AgentGroup* agentGroup = nullptr);
41 
42  void preDraw(Atoms::DrawContext* context, const std::vector<Atoms::Agent*>& agents, Atoms::AgentGroup* agentGroup = nullptr);
43 
44  void draw(Atoms::DrawContext* context, const std::vector<Atoms::Agent*>& agents, Atoms::AgentGroup* agentGroup = nullptr);
45 
46  static Atoms::BehaviourModule* creator(const std::string& parameter);
47 
48  private:
49 
50  template<class T>
51  void proximityModuleProcessMetadataType(
52  Atoms::Agent* agent,
54  AtomsPtr<AtomsCore::Metadata>& agentMeta,
55  const std::string& metaName,
56  const int groupId,
57  const std::string& groupIdStr,
58  const int agentId,
59  const std::string &moduleName,
60  const double inWeight);
61 
62  std::vector<DebugData> m_debugData;
63 
64  bool m_activeDraw;
65 
66  };
67 }
Agent group.
Definition: AgentGroup.h:36
Agent.
Definition: Agent.h:44
Behaviour Module Attribute Cache.
Definition: BehaviourModuleAttributeCache.h:41
Behaviour module.
Definition: BehaviourModule.h:32
Definition: DrawContext.h:17
Definition: ProximityMetadataModule.h:16
void draw(Atoms::DrawContext *context, const std::vector< Atoms::Agent * > &agents, Atoms::AgentGroup *agentGroup=nullptr)
Draw.
void preDraw(Atoms::DrawContext *context, const std::vector< Atoms::Agent * > &agents, Atoms::AgentGroup *agentGroup=nullptr)
Pre draw.
void endFrame(const std::vector< Atoms::Agent * > &agents, Atoms::AgentGroup *agentGroup=nullptr)
End frame.
void initFrame(const std::vector< Atoms::Agent * > &agents, Atoms::AgentGroup *agentGroup=nullptr)
Init frame.
AtomsMath::Vector3 Vector3
Vector3 class.
Definition: AtomsMath.h:57
Definition: ProximityMetadataModule.h:20
Definition: ProximityMetadataModule.h:29