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