Logo Search packages:      
Sourcecode: v-sim version File versions  Download package

void visuData_createNodes ( VisuData data,
VisuElement *  ele 
)

visuData_createNodes: : a VisuData object ; : a VisuElement object.

This create the glObjectList registered at (identifierAllNodes + the position of the in the object + 1) that contains all the nodes of the given VisuElement.

Definition at line 706 of file visu_data.c.

References _VisuData::fromVisuElementToInt, _VisuData::nodes, node_struct::number, _VisuData::numberOfStoredNodes, node_struct::rendered, and VISU_DATA_GET_CLASS.

{
  RenderingMethod *currentRenderingMethod;
  int *nEle;
  int j;
  int mat;

  g_return_if_fail(data && ele);

  nEle = (int*)g_hash_table_lookup(data->fromVisuElementToInt, (gpointer)ele);
  if (!nEle)
    {
      fprintf(stderr, "WARNING! 'visuData_createNodes' has been"
            " called but the given VisuElement %p-'%s' is not used.\n",
            (gpointer)ele, ele->name);
      return;
    }
  currentRenderingMethod = getRenderingMethodInUse();
  if (!currentRenderingMethod)
    {
      fprintf(stderr, "WARNING! 'visuData_createNodes' has been called but no"
            " rendering method has been selected.\n");
      return;
    }
  if (!currentRenderingMethod->createNode)
    {
      fprintf(stderr, "WARNING! 'visuData_createNodes' has been called but"
            " the current rendering method has no createNode method.\n");
      return;
    }

  if (!ele->materialIsUpToDate)
    visuElement_createMaterial(ele);
  
  glNewList(VISU_DATA_GET_CLASS(data)->identifierAllNodes + *nEle + 1, GL_COMPILE);
  if (ele->rendered)
    {
      DBG_fprintf(stderr, "Visu Data : creating glObjectList of nodes for '%s' - %d.\n",
              ele->name, ele->openGLIdentifier);
      /* Set the material by default if available. */
      mat = visuElementGet_identifierMaterial(ele);
      if (!mat)
      g_warning("Can't find the material identifier for the"
              " element '%s'.\n", ele->name);
      else
      glCallList(mat);
      for(j = 0; j < data->numberOfStoredNodes[*nEle]; j++)
      {
        if (data->nodes[*nEle][j].rendered)
          {
            glLoadName((GLuint)data->nodes[*nEle][j].number);
            currentRenderingMethod->createNode(data, &data->nodes[*nEle][j], ele);
          }
      }
    }
  else
    DBG_fprintf(stderr, "Visu Data : skipping glObjectList of nodes for '%s' - %d.\n",
            ele->name, ele->openGLIdentifier);
  glEndList();
}


Generated by  Doxygen 1.6.0   Back to index