Atoms Crowd  7.0.0
FollowCurveModule.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 <AtomsUtils/KdTreePoint.h>
12 
13 namespace AtomsModules
14 {
16  {
17  public:
18 
20 
22 
23  void initSimulation(Atoms::AgentGroup* agentGroup);
24 
25  void agentsCreated(const std::vector<Atoms::Agent*>& agents, Atoms::AgentGroup* agentGroup = nullptr);
26 
27  void initFrame(const std::vector<Atoms::Agent*>& agents, Atoms::AgentGroup* agentGroup = nullptr);
28 
29  void endFrame(const std::vector<Atoms::Agent*>& agents, Atoms::AgentGroup* agentGroup = nullptr);
30 
31  void draw(Atoms::DrawContext* context, const std::vector<Atoms::Agent*>& agents, Atoms::AgentGroup* agentGroup = nullptr);
32 
33  static Atoms::BehaviourModule* creator(const std::string& parameter);
34 
35  void buildTree();
36 
37  void calculateCurveTangent(const AtomsCore::Vector3& posPtr, int& closestId, double &agentDistance, AtomsCore::Vector3& pos1, AtomsCore::Vector3& pos2, AtomsCore::Vector3& pos3, AtomsCore::Vector3& outTangent, AtomsCore::Vector3& closetsP);
38 
39  private:
40 
42 
43  std::vector<AtomsCore::Vector3> m_points;
44 
45  std::vector<AtomsCore::Vector3> m_tangents;
46 
47  std::vector<short> m_activeAgentDebug;
48 
49  std::vector<AtomsCore::Vector3> m_tangentsDebug;
50 
51  std::vector<AtomsCore::Vector3> m_agentTangentsDebug;
52 
53  std::vector<AtomsCore::Vector3> m_agentClosedTangentsDebug;
54 
55  std::vector<AtomsCore::Vector3> m_agentTargetPointsDebug;
56 
57  std::vector<AtomsCore::Vector3> m_influenceDebug;
58 
59  std::vector<AtomsCore::Vector3> m_influenceDropOffDebug;
60 
61  bool m_activeDraw;
62 
63  };
64 }
65 
66 
67 
Agent group.
Definition: AgentGroup.h:36
Behaviour module.
Definition: BehaviourModule.h:32
Definition: DrawContext.h:17
Definition: FollowCurveModule.h:16
void endFrame(const std::vector< Atoms::Agent * > &agents, Atoms::AgentGroup *agentGroup=nullptr)
End frame.
void draw(Atoms::DrawContext *context, const std::vector< Atoms::Agent * > &agents, Atoms::AgentGroup *agentGroup=nullptr)
Draw.
void agentsCreated(const std::vector< Atoms::Agent * > &agents, Atoms::AgentGroup *agentGroup=nullptr)
Agents Created.
void initSimulation(Atoms::AgentGroup *agentGroup)
Init simulation.
void initFrame(const std::vector< Atoms::Agent * > &agents, Atoms::AgentGroup *agentGroup=nullptr)
Init frame.
Definition: KdTreePoint.h:19
AtomsMath::Vector3 Vector3
Vector3 class.
Definition: AtomsMath.h:57