DI-Guy SDK Documentation  13.1
diguyLoadManager.h
Go to the documentation of this file.
1 
2 /*********************************************************************
3  ** Copyright (c) 1992-2015 VT MAK
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 class BDI_DECLSPEC_diguy diguyLoadManager
33 {
34 
35 /*****************************************************************************
36  **
37  ** The DI-Guy Load Manager is responsible for adjusting each
38  ** character's motion level of detail, as well as various update rates,
39  ** depending on where the character's are in relation to cameras.
40  */
41 
42 public:
43 
44  /*l
45  *b Description:
46  **
47  ** This is the top-level on/off switch for this load manager.
48  ** By default, load managers are disabled.
49  **
50  *b Callable From:
51  **
52  *- - C++
53  *- - Script
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  *b Callable From:
68  **
69  *- - C++
70  *- - Script
71  */
72  int get_enabled();
73 
74  /*l
75  *b Description:
76  **
77  ** Sets the minimum full update period to be used for all characters.
78  ** This potentially overrides the update rates otherwise set for
79  ** the character.
80  **
81  ** For example, if a character's position update rate were so low
82  ** that it would not be updated within this minimum update period,
83  ** it would be forced to update.
84  **
85  ** The default minimum update period is 0.5 seconds.
86  **
87  *b Arguments:
88  **
89  *a period - the minimum update period, in seconds
90  **
91  *b Returns:
92  **
93  ** 0 on success, -1 on failure
94  **
95  *b Callable From:
96  **
97  *- - C++
98  *- - Script
99  **/
100  int set_minimum_full_update_period(float period);
101 
102  /*l
103  *b Returns:
104  **
105  ** load manager's minimum full update period as set by
106  ** set_minimum_full_update_period()
107  **
108  *b Callable From:
109  **
110  *- - C++
111  *- - Script
112  */
113  float get_minimum_full_update_period();
114 
115  /*l
116  *b Description:
117  **
118  ** This function sets the far extents of load manager zone bounding
119  ** planes, in terms of their distance from the camera. Zone 0 is
120  ** between the camera near clipping plane and bounding plane 0.
121  ** Zone 1 is between bounding plane 0 and bounding plane 1. Zone
122  ** 2 is between bounding plane 1 and the camera far clipping
123  ** plane.
124  **
125  ** The defaults for the zone bounds should work reasonably well
126  ** in most cases, but some tweaking may be required in some cases.
127  **
128  ** Defaults:
129  *>
130  *- - zone 0: 10 meters
131  *- - zone 1: 20 meters
132  *- - zone 2: (camera far plane; cannot be set by this function)
133  *<
134  *b Arguments:
135  **
136  *a zone - zone to modify
137  *a far_extent - new far extent of zone
138  **
139  *b Returns:
140  **
141  ** 0 on success, -1 on failure
142  **
143  *b Callable From:
144  **
145  *- - C++
146  *- - Script
147  */
148  int set_zone_far_extent(int zone, float far_extent);
149 
150  /*l
151  *b Returns:
152  **
153  ** far extent of zone as set by set_zone_far_extent(),
154  ** -1.0 on failure
155  **
156  *b Arguments:
157  **
158  *a zone - zone to query
159  **
160  *b Callable From:
161  **
162  *- - C++
163  *- - Script
164  */
165  float get_zone_far_extent(int zone);
166  /*l
167  *b Description:
168  **
169  ** This function sets whether view and camera settings such as
170  ** field-of-view (FOV) and window size should be taken into account
171  ** when determining the zone of a character.
172  **
173  ** The base zone extents are distance-based, but this approach can
174  ** be problematic if the current camera's FOV is very narrow; a
175  ** narrow FOV essentially acts like a telephoto lens. In this case
176  ** a character that is far away, and would therefore be rendered
177  ** at low resolution, can actually be quite large in the 3D view.
178  **
179  ** Setting this flag to 1 will cause the FOV to be taken into account
180  ** when calculating effective zone extents.
181  **
182  ** In general zone extents assume that the vertical FOV of the
183  ** view is around 40. Smaller FOVs will scale the thresholds larger
184  ** so that zone changes happen further out. Likewise larger FOVs
185  ** will scale the extents smaller; in this case even nearby
186  ** characters will appear small and therefore need less resolution.
187  **
188  *b Arguments:
189  **
190  ** do_scale - pass 1 to enable scaling, 0 to disable
191  **
192  *b Callable From:
193  **
194  *- - C++
195  *- - Script
196  */
197  void set_scale_zone_extents_from_view_settings(int do_scale);
198 
199  /*l
200  *b Returns:
201  **
202  ** most recent setting of
203  ** set_scale_zone_extents_from_view_settings()
204  **
205  *b Callable From:
206  **
207  *- - C++
208  *- - Script
209  */
210  int get_scale_zone_extents_from_view_settings();
211 
212  /*l
213  *b Description:
214  **
215  ** This function set the position update rate for the given zone.
216  **
217  ** The position update rate is the percentage of frames in
218  ** which the overall position of the character will be updated.
219  ** Passing 100 will cause character positions to be updated every
220  ** frame; passing 50 will cause character positions to be updated
221  ** every other frame.
222  **
223  ** Defaults:
224  *>
225  *- - zone 0: 100
226  *- - zone 1: 100
227  *- - zone 2: 100
228  *<
229  *b Arguments:
230  **
231  *a zone - zone to modify
232  *a position_update_rate - new position update rate
233  **
234  *b Returns:
235  **
236  ** 0 on success, -1 on failure
237  **
238  *b Callable From:
239  **
240  *- - C++
241  *- - Script
242  **
243  *b C++ Example:
244  **
245  *e set_zone_position_update_rate(0, 100);
246  *e set_zone_position_update_rate(1, 80);
247  *e set_zone_position_update_rate(2, 50);
248  **
249  ** In this example characters in zone 0 will have their positions
250  ** updated every frame (100%). Characters in zone 1 will have
251  ** their positions updated every four out of five frames (80%).
252  ** Characters in zone 2 will have their positions updated every other
253  ** frame (50%).
254  */
255  int set_zone_position_update_rate(int zone, int position_update_rate);
256 
257  /*l
258  *b Returns:
259  **
260  ** position update rate of zone as set by
261  ** set_zone_position_update_rate();
262  ** -1 on failure
263  **
264  *b Arguments:
265  **
266  *a zone - zone to query
267  **
268  *b Callable From:
269  **
270  *- - C++
271  *- - Script
272  */
273  int get_zone_position_update_rate(int zone);
274 
275  /*l
276  *b Description:
277  **
278  ** This function set the altitude update rate for the given zone.
279  **
280  ** The position update rate is the percentage of frames in
281  ** which the altitude, or Z position, of the character will be
282  ** updated.
283  **
284  ** Passing 100 will cause character altitudes to be updated every
285  ** frame; passing 50 will cause character altitudes to be updated
286  ** every other frame.
287  **
288  ** Defaults:
289  *>
290  *- - zone 0: 100
291  *- - zone 1: 100
292  *- - zone 2: 100
293  *<
294  *b Arguments:
295  **
296  *a zone - zone to modify
297  *a update_rate - new update rate
298  **
299  *b Returns:
300  **
301  ** 0 on success, -1 on failure
302  **
303  *b Callable From:
304  **
305  *- - C++
306  *- - Script
307  */
308  int set_zone_altitude_update_rate(int zone, int update_rate);
309 
310  /*l
311  *b Returns:
312  **
313  ** altitude update rate of zone as set by
314  ** set_zone_altitude_update_rate();
315  ** -1 on failure
316  **
317  *b Arguments:
318  **
319  *a zone - zone to query
320  **
321  *b Callable From:
322  **
323  *- - C++
324  *- - Script
325  */
326  int get_zone_altitude_update_rate(int zone);
327 
328  /*l
329  *b Description:
330  **
331  ** This function set the pose update rate for the given zone.
332  **
333  ** The pose update rate is the percentage of frames in which the
334  ** pose of the character will be updated. The pose includes all
335  ** joint angles of the character, but does not include the overall
336  ** position.
337  **
338  ** Defaults:
339  *>
340  *- - zone 0: 100
341  *- - zone 1: 50
342  *- - zone 2: 33
343  *<
344  *b Arguments:
345  **
346  *a zone - zone to modify
347  *a pose_update_rate - new pose update rate
348  **
349  *b Returns:
350  **
351  ** 0 on success, -1 on failure
352  **
353  *b Callable From:
354  **
355  *- - C++
356  *- - Script
357  */
358  int set_zone_pose_update_rate(int zone, int pose_update_rate);
359 
360  /*l
361  *b Returns:
362  **
363  ** pose update rate of zone as set by
364  ** set_zone_pose_update_rate();
365  ** -1 on failure
366  **
367  *b Arguments:
368  **
369  *a zone - zone to query
370  **
371  *b Callable From:
372  **
373  *- - C++
374  *- - Script
375  */
376  int get_zone_pose_update_rate(int zone);
377 
378  /*l
379  *b Description:
380  **
381  ** This function set the motion LOD for the given zone.
382  **
383  ** See diguyCharacter::set_motion_lod() for a discussion
384  ** of motion LODs.
385  **
386  ** Defaults:
387  *>
388  *- - zone 0: 1
389  *- - zone 1: 2
390  *- - zone 2: 3
391  *<
392  *b Arguments:
393  **
394  *a zone - zone to modify
395  *a motion_lod - new motion LOD
396  **
397  *b Returns:
398  **
399  ** 0 on success, -1 on failure
400  **
401  *b Callable From:
402  **
403  *- - C++
404  *- - Script
405  */
406  int set_zone_motion_lod(int zone, int motion_lod);
407 
408  /*l
409  *b Returns:
410  **
411  ** motion LOD of zone as set by set_zone_motion_lod();
412  ** -1 on failure
413  **
414  *b Arguments:
415  **
416  *a zone - zone to query
417  **
418  *b Callable From:
419  **
420  *- - C++
421  *- - Script
422  */
423  int get_zone_motion_lod(int zone);
424 
425  /*l
426  *b Description:
427  **
428  ** See diguyCharacter::set_minimum_cpl() for a description
429  ** of what affect this parameter will have on load managed
430  ** characters.
431  *<
432  *b Arguments:
433  **
434  *a zone - zone to modify
435  *a minimum_cpl - new minimum CPL
436  **
437  *b Returns:
438  **
439  ** 0 on success, -1 on failure
440  **
441  *b Callable From:
442  **
443  *- - C++
444  *- - Script
445  */
446  int set_zone_minimum_cpl(int zone, int minimum_cpl);
447 
448  /*l
449  *b Returns:
450  **
451  ** minimum CPL of zone as set by get_zone_minimum_cpl();
452  ** -1 on failure
453  **
454  *b Arguments:
455  **
456  *a zone - zone to query
457  **
458  *b Callable From:
459  **
460  *- - C++
461  *- - Script
462  */
463  int get_zone_minimum_cpl(int zone);
464 
465  /*l
466  *b Description:
467  **
468  ** See diguyCharacter::set_all_blends_disabled() for a description
469  ** of what affect this parameter will have on load managed
470  ** characters.
471  *<
472  *b Arguments:
473  **
474  *a zone - zone to modify
475  *a disabled_flag - pass 1 to disable, 0 to enable
476  **
477  *b Returns:
478  **
479  ** 0 on success, -1 on failure
480  **
481  *b Callable From:
482  **
483  *- - C++
484  *- - Script
485  */
486  int set_zone_all_blends_disabled(int zone, int disabled_flag);
487 
488  /*l
489  *b Returns:
490  **
491  ** whether all blends are disabled in the specified zone;
492  ** -1 on failure
493  **
494  *b Arguments:
495  **
496  *a zone - zone to query
497  **
498  *b Callable From:
499  **
500  *- - C++
501  *- - Script
502  */
503  int get_zone_all_blends_disabled(int zone);
504 
505  /*l
506  *b Description:
507  **
508  ** See diguyCharacter::set_shape_switches_disabled() for a
509  ** description of what affect this parameter will have on load
510  ** managed characters.
511  *<
512  *b Arguments:
513  **
514  *a zone - zone to modify
515  *a disabled_flag - pass 1 to disable, 0 to enable
516  **
517  *b Returns:
518  **
519  ** 0 on success, -1 on failure
520  **
521  *b Callable From:
522  **
523  *- - C++
524  *- - Script
525  */
526  int set_zone_shape_switches_disabled(int zone, int disabled_flag);
527 
528  /*l
529  *b Returns:
530  **
531  ** whether all shape switches are disabled in the specified zone;
532  ** -1 on failure
533  **
534  *b Arguments:
535  **
536  *a zone - zone to query
537  **
538  *b Callable From:
539  **
540  *- - C++
541  *- - Script
542  */
543  int get_zone_shape_switches_disabled(int zone);
544 
545  /*l
546  *b Description:
547  **
548  ** See diguyCharacter::set_shape_callbacks_disabled() for a
549  ** description of what affect this parameter will have on load
550  ** managed characters.
551  *<
552  *b Arguments:
553  **
554  *a zone - zone to modify
555  *a disabled_flag - pass 1 to disable, 0 to enable
556  **
557  *b Returns:
558  **
559  ** 0 on success, -1 on failure
560  **
561  *b Callable From:
562  **
563  *- - C++
564  *- - Script
565  */
566  int set_zone_shape_callbacks_disabled(int zone, int disabled_flag);
567 
568  /*l
569  *b Returns:
570  **
571  ** whether all shape callbacks are disabled in the specified zone;
572  ** -1 on failure
573  **
574  *b Arguments:
575  **
576  *a zone - zone to query
577  **
578  *b Callable From:
579  **
580  *- - C++
581  *- - Script
582  */
583  int get_zone_shape_callbacks_disabled(int zone);
584 
585  /*l
586  *b Description:
587  **
588  ** See diguyCharacter::set_graphics_api_shape_update_disabled()
589  ** for a description of what affect this parameter will have on
590  ** load managed characters.
591  *<
592  *b Arguments:
593  **
594  *a zone - zone to modify
595  *a disabled_flag - pass 1 to disable, 0 to enable
596  **
597  *b Returns:
598  **
599  ** 0 on success, -1 on failure
600  **
601  *b Callable From:
602  **
603  *- - C++
604  *- - Script
605  */
606  int set_zone_graphics_api_shape_update_disabled(int zone, int disabled_flag);
607 
608  /*l
609  *b Returns:
610  **
611  ** whether all graphics API shape updates are disabled in the
612  ** specified zone; -1 on failure
613  **
614  *b Arguments:
615  **
616  *a zone - zone to query
617  **
618  *b Callable From:
619  **
620  *- - C++
621  *- - Script
622  */
623  int get_zone_graphics_api_shape_update_disabled(int zone);
624 
625 
626 /****************************************************************************/
627 /****************************************************************************/
628 /*****************************************************************************
629  **
630  *2 Deprecated Functions
631  **
632  ** The following functions are deprecated.
633  **
634  ** As these functions may disappear in a future version of DI-Guy,
635  ** it is recommended that you remove calls to these functions from
636  ** your application.
637  **
638  */
639 /****************************************************************************/
640 /****************************************************************************/
641 /****************************************************************************/
642 
643  /*l
644  *b Description:
645  **
646  ** Deprecated as of 7.1.0, removed in 8.5.0.
647  ** Use the function diguyLoadManager::set_minimum_full_update_period()
648  ** instead.
649  */
650  //int set_max_update_period(float period);
651 
652  /*l
653  *b Description:
654  **
655  ** Deprecated as of 7.1.0, removed in 8.5.0.
656  ** Use the function diguyLoadManager::set_zone_position_update_rate()
657  ** instead, with the zone argument set to
658  ** DIGUY_LOAD_MANAGER_NUM_NONVISIBLE_ZONE_INDEX.
659  */
660  //void set_nonvisible_update_rate(int update_rate);
661 
662  /*l
663  *b Description:
664  **
665  ** Deprecated as of 7.1.0, removed in 8.5.0.
666  ** Use the function diguyLoadManager::set_zone_far_extent() instead.
667  */
668  //int set_zone_bounds(float distance0, float distance1);
669 
670  /*l
671  *b Description:
672  **
673  ** Deprecated as of 7.1.0, removed in 8.5.0.
674  ** Use the following functions instead:
675  *>
676  *- - diguyLoadManager::set_zone_position_update_rate()
677  *- - diguyLoadManager::set_zone_pose_update_rate()
678  *- - diguyLoadManager::set_zone_motion_lod()
679  *<
680  */
681  //int set_zone_parameters(int zone,
682  // int position_update_rate,
683  // int motion_update_rate,
684  // int motion_lod);
685 
690 #ifdef CPLUSPLUS_ONLY
691 
692  bdiScenarioCharacterLoadManager* get_scripted_object() {return m_load_manager;}
693 
694 private:
695 
696  /*l
697  ** A private constructor. Use the DI-Guy function
698  ** diguy_create_load_manager() to obtain a diguyLoadManager object
699  ** pointer.
700  */
701  diguyLoadManager(bdiScenarioCharacterLoadManager* lm);
702 
703  /*l
704  ** A private destructor.
705  */
706  virtual ~diguyLoadManager();
707 
708  /*l
709  ** A pointer to internal data.
710  */
711  bdiScenarioCharacterLoadManager* m_load_manager;
712 
713  friend class bdiScenarioCharacterLoadManager;
714 
715 #endif
716 
717 };
718 
719 #endif
720 
Definition: diguyLoadManager.h:30
The class that represents a camera in the world.
Definition: diguyViewCamera.h:90