next up previous contents
Next: Hierarchical Searching using the Up: Data Extraction Previous: The test-if-proceed routine

The action-on-element routine

This routine performs the actual rendering and displaying on a given element. The arguments are the HELEMENT2D, the HM2_GENERAL-structure, the element data of the current element and a pointer to arbitrary, user defined data. The last argument is of the type void* and can be used to pass data from the display method to the action_on_element routine.

Below the hm2_disp_draw_element routine is printed as an example.

static int hm2_disp_draw_element(HELEMENT2D*  helement,
                                 HM2_GENERAL* general,
                                 void*        el_data,
                                 void*        action_arg)
{
  GRAPHICDEVICE*          dev    = general->dev;
  HMESH2D*                hmesh  = (HMESH2D*)helement->mesh;
  HELEMENT2D_DESCRIPTION* descr  = 
      (HELEMENT2D_DESCRIPTION*)helement->descr;
  HM2_COORD_DATA* element_data = (HM2_COORD_DATA*)el_data;

  VEC3* vertex_coord = element_data->vertex_coord;
  int   i,number_of_vertices = descr->number_of_vertices;


  if(dev->grid_patch == G_GRID){
    dev->move(vertex_coord[number_of_vertices-1]);
    for(i=0;i<number_of_vertices;i++)
      dev->draw(vertex_coord[i]);
  }
  else{
    VEC3 normal;
    
    g_vec3_get_normal_to_plane_quietly(normal,
                                       vertex_coord[0],
                                       vertex_coord[1],
                                       vertex_coord[2]);
    dev->begin_patch();
    dev->patch_normal(normal);
    
    for(i=0;i<number_of_vertices;i++)
      dev->patch_vertex(vertex_coord[i]);
    
    dev->end_patch();
  }

  return TRUE;
}


next up previous contents
Next: Hierarchical Searching using the Up: Data Extraction Previous: The test-if-proceed routine

SFB 256 Universität Bonn and IAM Universität Freiburg

Copyright © by the Sonderforschungsbereich 256 at the Institut für Angewandte Mathematik, Universität Bonn.