DI-Guy SDK Documentation  13.5
diguyPathShape.h
Go to the documentation of this file.
1 
2 /*********************************************************************
3  ** Copyright (c) 1992-2020 MAK Technologies, Inc.
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 /*****************************************************************************/
45 public:
46 
47  /*l
48  *b Description:
49  **
50  ** Returns the name of the path shape. This pointer will
51  ** never be NULL.
52  **
53  *b Returns:
54  **
55  ** name of the path shape
56  */
57  const char* get_name();
58 
59  /*l
60  *b Description:
61  **
62  ** This function sets the name of this object.
63  **
64  *b Returns:
65  **
66  ** 0 on success, -1 on failure
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  long get_uid();
83 
84  /*l
85  *b Description:
86  **
87  ** This function determines what happens to objects following this
88  ** path when they reach the end.
89  **
90  ** If 1, the object is restricted to stay at the end of the path.
91  **
92  ** If 0, the object will wrap to the beginning of the path.
93  **
94  *b Arguments:
95  **
96  *a value - 1 to clamp, 0 to wrap
97  **
98  *b Returns:
99  **
100  ** 0 on success, -1 on failure
101  */
102  int set_clamp_at_end_flag(int value);
103 
104  /*l
105  *b Returns:
106  **
107  ** most recent setting of set_clamp_at_end_flag().
108  */
109  int get_clamp_at_end_flag();
110 
111  /*l
112  *b Description:
113  **
114  ** This function should be called after all modifications have
115  ** been made to the path shape and its waypoints and it is time
116  ** to re-derive the overall path shape.
117  **
118  ** This update is deferred for reasons of performance; if there
119  ** are a lot of modifications to be made to the path shape they can
120  ** all be done in a group with only a single final update.
121  **
122  ** A call to update() is typically required after certain calls
123  ** are made on objects owned by the path, such as a diguyWaypoint.
124  ** The documentation for function calls of these objects will state
125  ** whether a subsequent update() call is necessary.
126  **
127  *b Returns:
128  **
129  ** 0 on success, -1 on failure
130  */
131  int update();
132 
133  /*l
134  *b Description:
135  **
136  ** This function returns the total length of the path
137  ** shape, in meters.
138  **
139  *b Returns:
140  **
141  ** length of path shape in meters
142  */
143  float get_length();
144 
145  /*l
146  *b Description:
147  **
148  ** This function returns, via the passed variable pointers,
149  ** the position and orientation of the point on the path shape
150  ** at the specified distance.
151  **
152  *b Arguments:
153  **
154  *a distance_into_path_shape - distance in meters into path shape
155  *a of the desired point
156  *a x, y, z - position of point in meters from the origin
157  *a rz, rx, ry - orientation of point in degrees counter-clockwise
158  *a from the positive X axis
159  **
160  *b Returns:
161  **
162  ** 0 on success, -1 on failure
163  */
164  int get_point_at_distance(float distance_into_path_shape,
165  float* x, float* y, float* z,
166  float* rz, float* rx, float* ry);
167 
168 
169 /*****************************************************************************/
179  /*l
180  *b Returns:
181  *
182  ** the number of waypoints belonging to this path shape
183  */
184  int get_num_waypoints();
185 
186  /*l
187  *b Description:
188  **
189  ** This function gets the waypoint at the specified
190  ** index and returns a pointer to it. The returned
191  ** waypoint can then be queried for information or
192  ** modified.
193  **
194  ** Note that if the waypoint is modified, the update()
195  ** function must be called to update the path shape.
196  **
197  *b Arguments:
198  **
199  *a index - index of the waypoint; indices start at 0
200  **
201  *b Returns:
202  **
203  ** pointer of type diguyWaypoint; NULL if no
204  ** waypoint at the specified index
205  */
206  diguyWaypoint* get_waypoint_at_index(int index);
207 
208  /*l
209  *b Description:
210  **
211  ** This function creates a new waypoint that is added to the
212  ** path shape. Do not call diguyScenario::destroy_waypoint() on
213  ** the returned waypoint; it will be destroyed automatically
214  ** with the path shape.
215  **
216  *b Arguments:
217  **
218  *a tx, ty, tz - position in meters from the origin
219  *a rz, rx, ry - orientations in degrees counter-clockwise
220  *a from the positive X axis
221  *a weight - how much influence this waypoint exerts
222  *a over the path curve
223  *a index - where the waypoint should be inserted in
224  *a the path shape; indices start at 0; pass -1 to
225  *a add to end of path shape
226  **
227  *b Returns:
228  **
229  ** pointer to type diguyWaypoint
230  */
231  diguyWaypoint* create_waypoint(float x = 0.0f, float y = 0.0f, float z = 0.0f,
232  float yaw = 0.0f, float roll = 0.0f, float pitch = 0.0f,
233  float weight = 1.0f,
234  int index = -1);
235 
236  /*l
237  *b Description:
238  **
239  ** This function adds a waypoint to the path shape.
240  **
241  ** The waypoint should be created using the function
242  ** diguyScenario::create_waypoint(), and destroyed
243  ** using the function diguyScenario::destroy_waypoint().
244  **
245  ** An internal copy of the waypoint is made, so it can
246  ** be destroyed right after this function call or used
247  ** for other path shapes.
248  **
249  *b Arguments:
250  **
251  *a waypoint - waypoint to be appended to end of path
252  **
253  *b Returns:
254  **
255  ** 0 on success, -1 on failure
256  */
257  int add_waypoint(diguyWaypoint* waypoint);
258 
259  /*l
260  *b Description:
261  **
262  ** This function destroys a waypoint on the path.
263  **
264  *b Arguments:
265  **
266  *a waypoint - waypoint to be deleted
267  **
268  *b Returns:
269  **
270  ** 0 on success, -1 on failure
271  */
272  int destroy_waypoint(diguyWaypoint* waypoint);
273 /*****************************************************************************/
283  /*l
284  *b Description:
285  **
286  ** This function tells the Navmesh regions to use this path as a
287  ** connection between two regions. The Navmesh should automatically
288  ** choose the regions closest to the start and end points of the
289  ** path. By default this functionality is off, but once activated
290  ** it's assumed to be a two way connection.
291  **
292  *b Arguments:
293  **
294  *a use_as_portal - 1 to use as a connection, 0 to not
295  */
296  void set_use_as_navmesh_portal(int use_as_portal);
297 
298  /*l
299  *b Description:
300  **
301  ** This function returns if the path is being used as a connection
302  ** between two regions.
303  **
304  *b Returns:
305  **
306  *a 1 if is a connection, 0 if not
307  */
308  int get_use_as_navmesh_portal();
309 
310  /*l
311  *b Description:
312  **
313  ** This function tells the Navmesh regions to use this path as a one
314  ** way connection between two regions. Defaults to 0 (two way
315  ** connection)
316  **
317  *b Arguments:
318  **
319  *a one_way - 1 to set as one way connection, 0 to set as
320  *a bidirectional
321  */
322  void set_one_way_portal(int one_way);
323 
324  /*l
325  *b Description:
326  **
327  ** This function returns if the path is being used as a one way
328  ** connection between two regions.
329  **
330  *b Returns:
331  **
332  *a 1 if is one way connection, 0 if two way
333  */
334  int get_one_way_portal();
335 
336 
337 /****************************************************************************/
338 /****************************************************************************/
339 /****************************************************************************/
346 /****************************************************************************/
347 /****************************************************************************/
348 /****************************************************************************/
350  int translate(float tx, float ty, float tz);
352  int rotate_about_point(float rz, float rx, float ry,
353  float rotation_pt_x, float rotation_pt_y, float rotation_pt_z);
354 
355  int set_ground_clamp_when_on_path(int ground_clamp_when_on_path);
356  int get_ground_clamp_when_on_path();
357 
362 #ifdef CPLUSPLUS_ONLY
363 
364  bdiScenarioPathShape* get_scripted_object() {return m_path_shape;}
365 
366 private:
367 
368  /*l
369  ** A private constructor.
370  */
371  diguyPathShape(bdiScenarioPathShape* path_shape);
372 
373  /*l
374  ** A pointer to internal data.
375  */
376  bdiScenarioPathShape* m_path_shape;
377 
378  friend class bdiScenarioPathShape;
379  friend class diguyScenario;
380 
381 #endif
382 
383 };
384 
385 #endif /* __diguyPathShape_H */
386 
Definition: diguyPathShape.h:30
Represents the scenario currently being portrayed.
Definition: diguyScenario.h:100
Definition: diguyWaypoint.h:29