
|
|
This file was automatically generated from diguyGraphicsShape.h. Do not edit this file directly; the changes will be lost.Includes: diguy_constants.h | declspec_diguy.h
Contents:
Alphabetical IndexLink against: libdiguy
class diguyGraphicsShape
|
class BDI_DECLSPEC_diguy diguyGraphicsShape { public: const char* get_name(); long get_uid(); diguyCharacter* get_character(); int get_has_offset_translation(); int get_offset_translation(float* tx, float* ty, float* tz); int get_has_offset_rotation(); int get_offset_rotation(float* rz, float* rx, float* ry); int get_has_offset_scale(); int get_offset_scale(float* sx, float* sy, float* sz); const char* get_shape_set_name(); const char* get_shape_set_shape_name(); const char* get_recommended_attachment_link_name(); int get_num_lods(); #ifdef CPLUSPLUS_ONLY float* get_lod_ranges(); #endif int get_graphics_lod(); const char* get_shape_set_filename_for_lod(int lod); int get_num_meshes(int lod); diguyGraphicsMesh* get_mesh_at_index_for_lod(int index, int lod); diguyGraphicsLink* get_link(); const char* get_switch_var_name(); int get_switch_value(); int get_is_hidden(); diguyGraphicsFile* get_diguy_graphics_file(int lod); #ifdef CPLUSPLUS_ONLY void* get_diguy_graphics_file_part(int lod); #endif int get_graphics_state_switch_index(); int get_num_switched_graphics_states(); diguyGraphicsState* get_switched_graphics_state(int switch_value = -1); int get_unique_color(unsigned char* r, unsigned char* g, unsigned char* b); int get_contains_skinned_file(); int set_material_parameter_4f(const char* parameter_name, float x, float y, float z, float w, float blend_time = 0.0); int get_material_parameter_4f(const char* parameter_name, float* x, float* y, float* z, float* w); unsigned char * get_variation_texture(); int get_variation_texture_size(); #ifdef CPLUSPLUS_ONLY int get_shader_matrix_data(int* num_matrixes, const float** matrix_data); #endif #ifdef CPLUSPLUS_ONLY virtual void build(); virtual void unbuild(); virtual void update(); virtual void show(); virtual void hide(); virtual void draw(int lod); virtual void set_graphics_lod_ranges(float* ranges); virtual void set_graphics_lod(int lod); virtual void update_variation_texture(int num_pixels, unsigned char * pixel_data); int get_bind_color_array(int* num_colors, const float** color_data); #endif
| Accessor Functions |
The functions in this section provide access to data in this object. They are designed to be called by DI-Guy programmers.
Unless otherwise noted all functions in this class section are callable from:
- C++
- Script
function diguyGraphicsShape::get_name |
Prototype:
Description:const char* get_name();
This function returns the name of the shape. The returned pointer will never be NULL.Returns:
name of the shape as C string
function diguyGraphicsShape::get_uid |
Prototype:
Description:long get_uid();
All shapes are assigned a unique identifier, or uid. This function returns this shape's uid.
Note: unique identifiers can change between DI-Guy runs.Returns:
unique identifier of object
function diguyGraphicsShape::get_character |
Prototype:
Description:diguyCharacter* get_character();
This function returns a pointer to the diguyCharacter to which this shape belongs.Returns:
pointer of type diguyCharacter
function diguyGraphicsShape::get_has_offset_translation |
Prototype:
Description:int get_has_offset_translation();
This function returns a 1 if the shape has a translation offset from its link, 0 otherwise.Returns:
1 if shape has an offset, 0 if not, -1 on errorSee Also:
get_offset_translation()
function diguyGraphicsShape::get_offset_translation |
Prototype:
Description:int get_offset_translation(float* tx, float* ty, float* tz);
This function returns in the passed variables the translation offset of this shape from its link.
The offset will always remain fixed once DI-Guy is initialized.
Returned values are in meters.Arguments:
Returns:
tx, ty, tz pointers to floats into which result should be placed
0 on success, -1 on failureSee Also:
get_has_offset_translation(), get_offset_rotation(), get_offset_scale()
function diguyGraphicsShape::get_has_offset_rotation |
Prototype:
Description:int get_has_offset_rotation();
This function returns a 1 if the shape has a rotation offset from its link, 0 otherwise.Returns:
1 if shape has an offset, 0 if not, -1 on errorSee Also:
get_offset_rotation()
function diguyGraphicsShape::get_offset_rotation |
Prototype:
Description:int get_offset_rotation(float* rz, float* rx, float* ry);
This function returns in the passed variables the rotational offset of this shape from its link.
The offset will always remain fixed once DI-Guy is initialized.
Returned values are an Euler triple in degrees, and should be applied in RZ -> RX -> RY order, after the translation offset.Arguments:
Returns:
rz, rx, ry pointers to floats into which result should be placed
0 on success, -1 on failureSee Also:
get_has_offset_rotation(), get_offset_translation(), get_offset_scale()
function diguyGraphicsShape::get_has_offset_scale |
Prototype:
Description:int get_has_offset_scale();
This function returns a 1 if the shape has a scale offset from its link, 0 otherwise.Returns:
1 if shape has an offset, 0 if not, -1 on errorSee Also:
get_offset_scale()
function diguyGraphicsShape::get_offset_scale |
Prototype:
Description:int get_offset_scale(float* sx, float* sy, float* sz);
This function returns in the passed variables the scale "offset" of this shape from its link.
The offset will always remain fixed once DI-Guy is initialized.
Returned values are unitless scale factors.Arguments:
See Also:
sz, sx, sy pointers to floats into which result should be placed
get_has_offset_scale(), get_offset_translation(), get_offset_rotation()Returns:
0 on success, -1 on failure
function diguyGraphicsShape::get_shape_set_name |
Prototype:
Description:const char* get_shape_set_name();
This function returns the name of the shape set of which this shape is a part.
A shape set is a collection of shapes that are related, coming from a set of related geometry files, sometimes one file per LOD.
A shape is a collection of parts each representing the same thing at varying levels of detail.
For example, in its config files DI-Guy has a shape set named "firefighter", which references five OpenFlight files named firefighter_LOD1.flt through firefighter_LOD5.flt. The firefighter shape set contains separate shapes for the head, arms, legs, etc., at five different levels of detail.
Use the function get_shape_set_filename_for_lod() to get the actual geometry filenames that should be used for each LOD.Returns:
shape set of shape as C string
function diguyGraphicsShape::get_shape_set_shape_name |
Prototype:
Description:const char* get_shape_set_shape_name();
This function returns the name of the shape. This name identifies which pieces of geometry out of the shape set should comprise the shape.Returns:
shape name of shape as C string
function diguyGraphicsShape::get_recommended_attachment_link_name |
Prototype:
Description:const char* get_recommended_attachment_link_name();
This function returns the name of the link to which this shape is typically attached.
Use the function get_link() to get a pointer to the actual link to which this shape is attached.Returns:
name of recommended attachment link as C string
function diguyGraphicsShape::get_num_lods |
Prototype:
Description:int get_num_lods();
This function returns how many LODs this shape has. This will be a number between 1 and 7.Returns:
number of LODs
function diguyGraphicsShape::get_lod_ranges |
Prototype:
Description:float* get_lod_ranges();
This function returns the LOD ranges of this shape. The returned pointer points to an array of eight floats, which represent ranges in meters at which LODs should be shown.Returns:
LOD rangesOnly Callable From C++
function diguyGraphicsShape::get_graphics_lod |
Prototype:
Description:int get_graphics_lod();
This function returns the most recent lod setting as set by set_graphics_lod(), or as set by diguyCharacter::set_graphics_lod().Returns:
LOD index; integer from 1 to get_num_lods()
function diguyGraphicsShape::get_shape_set_filename_for_lod |
Prototype:
Description:const char* get_shape_set_filename_for_lod(int lod);
This function returns the filename of the geometry file from which the shape is read for a specific LOD.Arguments:
Returns:
lod level of detail; a number between 1 and get_num_lods()
geometry filename as C string
function diguyGraphicsShape::get_num_meshes |
Prototype:
Description:int get_num_meshes(int lod);
This function returns the number of low-level geometry meshes that comprise this shape.Arguments:
Returns:
lod level of detail; a number between 1 and get_num_lods()
number of meshes in this shape
function diguyGraphicsShape::get_mesh_at_index_for_lod |
Prototype:
Description:diguyGraphicsMesh* get_mesh_at_index_for_lod(int index, int lod);
This function returns a pointer to one of the low-level geometry mesh objects that comprise this shape.Arguments:
Returns:
index - index of mesh; a number between 0 and get_num_meshes() 1 lod level of detail; a number between 1 and get_num_lods()
pointer to object of type diguyGraphicsMesh; NULL on error
function diguyGraphicsShape::get_link |
Prototype:
Description:diguyGraphicsLink* get_link();
This function returns a pointer to the link to which this shape is actually attached.Arguments:
Returns:
index - index of mesh; a number between 0 and get_num_meshes() 1 lod level of detail; a number between 1 and get_num_lods()
pointer to object of type diguyGraphicsMesh; NULL on error
function diguyGraphicsShape::get_switch_var_name |
Prototype:
Description:const char* get_switch_var_name();
This function returns the name of the DI-Guy motion data variable that controls whether this shape should be visible.
The returned pointer will be NULL if there is no associated variable.Returns:
name of the variable; NULL if there is no variable
function diguyGraphicsShape::get_switch_value |
Prototype:
Description:int get_switch_value();
This function returns the value of the DI-Guy motion data variable for which the shape should be visible.
Note that the variable in the motion data is a float, but gets cast to an integer and compared against this number during shape updates.Returns:
number representing value for which shape should be visible
function diguyGraphicsShape::get_is_hidden |
Prototype:
Description:int get_is_hidden();
This function returns whether this shape should currently be hidden or shown, based on the value of the shape's switch variable (if any).Returns:
1 if shape should be hidden, 0 if not
function diguyGraphicsShape::get_diguy_graphics_file |
Prototype:
Description:diguyGraphicsFile* get_diguy_graphics_file(int lod);
This function returns the geometry file from which geometry for the shape was read. Each LOD of the shape may potentially come from a different file.
Note that if a diguyGraphicsFile create function has not been registered with a call to diguy_graphics_set_file_create_func(), this function will return NULL.Arguments:
Returns:
lod level of detail; a number between 1 and get_num_lods()
object of type diguyGraphicsFile
function diguyGraphicsShape::get_diguy_graphics_file_part |
Prototype:
Description:void* get_diguy_graphics_file_part(int lod);
This function returns a pointer to an object that represents the geometry for the shape. The returned object is an object that has been returned by a previous call to diguyGraphicsFile::find_part(), and can be safely cast to the type of object that has been so returned.
Note that if a diguyGraphicsFile create function has not been registered with a call to diguy_graphics_set_file_create_func(), this function will return NULL.Arguments:
Returns:
lod level of detail; a number between 1 and get_num_lods()
generic object which must be cast appropriatelyOnly Callable From C++
function diguyGraphicsShape::get_graphics_state_switch_index |
Prototype:
Description:int get_graphics_state_switch_index();
Some shapes have meshes that have multiple selectable graphics states, including materials and textures. This function returns the value that specifies which graphics state to use for meshes of this shape.
This is different than get_switch_value(), which returns the value of the switch that controls whether or not meshes of this state are shown.Returns:
value of state switch; -1 if there is no state switch
function diguyGraphicsShape::get_num_switched_graphics_states |
Prototype:
Description:int get_num_switched_graphics_states();
Returns the number of switched graphics states available to this shape. See get_graphics_state_switch_index().Returns:
number of switched graphics states
function diguyGraphicsShape::get_switched_graphics_state |
Prototype:
Description:diguyGraphicsState* get_switched_graphics_state(int switch_value = -1);
Returns the graphics state associated with the passed switch value.Returns:
pointer to type diguyGraphicsState
function diguyGraphicsShape::get_unique_color |
Prototype:
Description:int get_unique_color(unsigned char* r, unsigned char* g, unsigned char* b);
Returns in the passed pointers the unique color of this shape. All shapes in a DI-Guy appearance are assigned a unique RGB color that can be used in pick/selection operations.
Also see diguyScenario::map_color_to_impact().
See programming_examplesdiguy_graphics_apiogl_examples/intersection_test for an example of its usage.Returns:
0 on success, -1 on failure
function diguyGraphicsShape::get_contains_skinned_file |
Prototype:
Description:int get_contains_skinned_file();
This function identifies if this shape has skinned data. Scene graph renderers will need to know this in the build phase to help set up the matrix data shader functionality.Returns:
1 if contains at lease one file with skinned data, 0 if not
function diguyGraphicsShape::set_material_parameter_4f |
Prototype:
Description:int set_material_parameter_4f(const char* parameter_name, float x, float y, float z, float w, float blend_time = 0.0);
By default DI-Guy provides three 4 float uniforms at the shape level that can be used by end users to customize the appearance of characters via shaders and misc textures. You can see a demonstration of this in the Exface_sales_demo.dss file where an additional texture is used. The uniforms are named:Example:
local character = this_scenario:get_character_at_index(0); local link = character:get_link_at_index(0); local shape = link:find_shape_by_class_type("head"); shape:set_material_parameter_4f("ufrm_blood_color",1,.1,.1,.5, 1);
function diguyGraphicsShape::get_material_parameter_4f |
Prototype:
Description:int get_material_parameter_4f(const char* parameter_name, float* x, float* y, float* z, float* w);
Allow access to the current values of a material parameter, accounting for value blending. Returns -1 if the parameter can't be found.
function diguyGraphicsShape::get_variation_texture_size |
Prototype:
Description:int get_variation_texture_size();
Returns a char * of length get_variation_texture_size() that represents the pixels in a unique per shape texture. Typically a Retained mode renderer would need to use this to load a state node with the texture see diguyOsgGraphicsShape.cpp for an example. For an immediate mode renderer we push the texture to the object via update_variation_texture()
function diguyGraphicsShape::get_shader_matrix_data |
Prototype:
Description:int get_shader_matrix_data(int* num_matrixes, const float** matrix_data);
This function is typically called by scene graph renderers as part of diguyGraphicsShape::update(). Scene graph renderers should queue up this data to be sent to the graphics card at the appropriate time.
Note that the format of the data in mat_data will be affected by the bdiGraphicsInitGraphicsAPI variable transpose_shader_matrices value.Callable From:
| Virtual Functions |
The functions in this section are all virtual functions that will be called by DI-Guy at various times during DI-Guy execution.
Because the functions are all virtual, DI-Guy programmers can create a subclass of this class and override them. Unless otherwise stated, the base class functions do not need to be called.
function diguyGraphicsShape::build |
Prototype:
Description:virtual void build();
This function will be called by DI-Guy when it is time for renderer-specific shape objects to be created. All information necessary to build the shape should be available via the Accessor Functions above when this function is called.
The build() function for the link to which a shape is attached will be called before the shape's build() function.Immediate Mode:
Immediate mode renderers can override this function, to create a pre-compiled object that expedites the draw(). Display lists in OpenGL are an example of this.Scene Graph:
Scene graph renderers usually do override this function, to create scene graph nodes that will hold geometry nodes of meshes attached to the shape.
The following nodes are typically created:
- a switch node to control showing and hiding of the shape
- an LOD node to control which meshes are shown due to LOD calculations
- a geometry parent or group-type object to which mesh nodes can be attached
The scene graph nodes created by this function should be attached to the nodes of the link to which the shape is attached. Use the get_link() function to get a pointer to the link.
In addition, the scene graph objects of meshes attached to the shape should be retrieved and attached to the shape's nodes. Use the get_mesh_at_index_for_lod() function to get pointers to the meshes.Callable From:
- N/A (automatically called by DI-Guy Graphics API during the Build Stage)
function diguyGraphicsShape::unbuild |
Prototype:
Description:virtual void unbuild();
This function will be called by DI-Guy when it is time for the renderer-specific shape objects created during the build() call to be destroyed.
The unbuild() function for the shape will be called before the unbuild() function of the link to which the shape is attached.Immediate Mode:
Scene graph renderers can override this function, to destroy the scene graph nodes created by build().Scene Graph:
Scene graph renderers usually do override this function, to destroy the scene graph nodes created by build().Callable From:
- N/A (automatically called by DI-Guy Graphics API during the Unbuild Stage)
function diguyGraphicsShape::update |
Prototype:
Description:virtual void update();
This function will be called by DI-Guy when it is time for renderer-specific shape objects created during the build() call to be updated with new data.
Shape updates control whether the shape is visible based on motion data. The DI-Guy Graphics software looks at the switch value and calls show() or hide() as appropriate, so it is likely that this function does not need to be overridden in immediate mode.
The update() function for the link to which a shape is attached will be called before the shape's update() function.Immediate Mode:
Immediate mode renderers usually do not override this function.Scene Graph:
Scene graph renderers should override this function if they are supporting skinned characters. Each skinned shape can potentially have different uniforms that need to be sent to the video card; see get_shader_matrix_data().Callable From:
- N/A (automatically called by DI-Guy Graphics API during Update Stage)
function diguyGraphicsShape::show |
Prototype:
Description:virtual void show();
This function will be called by DI-Guy when the shape should be shown, typically due to a change in the motion data that controls the switch. See get_switch_var_name() and get_switch_value().Immediate Mode:
Immediate mode renderers usually do not override this function. DI-Guy does not call the draw() function of hidden shapes.Scene Graph:
Scene graph renderers usually do override this function, to update the state of the switch node created during the build() call.Callable From:
- N/A (automatically called by DI-Guy Graphics API during Update Stage)
function diguyGraphicsShape::hide |
Prototype:
Description:virtual void hide();
This function will be called by DI-Guy when the shape should be hidden, typically due to a change in the motion data that controls the switch. See get_switch_var_name() and get_switch_value().Immediate Mode:
Immediate mode renderers usually do not override this function. DI-Guy does not call the draw() function of hidden shapes.Scene Graph:
Scene graph renderers usually do override this function, to update the state of the switch node created during the build() call.Callable From:
- N/A (automatically called by DI-Guy Graphics API during Update Stage)
function diguyGraphicsShape::draw |
Prototype:
Description:virtual void draw(int lod);
This function will be called by DI-Guy when it is time for the geometry of this shape to be drawn.Immediate Mode:
Immediate mode renderers usually do not override this function. The actual draw calls happen in diguyGraphicsMesh::draw() calls.Scene Graph:
Scene graph renderers usually do not override this function; drawing is handled automatically by scene graphs.Callable From:
- N/A (automatically called by DI-Guy Graphics API during Draw Stage)
function diguyGraphicsShape::set_graphics_lod_ranges |
Prototype:
Description:virtual void set_graphics_lod_ranges(float* ranges);
This function will be called by DI-Guy when the LOD ranges of this shape need to be updated after the shape has initially been built in the Build Stage.Arguments:
lod_ranges new lod ranges for this shape See diguyScenario::set_default_lod_ranges() for a description of what will be in the lod_ranges argument.Immediate Mode:
Immediate mode renderers usually do not override this function. Instead, they use the lod passed into the draw() function.Scene Graph:
Scene graph renderers can override this function, to update the ranges of LOD nodes created in the Build Stage, if any.
If there were LOD-type nodes created in the Build Stage, their ranges should be updated based on the passed values.
If no LOD-type nodes were created in the Build Stage, this function should have no effect.
Typically only one of set_graphics_lod_ranges() or set_graphics_lod() is implemented.Callable From:
- N/A (automatically called by DI-Guy Graphics API when the DI-Guy API function diguyCharacter::set_lod_ranges() is called)
function diguyGraphicsShape::set_graphics_lod |
Prototype:
Description:virtual void set_graphics_lod(int lod);
This function will be called by DI-Guy when the LOD of this link is "manually" set by a diguyCharacter::set_graphics_lod() function call.Immediate Mode:
Immediate mode renderers usually do not override this function. Instead, they use the lod passed into the draw() function.Scene Graph:
Scene graph renderers sometimes override this function, to update the state of switch nodes created in the Build Stage.
Typically only one of set_graphics_lod_ranges() or set_graphics_lod() is implemented.Callable From:
- N/A (automatically called by DI-Guy Graphics API when the DI-Guy API function diguyCharacter::set_graphics_lod() is called)
function diguyGraphicsShape::update_variation_texture |
Prototype:
Description:virtual void update_variation_texture(int num_pixels, unsigned char * pixel_data);
Pushes a char * pixel buffer of length num_pixels that represents the unique per shape texture. Typically a Immediate mode renderer would need to use this to create or update a texture see diguyOglGraphicsShape.cpp for an example. For an retained mode renderer we have get_variation_texture() as an accessor.
Callable From:
- N/A (automatically called by DI-Guy Graphics API during Build Stage)
function diguyGraphicsShape::get_bind_color_array |
Prototype:
Description:int get_bind_color_array(int* num_colors, const float** color_data);
Returns the unique color of the character links. All links in a DI-Guy appearance are assigned a unique RGB color that can be used in pick/selection operations. The data returned in color_data is an array of length num_colors with 4 floats per entry (r, g, b, a).
See programming_examplesdiguy_graphics_apiosg_2_examples/intersection_test for an example of its usage.Returns:
0 on success, -1 on failure
ALL RIGHTS RESERVED.
These coded instructions, statements, and computer programs contain unpublished proprietary information of Boston Dynamics and are protected by Copyright Laws of the United States. They may not be used, duplicated, or disclosed in any form, in whole or in part, without the prior written consent from Boston Dynamics.
RESTRICTED RIGHTS LEGEND
Use, duplication, or disclosure by the government is subject to restrictions as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Sofware clause at DFARS 252.227-7013 and/or in similar or successor clauses in the FAR, or the DOD or NASA FAR Supplement, or to subparagraphs (c)(1) and (c)(2) of the Commercial Computer Software--Restricted Rights at 48 CFR 52.227-19, as applicable. Unpublished-rights reserved under the Copyright Laws of the United States.
Contractor/Manufacturer is:
Boston Dynamics/78 Fourth Avenue/Waltham MA 02451.