FLDget_node_data_id, FLDset_node_data_id

Synopsis

get/set the id within a Node_Data component

int FLDget_node_data_id (
OMobj_id field,
int comp,
int *id);

int FLDset_node_data_id (
OMobj_id field,
int comp,
int id);

Description

These routines set and get the id within the Data_Array of one component of a Node_Data.

Parameters

OMobj_id field

The OMobj_id of a field that contains a Node_Data subobject.

int comp

An integer that sets which component's Data_Array to access (Data_Array node_data[nnode_data] in Node_Data).

intid
int *id

In FLDset_node_data_id, an integer that sets the id field.
In FLDget_node_data, a pointer to an integer in which the id will be returned.

Examples

This example, which are fragments from modules/rd_geom.c, shows the module setting the id field of a series of Node_Data components to particular constant values, indicating that these component Data_Arrays contain normals and colors data. The renderer will use FLDget_node_data_id routines to retrieve these flags and render the object accordingly.

static geoms_to_field(num_geoms, geom, out)
int num_geoms;
GEOMobj *geom[];
OMobj_id out;
{
...
int normal_comp= -1;
int color_comp= -1;
int ncomps= 0;
...
/* find nnodes for all geom */
for (j=0; j<num_geoms; ++j)
...
for (i=0; i<PT(geom[j]).npts; ++i)
nnodes += PT(geom[j]).ptverts[i].n;
if (normal_comp == -1 && (geom[j]->data & GEOM_NORMALS))
normal_comp= ncomps++;
if (color_comp == -1 && (geom[j]->data & GEOM_VCOLORS))
color_comp= ncomps++;
...
if (normal_comp!= -1)
{
if (FLDset_node_data_id(out, normal_comp,GD_NORMAL_DATA_ID)!= 1)
ERR_RETURN("Error setting comp id");
if (FLDset_node_data_veclen(out, normal_comp, 3)!= 1)
ERR_RETURN("Error setting comp veclen");
}
if (color_comp!= -1)
{
if (FLDset_node_data_id(out, color_comp,GD_COLOR_DATA_ID)!= 1)
ERR_RETURN("Error setting comp id");
if (FLDset_node_data_veclen(out, color_comp, 3)!= 1)
ERR_RETURN("Error setting comp veclen");
}

Files

v/fld.v.

See Also

FLDget_cell_data_id.