DI-Guy SDK Documentation  13.7.1
diguyLoadManager.h
Go to the documentation of this file.
1 
2 /*********************************************************************
3  ** Copyright (c) 1992-2022 MAK Technologies, Inc.
4  ** All rights reserved.
5  *********************************************************************/
6 
7 /*********************************************************************
8  **
9  *t diguyLoadManager
10  **
11  *b Link against: libdiguy
12  */
13 
14 #ifndef __diguyLoadManager_H
15 #define __diguyLoadManager_H
16 
17 #ifdef SWIG
18 %module diguyLoadManager
19 #else
20 #define CPLUSPLUS_ONLY
21 #endif
22 
23 #ifdef CPLUSPLUS_ONLY
24 class bdiScenarioCharacterLoadManager;
25 class diguyViewCamera;
26 #endif
27 
28 #include <declspec_diguy.h>
29 
30 
31 /*****************************************************************************
32  **
33  ** The DI-Guy Load Manager is responsible for adjusting each
34  ** character's motion level of detail, as well as various update rates,
35  ** depending on where the character's are in relation to cameras.
36  ** All functions are callable From:
37  **
38  *- - C++
39  *- - Script
40  **
41  * \ingroup diguyCore
42  */
43 class BDI_DECLSPEC_diguy diguyLoadManager
44 {
45 
46 
47 public:
48 
49  /*l
50  *b Description:
51  **
52  ** This is the top-level on/off switch for this load manager.
53  ** By default, load managers are disabled.
54  */
55  void set_enabled(int enabled);
56 
57  /*l
58  *b Description:
59  **
60  ** Returns whether this load manager is enabled, as set by the
61  ** set_enabled() call.
62  **
63  *b Returns:
64  **
65  ** 1 if this load manager is enabled, 0 if not
66  */
67  int get_enabled();
68 
69  /*l
70  *b Description:
71  **
72  ** Sets the minimum full update period to be used for all characters.
73  ** This potentially overrides the update rates otherwise set for
74  ** the character.
75  **
76  ** For example, if a character's position update rate were so low
77  ** that it would not be updated within this minimum update period,
78  ** it would be forced to update.
79  **
80  ** The default minimum update period is 0.5 seconds.
81  **
82  *b Arguments:
83  **
84  *a period - the minimum update period, in seconds
85  **
86  *b Returns:
87  **
88  ** 0 on success, -1 on failure
89  **/
90  int set_minimum_full_update_period(float period);
91 
92  /*l
93  *b Returns:
94  **
95  ** load manager's minimum full update period as set by
96  ** set_minimum_full_update_period()
97  */
98  float get_minimum_full_update_period();
99 
100  /*l
101  *b Description:
102  **
103  ** This function sets the far extents of load manager zone bounding
104  ** planes, in terms of their distance from the camera. Zone 0 is
105  ** between the camera near clipping plane and bounding plane 0.
106  ** Zone 1 is between bounding plane 0 and bounding plane 1. Zone
107  ** 2 is between bounding plane 1 and the camera far clipping
108  ** plane.
109  **
110  ** The defaults for the zone bounds should work reasonably well
111  ** in most cases, but some tweaking may be required in some cases.
112  **
113  ** Defaults:
114  *>
115  *- - zone 0: 10 meters
116  *- - zone 1: 20 meters
117  *- - zone 2: (camera far plane; cannot be set by this function)
118  *<
119  *b Arguments:
120  **
121  *a zone - zone to modify
122  *a far_extent - new far extent of zone
123  **
124  *b Returns:
125  **
126  ** 0 on success, -1 on failure
127  */
128  int set_zone_far_extent(int zone, float far_extent);
129 
130  /*l
131  *b Returns:
132  **
133  ** far extent of zone as set by set_zone_far_extent(),
134  ** -1.0 on failure
135  **
136  *b Arguments:
137  **
138  *a zone - zone to query
139  */
140  float get_zone_far_extent(int zone);
141 
142  /*l
143  *b Description:
144  **
145  ** This function sets whether view and camera settings such as
146  ** field-of-view (FOV) and window size should be taken into account
147  ** when determining the zone of a character.
148  **
149  ** The base zone extents are distance-based, but this approach can
150  ** be problematic if the current camera's FOV is very narrow; a
151  ** narrow FOV essentially acts like a telephoto lens. In this case
152  ** a character that is far away, and would therefore be rendered
153  ** at low resolution, can actually be quite large in the 3D view.
154  **
155  ** Setting this flag to 1 will cause the FOV to be taken into account
156  ** when calculating effective zone extents.
157  **
158  ** In general zone extents assume that the vertical FOV of the
159  ** view is around 40. Smaller FOVs will scale the thresholds larger
160  ** so that zone changes happen further out. Likewise larger FOVs
161  ** will scale the extents smaller; in this case even nearby
162  ** characters will appear small and therefore need less resolution.
163  **
164  *b Arguments:
165  **
166  ** do_scale - pass 1 to enable scaling, 0 to disable
167  */
168  void set_scale_zone_extents_from_view_settings(int do_scale);
169 
170  /*l
171  *b Returns:
172  **
173  ** most recent setting of
174  ** set_scale_zone_extents_from_view_settings()
175  */
176  int get_scale_zone_extents_from_view_settings();
177 
178  /*l
179  *b Description:
180  **
181  ** This function set the position update rate for the given zone.
182  **
183  ** The position update rate is the percentage of frames in
184  ** which the overall position of the character will be updated.
185  ** Passing 100 will cause character positions to be updated every
186  ** frame; passing 50 will cause character positions to be updated
187  ** every other frame.
188  **
189  ** Defaults:
190  *>
191  *- - zone 0: 100
192  *- - zone 1: 100
193  *- - zone 2: 100
194  *<
195  *b Arguments:
196  **
197  *a zone - zone to modify
198  *a position_update_rate - new position update rate
199  **
200  *b Returns:
201  **
202  ** 0 on success, -1 on failure
203  **
204  *b C++ Example:
205  **
206  *e set_zone_position_update_rate(0, 100);
207  *e set_zone_position_update_rate(1, 80);
208  *e set_zone_position_update_rate(2, 50);
209  **
210  ** In this example characters in zone 0 will have their positions
211  ** updated every frame (100%). Characters in zone 1 will have
212  ** their positions updated every four out of five frames (80%).
213  ** Characters in zone 2 will have their positions updated every other
214  ** frame (50%).
215  */
216  int set_zone_position_update_rate(int zone, int position_update_rate);
217 
218  /*l
219  *b Returns:
220  **
221  ** position update rate of zone as set by
222  ** set_zone_position_update_rate();
223  ** -1 on failure
224  **
225  *b Arguments:
226  **
227  *a zone - zone to query
228  */
229  int get_zone_position_update_rate(int zone);
230 
231  /*l
232  *b Description:
233  **
234  ** This function set the altitude update rate for the given zone.
235  **
236  ** The position update rate is the percentage of frames in
237  ** which the altitude, or Z position, of the character will be
238  ** updated.
239  **
240  ** Passing 100 will cause character altitudes to be updated every
241  ** frame; passing 50 will cause character altitudes to be updated
242  ** every other frame.
243  **
244  ** Defaults:
245  *>
246  *- - zone 0: 100
247  *- - zone 1: 100
248  *- - zone 2: 100
249  *<
250  *b Arguments:
251  **
252  *a zone - zone to modify
253  *a update_rate - new update rate
254  **
255  *b Returns:
256  **
257  ** 0 on success, -1 on failure
258  */
259  int set_zone_altitude_update_rate(int zone, int update_rate);
260 
261  /*l
262  *b Returns:
263  **
264  ** altitude update rate of zone as set by
265  ** set_zone_altitude_update_rate();
266  ** -1 on failure
267  **
268  *b Arguments:
269  **
270  *a zone - zone to query
271  */
272  int get_zone_altitude_update_rate(int zone);
273 
274  /*l
275  *b Description:
276  **
277  ** This function set the pose update rate for the given zone.
278  **
279  ** The pose update rate is the percentage of frames in which the
280  ** pose of the character will be updated. The pose includes all
281  ** joint angles of the character, but does not include the overall
282  ** position.
283  **
284  ** Defaults:
285  *>
286  *- - zone 0: 100
287  *- - zone 1: 50
288  *- - zone 2: 33
289  *<
290  *b Arguments:
291  **
292  *a zone - zone to modify
293  *a pose_update_rate - new pose update rate
294  **
295  *b Returns:
296  **
297  ** 0 on success, -1 on failure
298  */
299  int set_zone_pose_update_rate(int zone, int pose_update_rate);
300 
301  /*l
302  *b Returns:
303  **
304  ** pose update rate of zone as set by
305  ** set_zone_pose_update_rate();
306  ** -1 on failure
307  **
308  *b Arguments:
309  **
310  *a zone - zone to query
311  */
312  int get_zone_pose_update_rate(int zone);
313 
314  /*l
315  *b Description:
316  **
317  ** This function set the motion LOD for the given zone.
318  **
319  ** See diguyCharacter::set_motion_lod() for a discussion
320  ** of motion LODs.
321  **
322  ** Defaults:
323  *>
324  *- - zone 0: 1
325  *- - zone 1: 2
326  *- - zone 2: 3
327  *<
328  *b Arguments:
329  **
330  *a zone - zone to modify
331  *a motion_lod - new motion LOD
332  **
333  *b Returns:
334  **
335  ** 0 on success, -1 on failure
336  */
337  int set_zone_motion_lod(int zone, int motion_lod);
338 
339  /*l
340  *b Returns:
341  **
342  ** motion LOD of zone as set by set_zone_motion_lod();
343  ** -1 on failure
344  **
345  *b Arguments:
346  **
347  *a zone - zone to query
348  */
349  int get_zone_motion_lod(int zone);
350 
351  /*l
352  *b Description:
353  **
354  ** See diguyCharacter::set_minimum_cpl() for a description
355  ** of what affect this parameter will have on load managed
356  ** characters.
357  *<
358  *b Arguments:
359  **
360  *a zone - zone to modify
361  *a minimum_cpl - new minimum CPL
362  **
363  *b Returns:
364  **
365  ** 0 on success, -1 on failure
366  */
367  int set_zone_minimum_cpl(int zone, int minimum_cpl);
368 
369  /*l
370  *b Returns:
371  **
372  ** minimum CPL of zone as set by get_zone_minimum_cpl();
373  ** -1 on failure
374  **
375  *b Arguments:
376  **
377  *a zone - zone to query
378  */
379  int get_zone_minimum_cpl(int zone);
380 
381  /*l
382  *b Description:
383  **
384  ** See diguyCharacter::set_all_blends_disabled() for a description
385  ** of what affect this parameter will have on load managed
386  ** characters.
387  *<
388  *b Arguments:
389  **
390  *a zone - zone to modify
391  *a disabled_flag - pass 1 to disable, 0 to enable
392  **
393  *b Returns:
394  **
395  ** 0 on success, -1 on failure
396  */
397  int set_zone_all_blends_disabled(int zone, int disabled_flag);
398 
399  /*l
400  *b Returns:
401  **
402  ** whether all blends are disabled in the specified zone;
403  ** -1 on failure
404  **
405  *b Arguments:
406  **
407  *a zone - zone to query
408  **
409  */
410  int get_zone_all_blends_disabled(int zone);
411 
412 
413  /*l
414  *b Description:
415  **
416  ** See diguyCharacter::set_shape_callbacks_disabled() for a
417  ** description of what affect this parameter will have on load
418  ** managed characters.
419  *<
420  *b Arguments:
421  **
422  *a zone - zone to modify
423  *a disabled_flag - pass 1 to disable, 0 to enable
424  **
425  *b Returns:
426  **
427  ** 0 on success, -1 on failure
428  */
429  int set_zone_shape_callbacks_disabled(int zone, int disabled_flag);
430 
431  /*l
432  *b Returns:
433  **
434  ** whether all shape callbacks are disabled in the specified zone;
435  ** -1 on failure
436  **
437  *b Arguments:
438  **
439  *a zone - zone to query
440  */
441  int get_zone_shape_callbacks_disabled(int zone);
442 
443  /*l
444  *b Description:
445  **
446  ** See diguyCharacter::set_graphics_api_shape_update_disabled()
447  ** for a description of what affect this parameter will have on
448  ** load managed characters.
449  *<
450  *b Arguments:
451  **
452  *a zone - zone to modify
453  *a disabled_flag - pass 1 to disable, 0 to enable
454  **
455  *b Returns:
456  **
457  ** 0 on success, -1 on failure
458  */
459  int set_zone_graphics_api_shape_update_disabled(int zone, int disabled_flag);
460 
461  /*l
462  *b Returns:
463  **
464  ** whether all graphics API shape updates are disabled in the
465  ** specified zone; -1 on failure
466  **
467  *b Arguments:
468  **
469  *a zone - zone to query
470  */
471  int get_zone_graphics_api_shape_update_disabled(int zone);
472 
474  int set_draw_visuals(int value);
476  int get_draw_visuals();
477 
479 /****************************************************************************/
480 /****************************************************************************/
481 /*****************************************************************************
482  **
483  *2 Deprecated Functions
484  **
485  ** The following functions are deprecated.
486  **
487  ** As these functions may disappear in a future version of DI-Guy,
488  ** it is recommended that you remove calls to these functions from
489  ** your application.
490  **
491  */
492 /****************************************************************************/
493 /****************************************************************************/
494 /****************************************************************************/
495  // removed functionality
496  // int set_zone_shape_switches_disabled(int zone, int disabled_flag);
497 
498  // int get_zone_shape_switches_disabled(int zone);
503 #ifdef CPLUSPLUS_ONLY
504 
505  bdiScenarioCharacterLoadManager* get_scripted_object() {return m_load_manager;}
506 
507 private:
508 
509  /*l
510  ** A private constructor. Use the DI-Guy function
511  ** diguy_create_load_manager() to obtain a diguyLoadManager object
512  ** pointer.
513  */
514  diguyLoadManager(bdiScenarioCharacterLoadManager* lm);
515 
516  /*l
517  ** A private destructor.
518  */
519  virtual ~diguyLoadManager();
520 
521  /*l
522  ** A pointer to internal data.
523  */
524  bdiScenarioCharacterLoadManager* m_load_manager;
525 
526  friend class bdiScenarioCharacterLoadManager;
527 
528 #endif
529 
530 };
531 
532 #endif
533 
Definition: diguyLoadManager.h:41
The class that represents a camera in the world.
Definition: diguyViewCamera.h:260