Back to index

extremetuxracer  0.5beta
Public Member Functions | Private Member Functions | Private Attributes
pp::Model Class Reference

#include <model.h>

Collaboration diagram for pp::Model:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Model (const char *filename)
 ~Model ()
void draw ()
pp::PolyhedrongetPolyhedron ()
 returns a Polyhedron tree of the ModelObject Tree

Private Member Functions

void copyObject (pp::Polyhedron *ph, pp::ModelObject *object)

Private Attributes

int m_displayList
pp::ModelACmp_model

Detailed Description

Definition at line 33 of file model.h.


Constructor & Destructor Documentation

pp::Model::Model ( const char *  filename)

Definition at line 33 of file model.cpp.

 : m_displayList(-1)
{      
       mp_model = new ModelAC(filename);
       
       m_displayList = mp_model->getDisplayList();
}

Here is the call graph for this function:

Definition at line 41 of file model.cpp.

{
       delete mp_model;
}

Member Function Documentation

void pp::Model::copyObject ( pp::Polyhedron ph,
pp::ModelObject object 
) [private]

Definition at line 56 of file model.cpp.

{
       if(object->num_vert>0 && object->num_surf>0){
              int vert0 = ph->num_vertices;
              int poly0 = ph->num_polygons;
              
              for(int i=0; i<object->num_vert; i++){
                     ph->vertices[vert0+i]=object->vertices[i].vec;
                     ph->num_vertices++;
              }

              for(int i=0; i<object->num_surf; i++){
                     int num_vertices = object->surfaces[i].numVertices;
                     
                     if(num_vertices >10){
                            std::cout << "Warning: Vertices-> " <<
                                          num_vertices << std::endl;
                     }else{               
                            ph->polygons[poly0+i].numVertices = num_vertices; 
                            ph->polygons[poly0+i].vertices = new int[num_vertices];
                            
                            for(int u=0; u<num_vertices;u++){
                                   ph->polygons[poly0+i].vertices[u]=
                                          object->surfaces[i].vertices[u] + vert0;         
                            }
                            ph->num_polygons++;
                     }
              }
       }      
       
       for (int i = 0; i < object->num_kids; i++){
              copyObject(ph,object->kids[i]);    
       }      
}

Here is the caller graph for this function:

void pp::Model::draw ( )

Definition at line 47 of file model.cpp.

{
       if(m_displayList != -1){
              glCallList( m_displayList );
       }
}

Here is the caller graph for this function:

returns a Polyhedron tree of the ModelObject Tree

Definition at line 92 of file model.cpp.

{
       pp::Polyhedron* ph = new pp::Polyhedron;
       
       ph->num_vertices=0;
       ph->num_polygons=0;
       ph->vertices = new pp::Vec3d[1024];
       ph->polygons = new pp::Polygon[256];
              
       copyObject(ph,mp_model->getModel());
              
    return ph;       
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

int pp::Model::m_displayList [private]

Definition at line 34 of file model.h.

Definition at line 35 of file model.h.


The documentation for this class was generated from the following files: