VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
luaNavJob.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2015 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
8 #include "vrfLua/vrfLuaDefines.h"
9 #include "vrfLua/luaAsyncJob.h"
10 #include "vrfutil/scriptGeometry.h"
14 #include "vrfNavigation/navArea.h"
16 #include "vrfutil/rwUUID.h"
17 #include "vrfutil/movementModes.h"
18 
19 #include <luabind/luabind.hpp>
20 
21 class DtSimManager;
22 class DtVrfObject;
23 class DtCoverPointFinder;
25 
28 {
29 public:
30  typedef std::list<DtLocation3D> Points;
31 
33  DtLuaNavJob();
34 
36  ~DtLuaNavJob();
37 
39  virtual luabind::object getObject(lua_State* L, int& index, std::string& message) = 0;
40 
42  virtual luabind::object getDebugObject(lua_State* L) { return luabind::newtable(L); };
43 
45  virtual void cancel(lua_State* L) {};
46 
48  void addMessage(DtAlgorithmManager::Severity, std::string);
49 
53 
54  virtual DtString serialize();
55  virtual bool deserialize(const DtString&);
56 
57  virtual DtString objectType() const = 0;
58 
59  //Tick the job.
60  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager()) = 0;
61 
62  virtual bool complete();
63 
64 protected:
65 
68  DtSimManager* mgr,
69  DtString navigationProfile,
70  DtLocation3D startPoint,
71  DtLocation3D accessPoint = DtLocation3D(DtVector::zero()),
72  Points boundingArea = Points());
73 
74  //Initialize the job. This version must be called by derived start functions.
75  virtual void start();
76 
78  virtual void taskComplete() = 0;
79 
80  //Common parameters for nav jobs.
85 
86  std::string myMessage;
87 
89 };
90 
94 {
95 public:
96  static boost::shared_ptr<DtLuaNavRandomPointJob> Make(
97  DtSimManager* mgr,
98  DtString navigationProfile,
99  DtLocation3D startPoint,
100  double minDistanceFromStart,
101  double maxDistanceFromStart,
102  DtLocation3D accessPoint = DtLocation3D(DtVector::zero()),
103  Points boundingArea = Points(),
104  int numberOfPoints = 1,
105  double minDistanceBetweenPoints = 0.0,
106  DtString placementRestriction = DtMovementModeFree,
107  bool isStrict = true,
108  bool tightlyPack = false,
109  bool needLos = false,
110  bool groundClamp = false,
111  Points leftOfLine = Points(),
112  const DtVrfObject* parentObject = 0);
113 
116 
119 
121  virtual luabind::object getObject(lua_State* L, int& index, std::string& message);
122 
125  virtual luabind::object getDebugObject(lua_State* L);
126 
128  virtual void cancel(lua_State* L);
129 
133 
134  static DtAsciiSerializable* creator();
135 
136  //Returns LuaNavRandomPointJob
137  virtual DtString objectType() const { return DtLuaNavRandomPointJobType; };
138 
139  //Initialize the job.
140  virtual void start();
141 
142  //Tick the job.
143  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager());
144 
145  //Returns true when the job is done.
146  virtual bool complete();
147 
149  virtual void taskComplete();
150 
151 protected:
152 
155  DtSimManager* mgr,
156  DtString navigationProfile,
157  DtLocation3D startPoint,
158  double minDistanceFromStart,
159  double maxDistanceFromStart,
160  DtLocation3D accessPoint = DtLocation3D(DtVector::zero()),
161  Points boundingArea = Points(),
162  int numberOfPoints = 1,
163  double minDistanceBetweenPoints = 0.0,
164  DtString placementRestriction = DtMovementModeFree,
165  bool isStrict = true,
166  bool tightlyPack = false,
167  bool needLos = false,
168  bool groundClamp = false,
169  Points leftOfLine = Points(),
170  const DtVrfObject* parentObject = 0);
171 
179  bool myNeedLos;
185  bool myRanOnce;
187 };
188 
191 {
192 public:
193  static boost::shared_ptr<DtLuaNavPointOfInterestJob> Make(
194  DtSimManager* mgr,
195  DtString navigationProfile,
196  DtLocation3D startPoint,
197  DtUUID hostUuid,
198  int navTag = -1);
199 
202 
205 
207  virtual luabind::object getObject(lua_State* L, int& index, std::string& message);
208 
212 
213  static DtAsciiSerializable* creator();
214 
215  //Returns LuaNavRandomPointJob
216  virtual DtString objectType() const { return DtLuaNavRandomPointJobType; };
217 
218  //Initialize the job.
219  virtual void start();
220 
221  //Tick the job.
222  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager());
223 
225  virtual void taskComplete();
226 
227 protected:
228 
231  DtSimManager* mgr,
232  DtString navigationProfile,
233  DtLocation3D startPoint,
234  int navTag = -1);
235 
236  int myNavTag;
239 };
240 
243 {
244 public:
245  static boost::shared_ptr<DtLuaNavCoverPointJob> Make(
246  DtSimManager* mgr,
247  DtString navigationProfile,
248  DtLocation3D startPoint,
249  DtLocation3D coverFromPoint,
250  double threatRadius,
251  double distanceFromThreat,
252  double range,
253  unsigned numberOfPoints,
254  unsigned int queryQueuePriority);
255 
258 
261 
263  virtual luabind::object getObject(lua_State* L, int& index, std::string& message);
264 
268 
269  static DtAsciiSerializable* creator();
270 
271  //Returns LuaNavCoverPointJob
272  virtual DtString objectType() const { return DtLuaNavCoverPointJobType; };
273 
274  //Initialize the job.
275  virtual void start();
276 
277  //Tick the job.
278  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager());
279 
281  virtual void taskComplete();
282 
283 protected:
284 
287  DtSimManager* mgr,
288  DtString navigationProfile,
289  DtLocation3D startPoint,
290  DtLocation3D threatPoint,
291  double threatRadius,
292  double distanceFromThreat,
293  double range,
294  unsigned numberOfPoints,
295  unsigned int queryQueuePriority);
296 
299  double myRange;
301  std::set<DtCoverPoint> myResultPoints;
305 
306  boost::shared_ptr<DtCoverPointFinder> myPendingCoverPointFinder;
307 };
308 
311 {
312 public:
313  static boost::shared_ptr<DtLuaNavFindPathJob> Make(DtSimManager* mgr,
314  DtString navigationProfile,
315  DtLocation3D startPoint,
316  DtLocation3D endPoint,
317  bool useAbstractGraphs,
318  const DtLocation3D& avoidLocation, double avoidanceRadius,
319  DtActiveBotNavInterface* navIf = 0);
320 
323 
326 
328  virtual luabind::object getObject(lua_State* L, int& index, std::string& message);
329 
331  virtual luabind::object getDebugObject(lua_State* L);
332 
336 
337  static DtAsciiSerializable* creator();
338 
339  //Returns LuaNavCoverPointJob
340  virtual DtString objectType() const { return DtLuaNavCoverPointJobType; };
341 
342  //Initialize the job.
343  virtual void start();
344 
345  //Tick the job.
346  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager());
347 
349  virtual void taskComplete();
350 
351 protected:
352 
355  DtString navigationProfile,
356  DtLocation3D startPoint,
357  DtLocation3D endPoint,
358  bool useAbstractGraphs,
359  const DtLocation3D& avoidLocation, double avoidanceRadius,
360  DtActiveBotNavInterface* navIf = 0);
361 
368  double myPathCost;
370 
372 };
373 
375 {
376 public:
379  virtual void tick();
380  virtual void addJob(boost::shared_ptr<DtLuaNavJob> job);
381 protected:
382  std::list<boost::shared_ptr<DtLuaNavJob> > myJobs;
383 };
UUID is a unique ID wrapper class.
Definition: rwUUID.h:222
bool myGenerated
Definition: luaNavJob.h:369
const DtString DtLuaNavCoverPointJobType
Definition: asciiSerializable.h:23
const char DtMovementModeFree[]
Definition: movementModes.h:11
DtVrfObject is used to represent any type of simulated object (entities, aggregate, control objects) in a VR-Forces application.
Definition: vrfObject.h:215
Points myDebugPoints
Definition: luaNavJob.h:371
int myNavTag
Definition: luaNavJob.h:236
Severity
Definition: algorithmManager.h:29
virtual void addJob(boost::shared_ptr< DtLuaNavJob > job)
Lua object class which represents a feature navigation task.
Definition: luaNavJob.h:190
double myMinDistanceBetweenPoints
Definition: luaNavJob.h:175
bool myRanOnce
Definition: luaNavJob.h:185
DtLocation3D myThreatPoint
Definition: luaNavJob.h:300
std::list< DtLocation3D > Points
Definition: luaNavJob.h:30
Lua object class which finds a path to the specified location.
Definition: luaNavJob.h:310
This is the DtVrfObjectNavInterface subclass for objects which are actively querying the navigation s...
Definition: activeBotNavInterface.h:26
virtual void run(const DtAlgorithmManager &mgr=DtAlgorithmManager())=0
unsigned myQueryQueuePriority
Definition: luaNavJob.h:303
Lua object class which represents a feature navigation task.
Definition: luaNavJob.h:27
bool myIsStrict
Definition: luaNavJob.h:177
virtual luabind::object getObject(lua_State *L, int &index, std::string &message)=0
Retrieve value.
Points myPathPoints
Definition: luaNavJob.h:363
Definition: asciiSerializable.h:33
Interface for getting asynchronously computed data into Lua.
Definition: luaAsyncJob.h:29
virtual bool deserialize(const DtString &)=0
This function should take the string that was serialized via serialize() and fill this object with th...
unsigned myNumberOfPoints
Definition: luaNavJob.h:302
int myNumberOfPoints
Definition: luaNavJob.h:172
virtual DtString objectType() const
Should return the string name of this object.
Definition: luaNavJob.h:137
boost::shared_ptr< DtCoverPointFinder > myPendingCoverPointFinder
Definition: luaNavJob.h:306
std::list< boost::shared_ptr< DtLuaNavJob > > myJobs
Definition: luaNavJob.h:382
virtual void taskComplete()=0
Called by task object whenever it is done.
virtual DtString serialize()=0
The following characters are reserved and cannot be used in serialization: &#39;|&#39;, &#39;:&#39;.
const DtVrfObject * myParentObject
Definition: luaNavJob.h:184
double myAvoidanceRadius
Definition: luaNavJob.h:366
virtual void start()
double myThreatRadius
Definition: luaNavJob.h:297
virtual void cancel(lua_State *L)
Cancels the job. By default this is a no-op, we let the job finish on its own.
Definition: luaNavJob.h:45
virtual DtString objectType() const
Should return the string name of this object.
Definition: luaNavJob.h:340
DtLocation3D myStartPoint
Definition: luaNavJob.h:82
Points myBoundingArea
Definition: luaNavJob.h:84
std::set< DtCoverPoint > myResultPoints
Definition: luaNavJob.h:301
DtLocation3D myEndPoint
Definition: luaNavJob.h:362
Definition: asyncJobServer.h:37
bool myGenerated
Definition: luaNavJob.h:186
DtLocation3D myAvoidLocation
Definition: luaNavJob.h:365
Lua object class for finding random points within a nav area.
Definition: luaNavJob.h:93
double myMinDistanceFromStart
Definition: luaNavJob.h:173
bool myGenerated
Definition: luaNavJob.h:238
bool myGenerated
Definition: luaNavJob.h:304
bool myUseAbstractGraphs
Definition: luaNavJob.h:364
DtLocation3D myResultPoint
Definition: luaNavJob.h:237
#define DT_DLL_vrfLua
This file is used to determine how to build.
Definition: vrfLuaDefines.h:25
Lua object class which finds a cover point from the specified location.
Definition: luaNavJob.h:242
const DtString DtLuaNavRandomPointJobType
Definition: asciiSerializable.h:22
double myMaxDistanceFromStart
Definition: luaNavJob.h:174
std::string myMessage
Definition: luaNavJob.h:86
DtLocation3D myAccessPoint
Definition: luaNavJob.h:83
boost::shared_ptr< DtNavAreaQuery > Ptr
Definition: navArea.h:59
virtual luabind::object getObject(lua_State *L, int &index, std::string &message)=0
Retrieve current value.
double myRange
Definition: luaNavJob.h:299
Points myResultPoints
Definition: luaNavJob.h:182
virtual DtString objectType() const =0
Should return the string name of this object.
bool myTightlyPack
Definition: luaNavJob.h:178
double myDistanceFromThreat
Definition: luaNavJob.h:298
double myPathCost
Definition: luaNavJob.h:368
bool myNeedLos
Definition: luaNavJob.h:179
virtual void tick()
bool myGroundClamp
Definition: luaNavJob.h:180
virtual luabind::object getDebugObject(lua_State *L)
Retrieve debug data, if available. Default behavior is an empty table.
Definition: luaNavJob.h:42
The simulation engine is controlled by a single,top-level class called the Simulation Manager...
Definition: simManager.h:103
Points myLeftOfLine
Definition: luaNavJob.h:181
DtString myNavigationProfile
Definition: luaNavJob.h:81
virtual bool complete()
virtual DtString objectType() const
Should return the string name of this object.
Definition: luaNavJob.h:272
DtNavAreaQuery::Ptr myQuery
Definition: luaNavJob.h:88
Definition: luaNavJob.h:374
Points myDebugPoints
Definition: luaNavJob.h:183
virtual DtString objectType() const
Should return the string name of this object.
Definition: luaNavJob.h:216
Used to find the best cover point(s) to take cover from attacker at a specified location.
Definition: coverPointFinder.h:36
DtActiveBotNavInterface * myNavIf
Definition: luaNavJob.h:367
General interface which can be passed into an algorithm to control its behavior.
Definition: algorithmManager.h:24
A location3D is a point in space, i.e. a geocentric coordinate.
Definition: scriptGeometry.h:22
DtString myPlacementRestriction
Definition: luaNavJob.h:176

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)