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