DI-Guy SDK Documentation  13.1
diguyGraphicsLink.h
Go to the documentation of this file.
1 
2 /*********************************************************************
3  ** Copyright (c) 1992-2015 VT MAK
4  ** All rights reserved.
5  *********************************************************************/
6 
7 /*********************************************************************/
14 #ifndef __diguyGraphicsLink_H
15 #define __diguyGraphicsLink_H
16 
17 #ifdef SWIG
18 %module diguyGraphicsLink
19 #else
20 #define CPLUSPLUS_ONLY
21 #endif
22 
23 #ifdef CPLUSPLUS_ONLY
24 #include <diguy_constants.h>
25 
26 class bdiLink;
27 class diguyCharacter;
28 class diguyGraphicsLink;
29 class diguyGraphicsShape;
31 
32 
33 #endif
34 
35 #include <declspec_diguy.h>
36 
37 //------------------------------------------------------------------------------
50 /****************************************************************************/
51 class BDI_DECLSPEC_diguy diguyGraphicsLink
52 {
53 
54 public:
55 
56 /*****************************************************************************/
69  /*l
70  *b Description:
71  **
72  ** Returns the name of the link. This pointer will
73  ** never be NULL.
74  **
75  *b Returns:
76  **
77  ** name of the link
78  */
79  const char* get_name();
80 
81  /*l
82  *b Description:
83  **
84  ** All links are assigned a unique identifier, or uid. This
85  ** function returns this links's uid.
86  **
87  ** *Note*: unique identifiers will change between DI-Guy runs!
88  **
89  *b Returns:
90  **
91  ** unique identifier of object
92  */
93  long get_uid();
94 
95  /*l
96  *b Returns:
97  **
98  ** index of the link
99  */
100  int get_index();
101 
102  /*l
103  *b Description:
104  **
105  ** Returns a pointer to the diguyCharacter to which this link
106  ** belongs.
107  **
108  *b Returns:
109  **
110  ** pointer of type diguyCharacter
111  */
112  diguyCharacter* get_character();
113 
114  /*l
115  *b Returns:
116  **
117  ** number of shapes on this link
118  */
119  int get_num_shapes();
120 
121  /*l
122  *b Returns:
123  **
124  ** pointer of type diguyGraphicsShape; NULL if no shape at the
125  ** specified index
126  **
127  *b Arguments:
128  **
129  *a index - index of the shape; indices start at 0
130  */
131  diguyGraphicsShape* get_shape_at_index(int index);
132 
133  /*l
134  *b Description:
135  **
136  ** This function returns a pointer to the specified shape.
137  **
138  *b Arguments:
139  **
140  *a name - name of link to be found
141  **
142  *b Returns:
143  **
144  ** pointer of type diguyGraphicsShape; NULL if not found
145  */
146  diguyGraphicsShape* find_shape(const char* name);
147 
148  /*l
149  *b Description:
150  **
151  ** This function returns a pointer to the specified shape.
152  **
153  *b Arguments:
154  **
155  *a name - name of shape with class_type to be found,
156  *a currently works with heads
157  **
158  *b Returns:
159  **
160  ** pointer of type diguyGraphicsShape; NULL if not found
161  */
162  diguyGraphicsShape* find_shape_by_class_type(const char* name);
163 
164  /*l
165  *b Description:
166  **
167  ** Returns the type of joint that attaches this link to its parent.
168  **
169  *b Returns:
170  **
171  ** joint type of the link
172  */
173  diguyGraphicsJointType get_joint_type();
174 
175  /*l
176  *b Description:
177  **
178  ** Returns in the passed variables the translation offset of this
179  ** link from its parent.
180  **
181  ** The offset will always remain fixed once DI-Guy is initialized.
182  **
183  ** Returned values are in meters.
184  **
185  *b Arguments:
186  **
187  *a tx, ty, tz - pointers to floats into which result
188  *a should be placed
189  **
190  *b Returns:
191  **
192  ** 0 on success, -1 on failure
193  */
194  int get_offset_translation(float* tx, float* ty, float* tz);
195 
196  /*l
197  *b Description:
198  **
199  ** Returns in the passed variables the rotational offset of this link
200  ** from its parent.
201  **
202  ** The offset will always remain fixed once DI-Guy is initialized.
203  **
204  ** Returned values are an Euler triple in degrees, and should be
205  ** applied in RZ -> RX -> RY order, after the translation offset.
206  **
207  *b Arguments:
208  **
209  *a rz, rx, ry - pointers to floats into which result
210  *a should be placed
211  **
212  *b Returns:
213  **
214  ** 0 on success, -1 on failure
215  */
216  int get_offset_rotation(float* rz, float* rx, float* ry);
217 
218  /*l
219  *b Description:
220  **
221  ** Returns in the passed variables the translation amount of the
222  ** link's joint.
223  **
224  ** If there is a current render camera set, the position link's
225  ** values will be in the local space of the camera. This is useful
226  ** for rendering far from the origin.
227  **
228  ** The values may or may not stay constant frame to frame; see
229  ** get_translation_is_static().
230  **
231  ** Returned values are in meters, and should be applied after the
232  ** rotational offset (if any).
233  **
234  *b Arguments:
235  **
236  *a tx, ty, tz - pointers to floats into which result
237  *a should be placed
238  **
239  *b Returns:
240  **
241  ** 0 on success, -1 on failure
242  */
243  int get_translation(float* tx, float* ty, float* tz);
244 
245  /*l
246  *b Description:
247  **
248  ** Returns in the passed variables the translation amount of the
249  ** link's joint.
250  **
251  ** The values may or may not stay constant frame to frame; see
252  ** get_translation_is_static().
253  **
254  ** Returned values are in meters, and should be applied after the
255  ** rotational offset (if any).
256  **
257  *b Arguments:
258  **
259  *a tx, ty, tz - pointers to doubles into which result
260  *a should be placed
261  **
262  *b Returns:
263  **
264  ** 0 on success, -1 on failure
265  */
266  int get_translation_double(double* tx, double* ty, double* tz);
267 
268  /*l
269  *b Description:
270  **
271  ** Returns whether the translation returned by get_translation() is
272  ** static (unchanging) or dynamic (can change frame to frame).
273  **
274  ** If the translation is dynamic the translation values will come
275  ** from one or more DI-Guy motion variables; the names of the
276  ** variables are accessible using the functions get_var_name_tx(),
277  ** etc.
278  **
279  ** If the translation is static it will remain so; the value returned
280  ** by this function should not change frame to frame.
281  **
282  *b Returns:
283  **
284  ** 1 if translation is static, 0 if not, -1 on failure
285  */
286  int get_translation_is_static();
287 
288  /*l
289  *b Description:
290  **
291  ** Returns the name of the DI-Guy motion data variable that controls
292  ** translation along the X axis.
293  **
294  ** The returned pointer will be NULL if there is no associated
295  ** variable.
296  **
297  *b Returns:
298  **
299  ** name of the variable; NULL if there is no variable
300  */
301  const char* get_var_name_tx();
302 
303  /*l
304  *b Description:
305  **
306  ** Returns the name of the DI-Guy motion data variable that controls
307  ** translation along the Y axis.
308  **
309  ** The returned pointer will be NULL if there is no associated
310  ** variable.
311  **
312  *b Returns:
313  **
314  ** name of the variable; NULL if there is no variable
315  */
316  const char* get_var_name_ty();
317 
318  /*l
319  *b Description:
320  **
321  ** Returns the name of the DI-Guy motion data variable that controls
322  ** translation along the Z axis.
323  **
324  ** The returned pointer will be NULL if there is no associated
325  ** variable.
326  **
327  *b Returns:
328  **
329  ** name of the variable; NULL if there is no variable
330  */
331  const char* get_var_name_tz();
332 
333  /*l
334  *b Description:
335  **
336  ** Returns in the passed variables the rotation amount of the link's
337  ** joint.
338  **
339  ** The values may or may not stay constant frame to frame; see
340  ** get_rotation_is_static().
341  **
342  ** Returned values are an Euler triple in degrees, and should be
343  ** applied in RZ -> RX -> RY order, after the translation.
344  **
345  *b Arguments:
346  **
347  *a rz, rx, ry - pointers to floats into which result
348  *a should be placed
349  **
350  *b Returns:
351  **
352  ** 0 on success, -1 on failure
353  */
354  int get_rotation(float* rz, float* rx, float* ry);
355 
356  /*l
357  *b Description:
358  **
359  ** Returns in the passed variables the rotation amount of the link's
360  ** joint.
361  **
362  ** The values may or may not stay constant frame to frame; see
363  ** get_rotation_is_static().
364  **
365  ** Returned values are an Euler triple in degrees, and should be
366  ** applied in RZ -> RX -> RY order, after the translation.
367  **
368  *b Arguments:
369  **
370  *a rz, rx, ry - pointers to floats into which result
371  *a should be placed
372  **
373  *b Returns:
374  **
375  ** 0 on success, -1 on failure
376  */
377  int get_rotation_euler(float* rz, float* rx, float* ry);
378 
379  /*l
380  *b Description:
381  **
382  ** Returns in the passed variables the rotation amount of the link's
383  ** joint.
384  **
385  ** The values may or may not stay constant frame to frame; see
386  ** get_rotation_is_static().
387  **
388  ** Returned values are a quaternion and should be applied after
389  ** the translation.
390  **
391  *b Arguments:
392  **
393  *a qx, qy, qz, qw - pointers to floats into which result
394  *a should be placed
395  **
396  *b Returns:
397  **
398  ** 0 on success, -1 on failure
399  */
400  int get_rotation_quat(float* qx, float* qy, float* qz, float* qw);
401 
402  /*l
403  *b Description:
404  **
405  ** Returns whether the rotation returned by get_rotation() is static
406  ** (unchanging) or dynamic (can change frame to frame).
407  **
408  ** If the rotation is dynamic the rotation values will come from one
409  ** or more DI-Guy motion variables; the names of the variables are
410  ** accessible using the functions get_var_name_rz(), etc.
411  **
412  ** If the rotation is static it will remain so; the value returned by
413  ** this function should not change frame to frame.
414  **
415  *b Returns:
416  **
417  ** 1 if rotation is static, 0 if not, -1 on failure
418  */
419  int get_rotation_is_static();
420 
421  /*l
422  *b Description:
423  **
424  ** Returns the name of the DI-Guy motion data variable that controls
425  ** rotation about the Z axis.
426  **
427  ** The returned pointer will be NULL if there is no associated
428  ** variable.
429  */
430  const char* get_var_name_rz();
431 
432  /*l
433  *b Description:
434  **
435  ** Returns the name of the DI-Guy motion data variable that controls
436  ** rotation about the X axis.
437  **
438  ** The returned pointer will be NULL if there is no associated
439  ** variable.
440  */
441  const char* get_var_name_rx();
442 
443  /*l
444  *b Description:
445  **
446  ** Returns the name of the DI-Guy motion data variable that controls
447  ** rotation about the Y axis.
448  **
449  ** The returned pointer will be NULL if there is no associated
450  ** variable.
451  */
452  const char* get_var_name_ry();
453 
454  /*l
455  *b Description:
456  **
457  ** Returns in the passed variables the scale amount of the link's
458  ** joint.
459  **
460  ** The values may or may not stay constant frame to frame; see
461  ** get_scale_is_static().
462  **
463  ** Returned values unitless scale factors, and should be applied
464  ** after the rotation.
465  **
466  *b Arguments:
467  **
468  *a sx, sy, sz - pointers to floats into which result
469  *a should be placed
470  **
471  *b Returns:
472  **
473  ** 0 on success, -1 on failure
474  */
475  int get_scale(float* sz, float* sx, float* sy);
476 
477  /*l
478  *b Description:
479  **
480  ** Returns whether the scale returned by get_scale() is static
481  ** (unchanging) or dynamic (can change frame to frame).
482  **
483  ** If the scale is dynamic the scale values will come from one or
484  ** more DI-Guy motion variables; the names of the variables are
485  ** accessible using the functions get_var_name_sx(), etc.
486  **
487  ** If the scale is static it will remain so; the value returned by
488  ** this function should not change frame to frame.
489  **
490  *b Returns:
491  **
492  ** 1 if scale is static, 0 if not, -1 on failure
493  */
494  int get_scale_is_static();
495 
496  /*l
497  *b Description:
498  **
499  ** Returns the name of the DI-Guy motion data variable that controls
500  ** scale in the Z dimension.
501  **
502  ** The returned pointer will be NULL if there is no associated
503  ** variable.
504  */
505  const char* get_var_name_sx();
506 
507  /*l
508  *b Description:
509  **
510  ** Returns the name of the DI-Guy motion data variable that controls
511  ** scale in the Y dimension.
512  **
513  ** The returned pointer will be NULL if there is no associated
514  ** variable.
515  */
516  const char* get_var_name_sy();
517 
518  /*l
519  *b Description:
520  **
521  ** Returns the name of the DI-Guy motion data variable that controls
522  ** scale in the X dimension.
523  **
524  ** The returned pointer will be NULL if there is no associated
525  ** variable.
526  */
527  const char* get_var_name_sz();
528 
529  /*l
530  *b Description:
531  **
532  ** Returns a pointer to this link's parent link. Parent links are
533  ** always links within the same character. If a link is attached to
534  ** a link in another character (i.e., it is "parented to" another
535  ** link), that link pointer can be obtained by calling
536  ** get_attached_to_link().
537  **
538  ** The returned pointer will be NULL if the link is the position link
539  ** and has no parent.
540  **
541  *b Returns:
542  **
543  ** object of type diguyGraphicsLink
544  */
545  diguyGraphicsLink* get_parent_link();
546 
547  /*l
548  *b Description:
549  **
550  ** Returns a pointer to this link's attached to link. The attached
551  ** to link is different than the parent link in that a parent link is
552  ** always a link in the same character, while an attached to link is
553  ** always a link in a different character.
554  **
555  ** Only position links can be attached to links of another character.
556  **
557  ** The returned pointer will be NULL if the link is not attached to
558  ** the link of another character.
559  **
560  *b Returns:
561  **
562  ** object of type diguyGraphicsLink
563  */
564  diguyGraphicsLink* get_attached_to_link();
565 
566  /*l
567  *b Description:
568  **
569  ** Returns 1 if this link is the position link, or 0 if not. The
570  ** position link is the root link of the DI-Guy character's link and
571  ** shape hierarchy, and has no parent link.
572  **
573  *b Returns:
574  **
575  ** 1 if this link is the position link, 0 if not, -1 on error
576  */
577  int get_is_position_link();
578 
579  /*l
580  *b Description:
581  **
582  ** Returns how many child links this link has. Child links can be
583  ** accessed using the get_child_link_at_index() function.
584  **
585  *b Returns:
586  **
587  ** number of child links
588  */
589  int get_num_child_links();
590 
591  /*l
592  *b Description:
593  **
594  ** Returns a pointer to this link's child link at the specified
595  ** index.
596  **
597  ** The returned pointer will be NULL if there is no link at that
598  ** index.
599  **
600  *b Arguments:
601  **
602  *a index - index of the child link; indices start at 0
603  **
604  *b Returns:
605  **
606  ** object of type diguyGraphicsLink
607  */
608  diguyGraphicsLink* get_child_link_at_index(int index);
609 
610 /*****************************************************************************/
617 #ifdef CPLUSPLUS_ONLY
618 
619  /*l
620  *b Description:
621  **
622  ** This function fills out the passed float array with the
623  ** world-coordinate system transformation matrix of this link.
624  **
625  *b NOTE:
626  **
627  ** If the character's performance level (CPL) is 3 or greater, link
628  ** matrices are not computed or updated, and this call should not be
629  ** used. See diguyCharacter::set_minimum_cpl() for more information.
630  **
631  *b Arguments:
632  **
633  *a matrix_array - two-dimensional array of floats into
634  *a which the matrix should be copied
635  *a transpose - defaults to zero, sets if the matrix should be
636  *a treated as row-major or column-major
637  **
638  *b Returns:
639  **
640  ** 0 on success, -1 on failure
641  */
642  int get_transformation_matrix(float matrix_array[4][4], int transpose = 0);
643 
644  /*l
645  *b Description:
646  **
647  ** Pointer version of get_transformation_matrix(), see for docs.
648  * Some end users might prefer this version to avoid copying data from
649  * an explicit float[4][4].
650  **/
651  int get_transformation_matrix_4x4_ptr(float* matrix, int transpose = 0);
652 
653  /*l
654  *b Description:
655  **
656  ** This function fills out the passed float array with the
657  ** character-local-coordinate system transformation matrix of this
658  ** link.
659  **
660  *b NOTE:
661  **
662  ** If the character's performance level (CPL) is 3 or greater, link
663  ** matrices are not computed or updated, and this call should not be
664  ** used. See diguyCharacter::set_minimum_cpl() for more information.
665  **
666  *b Arguments:
667  **
668  *a matrix_array - two-dimensional array of floats into
669  *a which the matrix should be copied
670  *a transpose - defaults to 0, sets if the matrix should be treated
671  *a as row-major or column-major
672  **
673  *b Returns:
674  **
675  ** 0 on success, -1 on failure
676  */
677  int get_local_transformation_matrix(float matrix_array[4][4], int transpose = 0);
678 
679  /*l
680  *b Description:
681  **
682  ** Pointer version of get_local_transformation_matrix(), see for docs.
683  * Some end users might prefer this version to avoid copying data from
684  * an explicit float[4][4].
685  **/
686  int get_local_transformation_matrix_4x4_ptr(float* matrix, int transpose = 0);
687 
688  /*l
689  *b Description:
690  **
691  ** This function fills out the passed float array with the
692  ** link-local-coordinate system transformation matrix of this
693  ** link. This is the same value as the matrix built from
694  ** get_rotation() and get_translation()
695  **
696  *b NOTE:
697  **
698  ** If the character's performance level (CPL) is 3 or greater, link
699  ** matrices are not computed or updated, and this call should not be
700  ** used. See diguyCharacter::set_minimum_cpl() for more information.
701  **
702  *b Arguments:
703  **
704  *a matrix_array - two-dimensional array of floats into
705  *a which the matrix should be copied
706  *a transpose - defaults to 0, sets if the matrix should be treated
707  *a as row-major or column-major
708  **
709  *b Returns:
710  **
711  ** 0 on success, -1 on failure
712  */
713  int get_link_transformation_matrix(float matrix_array[4][4], int transpose = 0);
714 
715  /*l
716  *b Description:
717  **
718  ** Pointer version of get_link_transformation_matrix(), see for docs.
719  * Some end users might prefer this version to avoid copying data from
720  * an explicit float[4][4].
721  **/
722  int get_link_transformation_matrix_4x4_ptr(float* matrix, int transpose = 0);
723 
724 #endif
725 
726 
727 
728 #ifdef CPLUSPLUS_ONLY
729 
730  /*l
731  *b Description:
732  **
733  ** Returns a pointer to the current motion data array. Along with
734  ** data indices returned below, motion data can be directly read from
735  ** this state vector instead of making multiple calls for getting
736  ** transform data.
737  **
738  ** The rotations in this array will be in Euler angles. If
739  ** quaternions are being used, get_quat_data_ptr() should be called
740  ** instead.
741  **
742  ** This function may return NULL, in which case the functions
743  ** get_translation(), get_rotation(), and get_scale() must be used.
744  **
745  ** The pointer returned by this function may change from frame to
746  ** frame, and therefore should not be saved.
747  **
748  ** This function should not be used for the position link (when
749  ** get_is_position_link() returns 1).
750  **
751  ** This function should not be called in a derived class's
752  ** constructor; the pointer will not yet be valid.
753  **
754  *b Returns:
755  **
756  ** pointer to floats; may return NULL if array isn't available
757  **
758  *b Callable From:
759  **
760  *- - C++
761  */
762  const float* get_data_ptr();
763 
764  /*l
765  *b Description:
766  **
767  ** This function is similar to get_data_ptr(), except rotations in
768  ** the returned array will be in quaternions instead of Euler angles.
769  **
770  *b Returns:
771  **
772  ** pointer to floats; may return NULL if array isn't available
773  **
774  *b Callable From:
775  **
776  *- - C++
777  */
778  const float* get_quat_data_ptr();
779 
780 #endif
781 
782  /*l
783  *b Description:
784  **
785  ** Returns the index of this link's translation data in the float
786  ** array returned by get_data_ptr() or get_quat_data_ptr(). The
787  ** translation values are in (tx, ty, tz) order in the array.
788  **
789  ** This function may return -1, in which case this link has no
790  ** translation data.
791  **
792  ** The index returned by this function will not change from frame to
793  ** frame, and can therefore be saved once it has been obtained.
794  **
795  ** This function should not be used for the position link (when
796  ** get_is_position_link() returns 1). Use get_translation() instead.
797  **
798  ** This function should not be called in a derived class's
799  ** constructor; the index will not yet be valid.
800  **
801  *b Returns:
802  **
803  ** index into float array; -1 if no translation data for link
804  */
805  int get_translation_data_index();
806 
807  /*l
808  *b Description:
809  **
810  ** Returns the index of this link's rotation data in the float array
811  ** returned by get_data_ptr(). If quaternion data is being used,
812  ** call get_quat_data_ptr() instead.
813  **
814  ** The rotation values in the data array will be Euler angles in (rz,
815  ** rx, ry) order.
816  **
817  ** This function may return -1, in which case this link has no
818  ** rotation data.
819  **
820  ** This function should not be used for the position link (when
821  ** get_is_position_link() returns 1). Use get_rotation() instead.
822  **
823  ** This function should not be called in a derived class's
824  ** constructor; the index will not yet be valid.
825  **
826  *b Returns:
827  **
828  ** index into float array; -1 if no rotation data for link
829  */
830  int get_rotation_data_index();
831 
832  /*l
833  *b Description:
834  **
835  ** Returns the index of this link's rotation data in the float array
836  ** returned by get_quat_data_ptr(). If Euler angle data is being
837  ** used, call get_data_ptr() instead.
838  **
839  ** The rotation values in the data array will be a quaternion in (qx,
840  ** qy, qz, qw) order.
841  **
842  ** This function may return -1, in which case this link has no
843  ** rotation data.
844  **
845  ** The index returned by this function will not change from frame to
846  ** frame, and can therefore be saved once it has been obtained.
847  **
848  ** This function should not be used for the position link (when
849  ** get_is_position_link() returns 1). Use get_rotation() instead.
850  **
851  ** This function should not be called in a derived class's
852  ** constructor; the index will not yet be valid.
853  **
854  *b Returns:
855  **
856  ** index into float array; -1 if no rotation data for link
857  */
858  int get_quat_data_index();
859 
860  /*l
861  *b Description:
862  **
863  ** Returns the index of this link's scale data in the float array
864  ** returned by get_data_ptr() or get_quat_data_ptr(). The scale
865  ** values are in (sx, sy, sz) order in the array.
866  **
867  ** This function may return -1, in which case this link has no scale
868  ** data.
869  **
870  ** The index returned by this function will not change from frame to
871  ** frame, and can therefore be saved once it has been obtained.
872  **
873  ** This function should not be used for the position link (when
874  ** get_is_position_link() returns 1). Use get_scale() instead.
875  **
876  ** This function should not be called in a derived class's
877  ** constructor; the index will not yet be valid.
878  **
879  *b Returns:
880  **
881  ** index into float array; -1 if no scale data for link
882  */
883  int get_scale_data_index();
884 
885  /*l
886  *b Description:
887  **
888  ** Returns in the passed pointers the unique color of this link. All
889  ** links in a DI-Guy appearance are assigned a unique RGB color that
890  ** can be used in pick/selection operations.
891  **
892  ** Also see diguyScenario::map_color_to_impact().
893  **
894  ** See programming_examples/diguy_graphics_api/ogl_examples/intersection_test
895  ** for an example of its usage.
896  **
897  *b Returns:
898  **
899  ** 0 on success, -1 on failure
900  **
901  ** @TODO Test with lua probably non-functional
902  */
903  int get_unique_color(unsigned char* r,
904  unsigned char* g,
905  unsigned char* b);
906 
907 
908 /*****************************************************************************/
920 #ifdef CPLUSPLUS_ONLY
921 
922  /*l
923  *b Description:
924  **
925  ** This function will be called by DI-Guy when it is time for
926  ** renderer-specific link objects to be created. All information
927  ** necessary to build the link should be available via the Accessor
928  ** Functions above when this function is called.
929  **
930  ** Builds happen in depth-first traversal order, so the parent's
931  ** build() function will always be called before this link's build()
932  ** function.
933  **
934  *i Immediate Mode:
935  **
936  ** Immediate mode renderers usually do not override this function.
937  **
938  *i Scene Graph:
939  **
940  ** Scene graph renderers usually do override this function, to create
941  ** scene graph nodes that allow for the various transformations to
942  ** happen.
943  **
944  ** The following nodes are commonly created:
945  **
946  *- - a static transform node to hold the offsets
947  *- - a dynamic transform node (or DOF) to allow motion data
948  *- to be applied
949  *- - either an LOD or switch node to allow graphics LODs to be
950  *- applied
951  **
952  ** LOD nodes, that automatically handle LOD switching, should be
953  ** created if automatic LOD switching is desired.
954  **
955  ** A switch node should be created if manual setting of the graphics
956  ** LOD is desired.
957  **
958  ** If this link is a position link (it has no parent link), the scene
959  ** graph nodes should not yet be attached to the scene graph; that
960  ** should be done during the call to attach().
961  **
962  ** Otherwise the scene graph nodes should start out attached to their
963  ** attach points (a scene graph node of the parent link).
964  **
965  *b Callable From:
966  **
967  *- - N/A (automatically called by DI-Guy Graphics API during
968  *- the Build Stage)
969  */
970  virtual void build();
971 
972  /*l
973  *b Description:
974  **
975  ** This function will be called by DI-Guy when all links and shapes
976  ** of a DI-Guy character have been built, providing an opportunity
977  ** for final touch-ups to be made to the built hierarchy.
978  **
979  ** This function will be called only for the top-level position link.
980  **
981  *i Immediate Mode:
982  **
983  ** Immediate mode renderers usually do not override this function.
984  **
985  *i Scene Graph:
986  **
987  ** Scene graph renderers sometimes override this function. They
988  ** might to so to do renderer-specific optimizations to the created
989  ** hierarchy.
990  **
991  *b Callable From:
992  **
993  *- - N/A (automatically called by DI-Guy Graphics API during
994  *- the Build Stage)
995  */
996  virtual void post_build();
997 
998  /*l
999  *b Description:
1000  **
1001  ** This function will be called by DI-Guy when it is time for the
1002  ** renderer-specific link objects created during the build() call to
1003  ** be destroyed.
1004  **
1005  ** Unbuilds happen in reverse depth-first traversal order, so this
1006  ** link's unbuild() function will always be called before the
1007  ** parent's unbuild() function.
1008  **
1009  *i Immediate Mode:
1010  **
1011  ** Immediate mode renderers usually do not override this function.
1012  **
1013  *i Scene Graph:
1014  **
1015  ** Scene graph renderers usually do override this function, to
1016  ** destroy the scene graph nodes created by build().
1017  **
1018  *b Callable From:
1019  **
1020  *- - N/A (automatically called by DI-Guy Graphics API during
1021  *- the Unbuild Stage)
1022  */
1023  virtual void unbuild();
1024 
1025  /*l
1026  *b Description:
1027  **
1028  ** This function will be called by DI-Guy when it is time for
1029  ** renderer-specific link objects created during the build() call to
1030  ** be attached to their attach points.
1031  **
1032  ** This function will only be called for the position link.
1033  **
1034  *i Immediate Mode:
1035  **
1036  ** Immediate mode renderers usually do not override this function.
1037  **
1038  *i Scene Graph:
1039  **
1040  ** Scene graph renderers usually do override this function, to attach
1041  ** the scene graph nodes created during build() to somewhere on the
1042  ** scene graph.
1043  **
1044  *b Callable From:
1045  **
1046  *- - N/A (automatically called by DI-Guy Graphics API during
1047  *- the Build Stage, and sometimes during the Update Stage)
1048  */
1049  virtual void attach_to_scene();
1050 
1051  /*l
1052  *b Description:
1053  **
1054  ** This function will be called by DI-Guy when it is time for
1055  ** renderer-specific link objects created during the build() call to
1056  ** be detached from their attach points.
1057  **
1058  *i Immediate Mode:
1059  **
1060  ** Immediate mode renderers usually do not override this function.
1061  **
1062  *i Scene Graph:
1063  **
1064  ** Scene graph renderers usually do override this function, to detach
1065  ** the scene graph nodes created during build() from the scene graph.
1066  **
1067  *b Callable From:
1068  **
1069  *- - N/A (automatically called by DI-Guy Graphics API during
1070  *- the Build Stage, and sometimes during the Update Stage)
1071  */
1072  virtual void detach_from_scene();
1073 
1074  /*l
1075  *b Description:
1076  **
1077  ** TODO MARCM
1078  **
1079  *i Immediate Mode:
1080  **
1081  ** Immediate mode renderers usually do not override this function.
1082  **
1083  *i Scene Graph:
1084  **
1085  ** TODO MARCM
1086  **
1087  *b Callable From:
1088  **
1089  *- - N/A (automatically called by DI-Guy Graphics API during
1090  *- the Update Stage)
1091  */
1092  virtual void instancing_state_changed(int instanced);
1093 
1094  /*l
1095  *b Description:
1096  **
1097  ** This function will be called by DI-Guy when it is time for
1098  ** renderer-specific link objects created during the build() call to
1099  ** be updated with new transformation data.
1100  **
1101  ** Updates happen in depth-first traversal order, so the parent's
1102  ** update() function will always be called before this link's
1103  ** update() function.
1104  **
1105  *i Immediate Mode:
1106  **
1107  ** Immediate mode renderers usually do not override this function.
1108  **
1109  *i Scene Graph:
1110  **
1111  ** Scene graph renderers usually do override this function, to update
1112  ** the scene graph nodes created during build() with new values.
1113  **
1114  ** These values should be obtained by calling get_translation(),
1115  ** get_rotation(), and get_scale().
1116  **
1117  *b Callable From:
1118  **
1119  *- - N/A (automatically called by DI-Guy Graphics API during
1120  *- Update Stage)
1121  */
1122  virtual void update();
1123 
1124  /*l
1125  *b Description:
1126  **
1127  ** This function will be called by DI-Guy when it is traversing the
1128  ** link hierarchy to draw.
1129  **
1130  *i Immediate Mode:
1131  **
1132  ** Immediate mode renderers can override this function. Typically
1133  ** some type of transformation matrix stack push operation is
1134  ** performed.
1135  **
1136  *i Scene Graph:
1137  **
1138  ** Scene graph renderers usually do not override this function;
1139  ** transformation states are handled automatically by scene graphs.
1140  **
1141  *b Callable From:
1142  **
1143  *- - N/A (automatically called by DI-Guy Graphics API during
1144  *- Draw Stage)
1145  */
1146  virtual void push();
1147 
1148  /*l
1149  *b Description:
1150  **
1151  ** This function will be called by DI-Guy when it is traversing the
1152  ** link hierarchy to draw.
1153  **
1154  *i Immediate Mode:
1155  **
1156  ** Immediate mode renderers can override this function. Typically
1157  ** some type of transformation matrix stack pop operation is
1158  ** performed.
1159  **
1160  *i Scene Graph:
1161  **
1162  ** Scene graph renderers usually do not override this function;
1163  ** transformation states are handled automatically by scene graphs.
1164  **
1165  *b Callable From:
1166  **
1167  *- - N/A (automatically called by DI-Guy Graphics API during
1168  *- Draw Stage)
1169  */
1170  virtual void pop();
1171 
1172  /*l
1173  *b Description:
1174  **
1175  ** This function will be called by DI-Guy when it is time for the
1176  ** transformations of this link to be applied.
1177  **
1178  *i Immediate Mode:
1179  **
1180  ** Immediate mode renderers usually do override this function, to
1181  ** apply transformations to the transformation stack.
1182  **
1183  *i Scene Graph:
1184  **
1185  ** Scene graph renderers usually do not override this function;
1186  ** transformation states are handled automatically by scene graphs.
1187  **
1188  *b Callable From:
1189  **
1190  *- - N/A (automatically called by DI-Guy Graphics API during
1191  *- Draw Stage)
1192  */
1193  virtual void draw();
1194 
1195  /*l
1196  *b Description:
1197  **
1198  ** This function will be called by DI-Guy when it a shader should be
1199  ** bound to this link. This is important in some scene graph
1200  ** environments, when the scene graph is responsible for binding the
1201  ** shader.
1202  **
1203  *i Immediate Mode:
1204  **
1205  ** Immediate mode renderers usually do not override this function.
1206  **
1207  *i Scene Graph:
1208  **
1209  ** Scene graph renderers can override this function but some don't
1210  ** need to.
1211  **
1212  *b Callable From:
1213  **
1214  *- - N/A (automatically called by DI-Guy Graphics API during
1215  *- Build Stage)
1216  */
1217  virtual void set_shader_instance(diguyGraphicsShaderInstance* shader_instance);
1218 
1219 
1220 
1221 /****************************************************************************/
1226  /*l
1227  *b Description:
1228  **
1229  ** This function will be called by DI-Guy when the drawing of a new
1230  ** character is beginning. This happens when the position link is
1231  ** drawn.
1232  **
1233  *i Immediate Mode:
1234  **
1235  ** Immediate mode renderers can override this function. Typically
1236  ** some type of transformation matrix stack push operation is
1237  ** performed. This is also an appropriate place to do any
1238  ** per-character modifications, such as:
1239  **
1240  *- - applying scale
1241  *- - applying the base translation of the character
1242  *- - picking a current LOD
1243  *- - etc.
1244  **
1245  *i Scene Graph:
1246  **
1247  ** Scene graph renderers usually do not override this function;
1248  ** transformation states are handled automatically by scene graphs.
1249  **
1250  *b Callable From:
1251  **
1252  *- - N/A (automatically called by DI-Guy Graphics API during
1253  *- Draw Stage)
1254  */
1255  virtual void begin_character_draw();
1256 
1257  /*l
1258  *b Description:
1259  **
1260  ** This function will be called by DI-Guy when the drawing traversal
1261  ** of the character's link hierarchy has completed.
1262  **
1263  *i Immediate Mode:
1264  **
1265  ** Immediate mode renderers can override this function. Typically
1266  ** any matrix stack push operation done in begin_character_draw()
1267  ** is undone here by an appropriate pop operation.
1268  **
1269  *i Scene Graph:
1270  **
1271  ** Scene graph renderers usually do not override this function;
1272  ** transformation states are handled automatically by scene graphs.
1273  **
1274  *b Callable From:
1275  **
1276  *- - N/A (automatically called by DI-Guy Graphics API during
1277  *- Draw Stage)
1278  */
1279  virtual void end_character_draw();
1280 
1281 
1282 #endif
1283 
1284  /*l
1285  *b Description:
1286  **
1287  ** This value corresponds to bdiGraphicsInitGraphicsAPI.use_linear_traversal_draw.
1288  ** As of DI-Guy 13 this can only be true.
1289  **
1290  *e
1291  *e //linear draw behavior
1292  *e {
1293  *e // push the base transform of the character in the world
1294  *e // the get_transformation_matrix() of the position link
1295  *e m_position_link->begin_character_draw();
1296  *e int i;
1297  *e for each link in link array
1298  *e {
1299  *e // note the ability to skip links with nothing attached to them
1300  *e if (link->get_num_shapes() > 0 || link->get_is_position_link())
1301  *e {
1302  *e // each link should multiply by the get_local_transformation_matrix
1303  *e // which contains the precalculated concatenated matrix
1304  *e link->push();
1305  *e link->draw();
1306  *e link->pop();
1307  *e }
1308  *e }
1309  *e m_position_link->end_character_draw();
1310  */
1311  static void set_use_linear_traversal_draw(int mode);
1312 
1313  /*l
1314  *b Description:
1315  **
1316  ** This is always true as of DI-Guy 13. See set_use_linear_traversal_draw().
1317  */
1318  static int get_use_linear_traversal_draw();
1319 
1321 /****************************************************************************/
1322 /****************************************************************************/
1329 /****************************************************************************/
1330 /****************************************************************************/
1331 
1332  // Documentation Pending
1333  int get_inverse_rotation_matrix(float matrix_array[4][4], int transpose = 0,
1334  int include_translation = 1);
1335 
1336  // Documentation Pending
1337  int get_inverse_rotation_matrix_4x4_ptr(float* matrix_array, int transpose = 0,
1338  int include_translation = 1);
1339 
1340 
1341 /****************************************************************************/
1342 /****************************************************************************/
1353 /****************************************************************************/
1354 /****************************************************************************/
1355 /****************************************************************************/
1356 
1357  /*l
1358  *b Description:
1359  **
1360  ** Deprecated as of 9.1.4; use diguyGraphicsLink::get_is_position_link()
1361  ** instead.
1362  */
1363  int get_is_base_link();
1364 
1365  /*l
1366  *b Description:
1367  **
1368  ** Deprecated as of 12.0.0 due to architecture change
1369  */
1370  int get_shader_matrix_index();
1371 
1372 
1373 /****************************************************************************/
1374 /****************************************************************************/
1375 
1380 #ifdef CPLUSPLUS_ONLY
1381 
1382  bdiLink* get_scripted_object() {return m_scripted_object;}
1383 
1384 protected:
1385 
1386  /*l
1387  ** A protected constructor. Constructors are called automatically
1388  ** by DI-Guy.
1389  */
1390  diguyGraphicsLink(void* internal_data);
1391 
1392  /*l
1393  ** A protected destructor. Destructors are called automatically
1394  ** by DI-Guy.
1395  */
1396  virtual ~diguyGraphicsLink();
1397 
1398 private:
1399 
1400  /*l
1401  ** A pointer to internal data.
1402  */
1403  bdiLink* m_scripted_object;
1404 
1405  friend class bdiLink;
1406  friend class bdiGraphicsFactory;
1407 
1408 #endif
1409 
1410 };
1411 
1412 
1413 #endif /* __diguyGraphicsLink_H */
1414 
A class that represents the unique per-character shader object.
Definition: diguyGraphicsShaderInstance.h:55
diguyGraphicsJointType
DI-Guy graphics joint types.
Definition: diguy_constants.h:443
The class that represents a DI-Guy Entity in the world.
Definition: diguyCharacter.h:78
A class that represents the unique per-character non-shared mesh object. DI-Guy encapsulates its text...
Definition: diguyGraphicsShape.h:53