DI-Guy SDK Documentation  13.7.1
diguyGraphicsShape.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2021 MAK Technologies, Inc.
3  * All rights reserved.
4  ****************************************************************************/
5 
6 /*********************************************************************/
13 #pragma once
14 
15 #ifdef SWIG
16 %module diguyGraphicsShape
17 #else
18 #define CPLUSPLUS_ONLY
19 #endif
20 
21 #ifdef CPLUSPLUS_ONLY
22 #include <diguy_constants.h>
23 
24 class bdiShape;
25 class diguyCharacter;
26 class diguyGraphicsFile;
27 class diguyGraphicsLink;
28 class diguyGraphicsMesh;
29 class diguyGraphicsShape;
30 class diguyGraphicsState;
31 
32 #endif
33 
34 #include <declspec_diguy.h>
35 
36 /*****************************************************************************/
50 class BDI_DECLSPEC_diguy diguyGraphicsShape
51 {
52 
53 public:
54 
55 
56 /*****************************************************************************/
69  /*l
70  *b Description:
71  **
72  ** This function returns the name of the shape. The returned pointer
73  ** will never be NULL.
74  **
75  *b Returns:
76  **
77  ** name of the shape as C string
78  */
79  const char* get_name();
80 
81  /*l
82  *b Description:
83  **
84  ** All shapes are assigned a unique identifier, or uid. This function
85  ** returns this shape's uid.
86  **
87  ** *Note*: unique identifiers can 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 Description:
97  **
98  ** This function returns a pointer to the diguyCharacter to which this
99  ** shape belongs.
100  **
101  *b Returns:
102  **
103  ** pointer of type diguyCharacter
104  */
105  diguyCharacter* get_character();
106 
107 
108  /*l
109  *b Description:
110  **
111  ** This function returns the name of the shape set of which this shape
112  ** is a part.
113  **
114  ** A shape set is a collection of shapes that are related, coming from
115  ** a set of related geometry files, sometimes one file per LOD.
116  **
117  ** A shape is a collection of parts each representing the same thing
118  ** at varying levels of detail.
119  **
120  ** For example, in its config files DI-Guy has a shape set named
121  ** "firefighter", which references five OpenFlight files named
122  ** firefighter_LOD1.flt through firefighter_LOD5.flt. The firefighter
123  ** shape set contains separate shapes for the head, arms, legs, etc.,
124  ** at five different levels of detail.
125  **
126  ** Use the function get_shape_set_filename_for_lod() to get the actual
127  ** geometry filenames that should be used for each LOD.
128  **
129  *b Returns:
130  **
131  ** shape set of shape as C string
132  */
133  const char* get_shape_set_name();
134 
135  /*l
136  *b Description:
137  **
138  ** This function returns the name of the shape. This name identifies
139  ** which pieces of geometry out of the shape set should comprise the
140  ** shape.
141  **
142  *b Returns:
143  **
144  ** shape name of shape as C string
145  */
146  const char* get_shape_set_shape_name();
147 
148  /*l
149  *b Description:
150  **
151  ** This function returns the name of the link to which this shape is
152  ** typically attached.
153  **
154  ** Use the function get_link() to get a pointer to the actual link to
155  ** which this shape is attached.
156  **
157  *b Returns:
158  **
159  ** name of recommended attachment link as C string
160  */
161  const char* get_recommended_attachment_link_name();
162 
163  /*l
164  *b Description:
165  **
166  ** This function returns how many LODs this shape has. This will be a
167  ** number between 1 and 7.
168  **
169  *b Returns:
170  **
171  ** number of LODs
172  */
173  int get_num_lods();
174 
175 #ifdef CPLUSPLUS_ONLY
176 
177  /*l
178  *b Description:
179  **
180  ** This function returns the LOD ranges of this shape. The returned
181  ** pointer points to an array of eight floats, which represent ranges
182  ** in meters at which LODs should be shown.
183  **
184  *b Returns:
185  **
186  ** LOD ranges
187  **
188  *b Only Callable From C++
189  */
190  float* get_lod_ranges();
191 
192 #endif
193 
194  /*l
195  *b Description:
196  **
197  ** This function returns the most recent lod setting as set by
198  ** set_graphics_lod(), or as set by
199  ** diguyCharacter::set_graphics_lod().
200  **
201  *b Returns:
202  **
203  ** LOD index; integer from 1 to get_num_lods()
204  */
205  int get_graphics_lod();
206 
208  float get_graphics_lod_fraction();
209 
211  bool get_lod_fades_out(int lod);
212 
215  void get_blend_shape_data(int lod, float fraction, float weights[4], int indexes[4]);
216 
217  /*l
218  *b Description:
219  **
220  ** This function returns the filename of the geometry file from which
221  ** the shape is read for a specific LOD.
222  **
223  *b Arguments:
224  **
225  *a lod - level of detail; a number between 1 and get_num_lods()
226  **
227  *b Returns:
228  **
229  ** geometry filename as C string
230  */
231  const char* get_shape_set_filename_for_lod(int lod);
232 
233  /*l
234  *b Description:
235  **
236  ** This function returns the number of low-level geometry meshes that
237  ** comprise this shape.
238  **
239  *b Arguments:
240  **
241  *a lod - level of detail; a number between 1 and get_num_lods()
242  **
243  *b Returns:
244  **
245  ** number of meshes in this shape
246  */
247  int get_num_meshes(int lod);
248 
249  /*l
250  *b Description:
251  **
252  ** This function returns a pointer to one of the low-level geometry
253  ** mesh objects that comprise this shape.
254  **
255  *b Arguments:
256  **
257  *a index - index of mesh; a number between 0 and get_num_meshes() - 1
258  *a lod - level of detail; a number between 1 and get_num_lods()
259  **
260  *b Returns:
261  **
262  ** pointer to object of type diguyGraphicsMesh; NULL on error
263  */
264  diguyGraphicsMesh* get_mesh_at_index_for_lod(int index, int lod);
265 
266  /*l
267  *b Description:
268  **
269  ** This function fills out the accumulated xform data for the low-level geometry
270  ** mesh objects that comprise this shape.
271  **
272  *b Arguments:
273  **
274  *a index - index of mesh; a number between 0 and get_num_meshes() - 1
275  *a lod - level of detail; a number between 1 and get_num_lods()
276  *a matrix - 4x4 matrix to fill out typically will be identity
277  *a transpose - flips the data depending on desired layout
278  **
279  *b Returns:
280  **
281  ** 0 on success
282  */
283  int get_mesh_transform_at_index_for_lod(int index, int lod, float* matrix, int transpose = 0);
284 
285  /*l
286  *b Description:
287  **
288  ** This function returns a pointer to the link to which this shape is
289  ** actually attached.
290  **
291  *b Arguments:
292  **
293  *a index - index of mesh; a number between 0 and get_num_meshes() - 1
294  *a lod - level of detail; a number between 1 and get_num_lods()
295  **
296  *b Returns:
297  **
298  ** pointer to object of type diguyGraphicsMesh; NULL on error
299  */
300  diguyGraphicsLink* get_link();
301 
302  /*l
303  *b Description:
304  **
305  ** This function returns the name of the DI-Guy motion data variable
306  ** that controls whether this shape should be visible.
307  **
308  ** The returned pointer will be NULL if there is no associated
309  ** variable.
310  ** This visiblity can be overridden by calling diguyGraphicsLink::set_shape_switch_override()
311  ** on the parent link.
312  **
313  *b Returns:
314  **
315  ** name of the variable; NULL if there is no variable
316  */
317  const char* get_switch_var_name();
318 
319  /*l
320  *b Description:
321  **
322  ** This function returns the value of the DI-Guy motion data variable
323  ** for which the shape should be visible.
324  **
325  ** Note that the variable in the motion data is a float, but gets cast
326  ** to an integer and compared against this number during shape
327  ** updates.
328  **
329  *b Returns:
330  **
331  ** number representing value for which shape should be visible
332  */
333  int get_switch_value();
334 
335  /*l
336  *b Description:
337  **
338  ** This function returns whether this shape should currently be hidden
339  ** or shown, based on the value of the shape's switch variable (if
340  ** any).
341  **
342  *b Returns:
343  **
344  ** 1 if shape is hidden, 0 if not
345  */
346  int get_is_hidden() const;
347 
349  int set_is_hidden(int hidden);
350 
353  const char * get_class_type() const;
354 
357  const char * get_object_type() const;
358 
360  const char * get_material_type() const;
361 
363  int get_is_pbr_ready() const;
364 
365  /*l
366  *b Description:
367  **
368  ** This function returns the geometry file from which geometry for the
369  ** shape was read. Each LOD of the shape may potentially come from a
370  ** different file.
371  **
372  ** Note that if a diguyGraphicsFile create function has not been
373  ** registered with a call to diguy_graphics_set_file_create_func(),
374  ** this function will return NULL.
375  **
376  *b Arguments:
377  **
378  *a lod - level of detail; a number between 1 and get_num_lods()
379  **
380  *b Returns:
381  **
382  ** object of type diguyGraphicsFile
383  */
384  diguyGraphicsFile* get_diguy_graphics_file(int lod);
385 
386 #ifdef CPLUSPLUS_ONLY
387 
388  /*l
389  *b Description:
390  **
391  ** This function returns a pointer to an object that represents the
392  ** geometry for the shape. The returned object is an object that has
393  ** been returned by a previous call to diguyGraphicsFile::find_part(),
394  ** and can be safely cast to the type of object that has been so
395  ** returned.
396  **
397  ** Note that if a diguyGraphicsFile create function has not been
398  ** registered with a call to diguy_graphics_set_file_create_func(),
399  ** this function will return NULL.
400  **
401  *b Arguments:
402  **
403  *a lod - level of detail; a number between 1 and get_num_lods()
404  **
405  *b Returns:
406  **
407  ** generic object which must be cast appropriately
408  **
409  *b Only Callable From C++
410  */
411  void* get_diguy_graphics_file_part(int lod);
412 
413 #endif
414 
415  /*l
416  *b Description:
417  **
418  ** Some shapes have meshes that have multiple selectable graphics
419  ** states, including materials and textures. This function returns
420  ** the value that specifies which graphics state to use for meshes of
421  ** this shape.
422  **
423  ** This is different than get_switch_value(), which returns the value
424  ** of the switch that controls whether or not meshes of this state are
425  ** shown.
426  **
427  *b Returns:
428  **
429  ** value of state switch; -1 if there is no state switch
430  */
431  int get_graphics_state_switch_index();
432 
433  /*l
434  *b Description:
435  **
436  ** Returns the number of switched graphics states available to this
437  ** shape. See get_graphics_state_switch_index().
438  **
439  *b Returns:
440  **
441  ** number of switched graphics states
442  */
443  int get_num_switched_graphics_states();
444 
445  /*l
446  *b Description:
447  **
448  ** Returns the graphics state associated with the passed switch value.
449  **
450  *b Returns:
451  **
452  ** pointer to type diguyGraphicsState
453  */
454  diguyGraphicsState* get_switched_graphics_state(int switch_value = -1);
455 
457  int set_state_switch_index(int index);
458 
459  /*l
460  *b Description:
461  **
462  ** Returns in the passed pointers the unique color of this shape. All
463  ** shapes in a DI-Guy appearance are assigned a unique RGB color that
464  ** can be used in pick/selection operations.
465  **
466  ** Also see diguyScenario::map_color_to_impact().
467  **
468  ** See programming_examples/diguy_graphics_api/ogl_examples/intersection_test
469  ** for an example of its usage.
470  **
471  *b Returns:
472  **
473  ** 0 on success, -1 on failure
474  */
475  int get_unique_color(unsigned char* r, unsigned char* g, unsigned char* b);
476 
477  /*l
478  *b Description:
479  **
480  ** This function identifies if this shape has skinned data. Scene
481  ** graph renderers will need to know this in the build phase to help
482  ** set up the matrix data shader functionality.
483  **
484  *b Returns:
485  **
486  ** 1 if contains at lease one file with skinned data, 0 if not
487  */
488  int get_contains_skinned_file();
489 
490  /*l
491  *b Description:
492  **
493  ** Returns the value of the configured parameter with the given name.
494  **
495  *b Returns:
496  **
497  ** The parameter value as a string, or NULL if there's no parameter with the given name.
498  */
499  const char* find_appearance_parameter( const char* parameter_name ) const;
500 
501 /***************************************************************************************
502  *2 Per shape material uniform API
503  **/
504  /*l
505  *b Description:
506  **
507  ** By default DI-Guy allows per shape uniforms that will be restored to <0,0,0,0> after a draw call.
508  ** These can be used by end users to customize the appearance of
509  ** characters via shaders and misc textures. You can see a
510  ** demonstration of this in the Exface_sales_demo.dss file where an
511  ** additional texture is used.
512  **
513  *b Example:
514  **
515  *e local character = this_scenario:get_character_at_index(0);
516  *e local link = character:get_link_at_index(0);
517  *e local shape = link:find_shape_by_class_type("head");
518  *e shape:set_material_parameter_4f("ufrm_blood_color",1,.1,.1,.5, 1);
519  */
520  int set_material_parameter_4f(const char* parameter_name,
521  float x, float y, float z, float w,
522  float blend_time = 0.0);
523 
524  /*l
525  *b Description:
526  **
527  ** Allow access to the current values of a material parameter, accounting
528  ** for value blending. Returns -1 if the parameter can't be found.
529  */
530  int get_material_parameter_4f(const char* parameter_name,
531  float* x, float* y, float* z, float* w);
532 
533 /***************************************************************************************
534  *2 Texture Variation API
535  **/
536 
537  /*l
538  *b Description:
539  **
540  ** Returns a char * of length get_variation_texture_size() that represents
541  ** the pixels in a unique per shape texture. Typically a Retained mode
542  ** renderer would need to use this to load a state node with the texture
543  ** see diguyOsgGraphicsShape.cpp for an example. For an immediate mode
544  ** renderer we push the texture to the object via update_variation_texture()
545  */
546  unsigned char * get_variation_texture();
547 
549  int get_variation_texture_size();
550 
552  static int get_shared_variation_texture_size();
553 
555  int get_num_variations();
556 
558  const char * get_variation_name(int variation_index);
559 
561  int set_variation_index(int variation_index);
562 
564  int get_has_custom_variation();
565 
567  int get_num_variation_components();
568 
570  const char * get_variation_component_name(int index);
571 
573  int get_variation_component_row(const char * name);
574 
577  int set_variation_component_value(int index, float color_shift_r, float color_shift_g, float color_shift_b);
578 
581  int get_variation_texture_row();
582 
584  void set_variation_texture_data(unsigned char * texture_data);
585 
586 #ifdef CPLUSPLUS_ONLY
587 
588  /*l
589  *b Description:
590  **
591  ** This function is typically called by scene graph renderers as part
592  ** of diguyGraphicsShape::update(). Scene graph renderers should
593  ** queue up this data to be sent to the graphics card at the
594  ** appropriate time.
595  **
596  ** Note that the format of the data in mat_data will be affected by
597  ** the bdiGraphicsInitGraphicsAPI variable transpose_shader_matrices
598  ** value.
599  **
600  *b Callable From:
601  **
602  *- C++
603  */
604  int get_shader_matrix_data(int* num_matrixes, const float** matrix_data);
605 
606 #endif
607 
608  /*l
609  *b Description:
610  **
611  ** Returns the transpose state of the shader matrices.
612  **
613  *b Returns:
614  **
615  ** 1 if shader matrices are transposed, 0 otherwise.
616  */
617  int get_are_shader_matrices_transposed();
618 
619 
620 /*****************************************************************************/
632 #ifdef CPLUSPLUS_ONLY
633 
634  /*l
635  *b Description:
636  **
637  ** This function will be called by DI-Guy when it is time for
638  ** renderer-specific shape objects to be created. All information
639  ** necessary to build the shape should be available via the Accessor
640  ** Functions above when this function is called.
641  **
642  ** The build() function for the link to which a shape is attached
643  ** will be called before the shape's build() function.
644  **
645  *i Immediate Mode:
646  **
647  ** Immediate mode renderers can override this function, to create a
648  ** pre-compiled object that expedites the draw(). Display lists in
649  ** OpenGL are an example of this.
650  **
651  *i Scene Graph:
652  **
653  ** Scene graph renderers usually do override this function, to create
654  ** scene graph nodes that will hold geometry nodes of meshes attached
655  ** to the shape.
656  **
657  ** The following nodes are typically created:
658  **
659  *- - a switch node to control showing and hiding of the shape
660  *- - an LOD node to control which meshes are shown due to
661  *- LOD calculations
662  *- - a geometry parent or group-type object to which mesh
663  *- nodes can be attached
664  **
665  ** The scene graph nodes created by this function should be attached
666  ** to the nodes of the link to which the shape is attached. Use the
667  ** get_link() function to get a pointer to the link.
668  **
669  ** In addition, the scene graph objects of meshes attached to the
670  ** shape should be retrieved and attached to the shape's nodes. Use
671  ** the get_mesh_at_index_for_lod() function to get pointers to the
672  ** meshes.
673  **
674  *b Callable From:
675  **
676  *- - N/A (automatically called by DI-Guy Graphics API during
677  *- the Build Stage)
678  */
679  virtual void build();
680 
681  /*l
682  *b Description:
683  **
684  ** This function will be called by DI-Guy when it is time for the
685  ** renderer-specific shape objects created during the build() call to
686  ** be destroyed.
687  **
688  ** The unbuild() function for the shape will be called before the
689  ** unbuild() function of the link to which the shape is attached.
690  **
691  *i Immediate Mode:
692  **
693  ** Scene graph renderers can override this function, to destroy the
694  ** scene graph nodes created by build().
695  **
696  *i Scene Graph:
697  **
698  ** Scene graph renderers usually do override this function, to
699  ** destroy the scene graph nodes created by build().
700  **
701  *b Callable From:
702  **
703  *- - N/A (automatically called by DI-Guy Graphics API during
704  *- the Unbuild Stage)
705  */
706  virtual void unbuild();
707 
708  /*l
709  *b Description:
710  **
711  ** This function will be called by DI-Guy when it is time for
712  ** renderer-specific shape objects created during the build() call to
713  ** be updated with new data.
714  **
715  ** Shape updates control whether the shape is visible based on motion
716  ** data. The DI-Guy Graphics software looks at the switch value and
717  ** calls show() or hide() as appropriate, so it is likely that this
718  ** function does not need to be overridden in immediate mode.
719  **
720  ** The update() function for the link to which a shape is attached
721  ** will be called before the shape's update() function.
722  **
723  *i Immediate Mode:
724  **
725  ** Immediate mode renderers usually do not override this function.
726  **
727  *i Scene Graph:
728  **
729  ** Scene graph renderers should override this function if they are
730  ** supporting skinned characters. Each skinned shape can potentially
731  ** have different uniforms that need to be sent to the video card; see
732  ** get_shader_matrix_data().
733  **
734  *b Callable From:
735  **
736  *- - N/A (automatically called by DI-Guy Graphics API during
737  *- Update Stage)
738  */
739  virtual void update();
740 
741  /*l
742  *b Description:
743  **
744  ** This function will be called by DI-Guy when the shape should be
745  ** shown, typically due to a change in the motion data that controls
746  ** the switch. See get_switch_var_name() and get_switch_value().
747  **
748  *i Immediate Mode:
749  **
750  ** Immediate mode renderers usually do not override this function.
751  ** DI-Guy does not call the draw() function of hidden shapes.
752  **
753  *i Scene Graph:
754  **
755  ** Scene graph renderers usually do override this function, to update
756  ** the state of the switch node created during the build() call.
757  **
758  *b Callable From:
759  **
760  *- - N/A (automatically called by DI-Guy Graphics API during
761  *- Update Stage)
762  */
763  virtual void show();
764 
765  /*l
766  *b Description:
767  **
768  ** This function will be called by DI-Guy when the shape should be
769  ** hidden, typically due to a change in the motion data that controls
770  ** the switch. See get_switch_var_name() and get_switch_value().
771  **
772  *i Immediate Mode:
773  **
774  ** Immediate mode renderers usually do not override this function.
775  ** DI-Guy does not call the draw() function of hidden shapes.
776  **
777  *i Scene Graph:
778  **
779  ** Scene graph renderers usually do override this function, to update
780  ** the state of the switch node created during the build() call.
781  **
782  *b Callable From:
783  **
784  *- - N/A (automatically called by DI-Guy Graphics API during
785  *- Update Stage)
786  */
787  virtual void hide();
788 
789 
790  /*l
791  *b Description:
792  **
793  ** This function will be called by DI-Guy when it is time for the
794  ** geometry of this shape to be drawn.
795  **
796  *i Immediate Mode:
797  **
798  ** Immediate mode renderers usually do not override this function.
799  ** The actual draw calls happen in diguyGraphicsMesh::draw() calls.
800  **
801  *i Scene Graph:
802  **
803  ** Scene graph renderers usually do not override this function;
804  ** drawing is handled automatically by scene graphs.
805  **
806  *b Callable From:
807  **
808  *- - N/A (automatically called by DI-Guy Graphics API during
809  *- Draw Stage)
810  */
811  virtual void draw(int lod);
812 
813  /*l
814  *b Description:
815  **
816  ** This function will be called by DI-Guy when the LOD ranges of this
817  ** shape need to be updated after the shape has initially been built
818  ** in the Build Stage.
819  **
820  *b Arguments:
821  **
822  *a lod_ranges - new lod ranges for this shape
823  **
824  ** See diguyScenario::set_default_lod_ranges() for a description of
825  ** what will be in the lod_ranges argument.
826  **
827  *i Immediate Mode:
828  **
829  ** Immediate mode renderers usually do not override this function.
830  ** Instead, they use the lod passed into the draw() function.
831  **
832  *i Scene Graph:
833  **
834  ** Scene graph renderers can override this function, to update the
835  ** ranges of LOD nodes created in the Build Stage, if any.
836  **
837  ** If there were LOD-type nodes created in the Build Stage, their
838  ** ranges should be updated based on the passed values.
839  **
840  ** If no LOD-type nodes were created in the Build Stage, this
841  ** function should have no effect.
842  **
843  ** Typically only one of set_graphics_lod_ranges() or
844  ** set_graphics_lod() is implemented.
845  **
846  *b Callable From:
847  **
848  *- - N/A (automatically called by DI-Guy Graphics API when the
849  *- DI-Guy API function diguyCharacter::set_lod_ranges() is
850  *- called)
851  */
852  virtual void set_graphics_lod_ranges(float* ranges);
853 
854  /*l
855  *b Description:
856  **
857  ** This function will be called by DI-Guy when the LOD of this link
858  ** is "manually" set by a diguyCharacter::set_graphics_lod() function
859  ** call.
860  **
861  *i Immediate Mode:
862  **
863  ** Immediate mode renderers usually do not override this function.
864  ** Instead, they use the lod passed into the draw() function.
865  **
866  *i Scene Graph:
867  **
868  ** Scene graph renderers sometimes override this function, to update
869  ** the state of switch nodes created in the Build Stage.
870  **
871  ** Typically only one of set_graphics_lod_ranges() or
872  ** set_graphics_lod() is implemented.
873  **
874  *b Callable From:
875  **
876  *- - N/A (automatically called by DI-Guy Graphics API when the
877  *- DI-Guy API function diguyCharacter::set_graphics_lod() is
878  *- called)
879  */
880  virtual void set_graphics_lod(int lod);
881 
882 
883  /*l
884  *b Description:
885  **
886  ** Pushes a char * pixel buffer of length num_pixels that represents
887  ** the unique per shape texture. Typically a Immediate mode renderer
888  ** would need to use this to create or update a texture
889  ** see diguyOglGraphicsShape.cpp for an example. For an retained mode
890  ** renderer we have get_variation_texture() as an accessor.
891  **
892  *b Callable From:
893  **
894  *- - N/A (automatically called by DI-Guy Graphics API during
895  *- Build Stage)
896  */
897  virtual void update_variation_texture(int num_pixels, unsigned char * pixel_data);
898 
899 
900  /*l
901  *b Description:
902  ** creates a decal texture with a name (accessed by get_decal_text()) see sample implementation for a
903  ** render to texture based implementation
904  **/
905  virtual void update_name_texture();
906 
907 
908 /*****************************************************************************/
913  int get_decal_index() const;
917  void set_decal_index(int index);
918 
920  const char* get_decal_text();
921 
922  /*l
923  *b Description:
924  **
925  ** Returns the unique color of the character links. All links in a
926  ** DI-Guy appearance are assigned a unique RGB color that can be used
927  ** in pick/selection operations. The data returned in color_data is
928  ** an array of length num_colors with 4 floats per entry (r, g, b, a).
929  **
930  ** See programming_examples/diguy_graphics_api/osg_2_examples/intersection_test
931  ** for an example of its usage.
932  **
933  *b Returns:
934  **
935  ** 0 on success, -1 on failure
936  */
937  int get_bind_color_array(int* num_colors, const float** color_data);
938 
939  /*b Description:
940  **
941  ** This function will be called by DI-Guy when the the character changes
942  ** instancing state. This allows additional work to be done to manage
943  ** instancing. Note this hasn't been needed, for any of our sample implementations.
944  */
945  virtual void instancing_state_changed(int val);
946 
947 #endif
948 
949 #ifdef CPLUSPLUS_ONLY
950 
951  // EXPERIMENTAL
952  // FIXME: Added to access quats directly instead of shader matrices
953  // for Unity optimization. [Marc 11/22/2013]
954  int get_link_to_matrix_table(int* num_matrices, const float** lookup_data);
955 
957  int get_bone_index_from_link_index(int link_index);
958 
959 #endif
960 
962  int get_has_offset_matrix() const;
963 
965  int get_offset_matrix_4x4_ptr(float* matrix, int transpose = 0) const;
968  /*l
969  *b Description:
970  **
971  ** This function fills out the passed float array with the
972  ** character-local-coordinate system transformation matrix of this
973  ** shape, will only be different from it's parent link if it has an offset matrix.
974  */
975  int get_local_transformation_matrix_4x4_ptr(float* matrix, int transpose = 0) const;
976 
977  /*l
978  *b Description:
979  **
980  ** This function fills out the passed float array with the
981  ** character-local-coordinate system transformation matrix of this
982  ** shape, will only be different from it's parent link if it has an offset matrix,
983  ** or complex hierarchy
984  */
985  int get_local_transformation_matrix_4x4_ptr(float* matrix, int lod, int transpose) const;
986 
988  int get_bounding_box(float * bbox_min_x, float * bbox_min_y, float * bbox_min_z,
989  float * bbox_max_x, float * bbox_max_y, float * bbox_max_z);
990 
991 
992 /****************************************************************************/
993 /****************************************************************************/
994 
999 #ifdef CPLUSPLUS_ONLY
1000 
1001  bdiShape* get_scripted_object() {return m_scripted_object;}
1002 
1003 protected:
1004 
1005  /*l
1006  ** A protected constructor. Constructors are called automatically
1007  ** by DI-Guy.
1008  */
1009  diguyGraphicsShape(void* internal_data);
1010 
1011  /*l
1012  ** A protected destructor. Destructors are called automatically
1013  ** by DI-Guy.
1014  */
1015  virtual ~diguyGraphicsShape();
1016 
1017 private:
1018 
1019  /*l
1020  ** A pointer to internal data.
1021  */
1022  bdiShape* m_scripted_object;
1023 
1024  friend class bdiShape;
1025  friend class bdiGraphicsFactory;
1026 
1027 #endif
1028 
1029 };
A class that represents a shared material/textures combination.
Definition: diguyGraphicsState.h:44
A wrapper around a geometry file.
Definition: diguyGraphicsFile.h:33
A class that represents a shared mesh object.
Definition: diguyGraphicsMesh.h:87
The class that represents a DI-Guy Entity in the world.
Definition: diguyCharacter.h:81
A class that represents the unique per-character non-shared mesh object. DI-Guy encapsulates its text...
Definition: diguyGraphicsShape.h:49