DI-Guy C++ SDK Reference  13.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
diguyPathShape.h
Go to the documentation of this file.
1 
2 /*********************************************************************
3  ** Copyright (c) 1992-2014 VT MAK
4  ** All rights reserved.
5  *********************************************************************/
6 
7 /*********************************************************************
8  **
9  *t diguyPathShape
10  **
11  *b Link against: libdiguy
12  */
13 
14 #ifndef __diguyPathShape_H
15 #define __diguyPathShape_H
16 
17 #ifdef SWIG
18 %module diguyPathShape
19 #else
20 #define CPLUSPLUS_ONLY
21 #endif
22 
23 #ifdef CPLUSPLUS_ONLY
24 class bdiScenarioPathShape;
25 class diguyWaypoint;
26 #endif
27 
28 
29 #include <declspec_diguy.h>
30 
31 /****************************************************************************/
32 class BDI_DECLSPEC_diguy diguyPathShape
33 {
34 
35 public:
36 
37  /*l
38  *b Description:
39  **
40  ** Returns the name of the path shape. This pointer will
41  ** never be NULL.
42  **
43  *b Returns:
44  **
45  ** name of the path shape
46  **
47  *b Callable From:
48  **
49  *- - C++
50  *- - Script
51  */
52  const char* get_name();
53 
54  /*l
55  *b Description:
56  **
57  ** This function sets the name of this object.
58  **
59  *b Returns:
60  **
61  ** 0 on success, -1 on failure
62  **
63  *b Callable From:
64  **
65  *- - C++
66  *- - Script
67  */
68  int set_name(const char* name);
69 
70  /*l
71  *b Description:
72  **
73  ** All path shapes are assigned a unique identifier, or uid. This
74  ** function returns this path shape's uid.
75  **
76  ** *Note*: unique identifiers will change between DI-Guy runs!
77  **
78  *b Returns:
79  **
80  ** unique identifier of object
81  **
82  *b Callable From:
83  **
84  *- - C++
85  *- - Script
86  */
87  long get_uid();
88 
89  /*l
90  *b Description:
91  **
92  ** This function determines what happens to objects following this
93  ** path when they reach the end.
94  **
95  ** If 1, the object is restricted to stay at the end of the path.
96  **
97  ** If 0, the object will wrap to the beginning of the path.
98  **
99  *b Arguments:
100  **
101  *a value - 1 to clamp, 0 to wrap
102  **
103  *b Returns:
104  **
105  ** 0 on success, -1 on failure
106  **
107  *b Callable From:
108  **
109  *- - C++
110  *- - Script
111  */
112  int set_clamp_at_end_flag(int value);
113 
114  /*l
115  *b Returns:
116  **
117  ** most recent setting of set_clamp_at_end_flag().
118  */
119  int get_clamp_at_end_flag();
120 
121  /*l
122  *b Description:
123  **
124  ** This function should be called after all modifications have
125  ** been made to the path shape and its waypoints and it is time
126  ** to re-derive the overall path shape.
127  **
128  ** This update is deferred for reasons of performance; if there
129  ** are a lot of modifications to be made to the path shape they can
130  ** all be done in a group with only a single final update.
131  **
132  ** A call to update() is typically required after certain calls
133  ** are made on objects owned by the path, such as a diguyWaypoint.
134  ** The documentation for function calls of these objects will state
135  ** whether a subsequent update() call is necessary.
136  **
137  *b Returns:
138  **
139  ** 0 on success, -1 on failure
140  **
141  *b Callable From:
142  **
143  *- - C++
144  *- - Script
145  */
146  int update();
147 
148  /*l
149  *b Description:
150  **
151  ** This function returns the total length of the path
152  ** shape, in meters.
153  **
154  *b Returns:
155  **
156  ** length of path shape in meters
157  **
158  *b Callable From:
159  **
160  *- - C++
161  *- - Script
162  */
163  float get_length();
164 
165  /*l
166  *b Description:
167  **
168  ** This function returns, via the passed variable pointers,
169  ** the position and orientation of the point on the path shape
170  ** at the specified distance.
171  **
172  *b Arguments:
173  **
174  *a distance_into_path_shape - distance in meters into path shape
175  *a of the desired point
176  *a x, y, z - position of point in meters from the origin
177  *a rz, rx, ry - orientation of point in degrees counter-clockwise
178  *a from the positive X axis
179  **
180  *b Returns:
181  **
182  ** 0 on success, -1 on failure
183  **
184  *b Callable From:
185  **
186  *- - C++
187  *- - Script
188  */
189  int get_point_at_distance(float distance_into_path_shape,
190  float* x, float* y, float* z,
191  float* rz, float* rx, float* ry);
192 
193 
194 /*****************************************************************************/
200  /*l
201  *b Returns:
202  *
203  ** the number of waypoints belonging to this path shape
204  **
205  *b Callable From:
206  **
207  *- - C++
208  *- - Script
209  */
210  int get_num_waypoints();
211 
212  /*l
213  *b Description:
214  **
215  ** This function gets the waypoint at the specified
216  ** index and returns a pointer to it. The returned
217  ** waypoint can then be queried for information or
218  ** modified.
219  **
220  ** Note that if the waypoint is modified, the update()
221  ** function must be called to update the path shape.
222  **
223  *b Arguments:
224  **
225  *a index - index of the waypoint; indices start at 0
226  **
227  *b Returns:
228  **
229  ** pointer of type diguyWaypoint; NULL if no
230  ** waypoint at the specified index
231  **
232  *b Callable From:
233  **
234  *- - C++
235  *- - Script
236  */
237  diguyWaypoint* get_waypoint_at_index(int index);
238 
239  /*l
240  *b Description:
241  **
242  ** This function creates a new waypoint that is added to the
243  ** path shape. Do not call diguyScenario::destroy_waypoint() on
244  ** the returned waypoint; it will be destroyed automatically
245  ** with the path shape.
246  **
247  *b Arguments:
248  **
249  *a tx, ty, tz - position in meters from the origin
250  *a rz, rx, ry - orientations in degrees counter-clockwise
251  *a from the positive X axis
252  *a weight - how much influence this waypoint exerts
253  *a over the path curve
254  *a index - where the waypoint should be inserted in
255  *a the path shape; indices start at 0; pass -1 to
256  *a add to end of path shape
257  **
258  *b Returns:
259  **
260  ** pointer to type diguyWaypoint
261  **
262  *b Callable From:
263  **
264  *- - C++
265  *- - Script
266  */
267  diguyWaypoint* create_waypoint(float x = 0.0f, float y = 0.0f, float z = 0.0f,
268  float yaw = 0.0f, float roll = 0.0f, float pitch = 0.0f,
269  float weight = 1.0f,
270  int index = -1);
271 
272  /*l
273  *b Description:
274  **
275  ** This function adds a waypoint to the path shape.
276  **
277  ** The waypoint should be created using the function
278  ** diguyScenario::create_waypoint(), and destroyed
279  ** using the function diguyScenario::destroy_waypoint().
280  **
281  ** An internal copy of the waypoint is made, so it can
282  ** be destroyed right after this function call or used
283  ** for other path shapes.
284  **
285  *b Arguments:
286  **
287  *a waypoint - waypoint to be appended to end of path
288  **
289  *b Returns:
290  **
291  ** 0 on success, -1 on failure
292  **
293  *b Callable From:
294  **
295  *- - C++
296  *- - Script
297  */
298  int add_waypoint(diguyWaypoint* waypoint);
299 
300 /*****************************************************************************/
306  /*l
307  *b Description:
308  **
309  ** This function tells the Navmesh regions to use this path as a
310  ** connection between two regions. The Navmesh should automatically
311  ** choose the regions closest to the start and end points of the
312  ** path. By default this functionality is off, but once activated
313  ** it's assumed to be a two way connection.
314  **
315  *b Arguments:
316  **
317  *a use_as_portal - 1 to use as a connection, 0 to not
318  **
319  *b Callable From:
320  **
321  *- - C++
322  *- - Script
323  */
324  void set_use_as_navmesh_portal(int use_as_portal);
325 
326  /*l
327  *b Description:
328  **
329  ** This function returns if the path is being used as a connection
330  ** between two regions.
331  **
332  *b Returns:
333  **
334  *a 1 if is a connection, 0 if not
335  **
336  *b Callable From:
337  **
338  *- - C++
339  *- - Script
340  */
341  int get_use_as_navmesh_portal();
342 
343  /*l
344  *b Description:
345  **
346  ** This function tells the Navmesh regions to use this path as a one
347  ** way connection between two regions. Defaults to 0 (two way
348  ** connection)
349  **
350  *b Arguments:
351  **
352  *a one_way - 1 to set as one way connection, 0 to set as
353  *a bidirectional
354  **
355  *b Callable From:
356  **
357  *- - C++
358  *- - Script
359  */
360  void set_one_way_portal(int one_way);
361 
362  /*l
363  *b Description:
364  **
365  ** This function returns if the path is being used as a one way
366  ** connection between two regions.
367  **
368  *b Returns:
369  **
370  *a 1 if is one way connection, 0 if two way
371  **
372  *b Callable From:
373  **
374  *- - C++
375  *- - Script
376  */
377  int get_one_way_portal();
378 
379 
380 /****************************************************************************/
381 /****************************************************************************/
382 /****************************************************************************/
389 /****************************************************************************/
390 /****************************************************************************/
391 /****************************************************************************/
392 
393  int translate(float tx, float ty, float tz);
394 
395  int rotate_about_point(float rz, float rx, float ry,
396  float rotation_pt_x, float rotation_pt_y, float rotation_pt_z);
397 
398  int set_ground_clamp_when_on_path(int ground_clamp_when_on_path);
399  int get_ground_clamp_when_on_path();
400 
405 #ifdef CPLUSPLUS_ONLY
406 
407  bdiScenarioPathShape* get_scripted_object() {return m_path_shape;}
408 
409 private:
411  /*l
412  ** A private constructor.
413  */
414  diguyPathShape(bdiScenarioPathShape* path_shape);
415 
416  /*l
417  ** A pointer to internal data.
418  */
419  bdiScenarioPathShape* m_path_shape;
420 
421  friend class bdiScenarioPathShape;
422  friend class diguyScenario;
423 
424 #endif
425 
426 };
427 
428 #endif /* __diguyPathShape_H */
429