Ejemplo n.º 1
0
void ObjLoader::addRawVerticePart (ObjMesh *mesh, FaceList &faces, int num) {
    std::vector<Face *>::iterator it = faces.begin();
    // Etape 1 : construire la liste des faces
    std::vector<int> triangleBuffer;
    std::vector<int> quadBuffer;
    std::vector<float> glVertexBuffer;

    int reservedSize = faces.size();
    triangleBuffer.reserve (reservedSize);
    quadBuffer.reserve (reservedSize);
    glVertexBuffer.reserve (3.*reservedSize);

    int indexVertex = 0;
    it = faces.begin();
    do {
        VertexObj v1 (*this, (*it)->vertices[0]);
        VertexObj v2 (*this, (*it)->vertices[1]);
        VertexObj v3 (*this, (*it)->vertices[2]);

        glVertexBuffer.push_back (v1.vertex.x);
        glVertexBuffer.push_back (v1.vertex.y);
        glVertexBuffer.push_back (v1.vertex.z);
        glVertexBuffer.push_back (v2.vertex.x);
        glVertexBuffer.push_back (v2.vertex.y);
        glVertexBuffer.push_back (v2.vertex.z);
        glVertexBuffer.push_back (v3.vertex.x);
        glVertexBuffer.push_back (v3.vertex.y);
        glVertexBuffer.push_back (v3.vertex.z);

        int index1 = indexVertex++;
        int index2 = indexVertex++;
        int index3 = indexVertex++;
        if ( (*it)->type == TRIANGLE) {
            triangleBuffer.push_back (index1);
            triangleBuffer.push_back (index2);
            triangleBuffer.push_back (index3);
        } else {
            VertexObj v4 (*this, (*it)->vertices[3]);

            glVertexBuffer.push_back (v4.vertex.x);
            glVertexBuffer.push_back (v4.vertex.y);
            glVertexBuffer.push_back (v4.vertex.z);

            int index4 = indexVertex++;

            quadBuffer.push_back (index1);
            quadBuffer.push_back (index2);
            quadBuffer.push_back (index3);
            quadBuffer.push_back (index4);
        }
        delete (*it);
    } while (++it != faces.end());
    // etape 2 : construire le Mesh pour le renderer
    SmoothGroup *theSmoothGroup = new SmoothGroup (glVertexBuffer, triangleBuffer, quadBuffer, false, false);
    mesh->addSmoothGroup (theSmoothGroup);
    // On nettoie tout !
    glVertexBuffer.erase (glVertexBuffer.begin(), glVertexBuffer.end());
    triangleBuffer.erase (triangleBuffer.begin(), triangleBuffer.end());
    quadBuffer.erase (quadBuffer.begin(), quadBuffer.end());
}
Ejemplo n.º 2
0
bool PolyMesh::convertFacesToGeometry( FaceList faces, GEOMETRY_FIX* geom )
{
    if ( !faces.size() || !geom ) return false;

    osg::ref_ptr<osg::DrawElementsUInt> indices = new osg::DrawElementsUInt( osg::PrimitiveSet::TRIANGLES, 0 );

    unsigned int i, index=0, firstIndex=0, lastIndex=0;
    for ( FaceList::iterator itr=faces.begin();
        itr!=faces.end();
        ++itr )
    {
        Face f = *(*itr);
        unsigned int size=f._pts.size();
        for ( i=0; i<size; ++i )
        {
            if ( i>2 )
            {
                indices->push_back( firstIndex );
                indices->push_back( lastIndex );
            }

            indices->push_back( f(i) );

            if ( !i ) firstIndex = indices->back();
            lastIndex = indices->back();
        }
    }

    geom->removePrimitiveSet( 0, geom->getPrimitiveSetList().size() );
    geom->addPrimitiveSet( indices.get() );
    geom->setTexCoordArray( 0, NULL );	// TEMP
    NormalVisitor::buildNormal( *geom );
    geom->dirtyDisplayList();
    return true;
}
Ejemplo n.º 3
0
        void Brush::restore(const FaceList& faces) {
            Utility::deleteAll(m_faces);

            FaceList::const_iterator it, end;
            for (it = faces.begin(), end = faces.end(); it != end; ++it) {
                Face* face = *it;
                face->setBrush(this);
                m_faces.push_back(face);
            }

            rebuildGeometry();
        }
Ejemplo n.º 4
0
bool PLY2Reader::loadPLY2Mesh(std::shared_ptr<Shape> shape, std::string fname)
{
  std::ifstream f_handler(fname);
  if (!f_handler)
  {
    std::cout << "Open file failed.\n";
    return false;
  }

  std::string line;
  std::stringstream ss;

  int num_vertex = 0;
  int num_face = 0;
  VertexList vertexList;
  FaceList faceList;
  STLVectorf UVList;

  getline(f_handler, line);
  ss.str(line);
  ss >> num_vertex;
  getline(f_handler, line);
  ss.str(line);
  ss >> num_face;

  for (int i = 0; i < num_vertex; ++i)
  {
    float v;
    for (int j = 0; j < 3; ++j)
    {
      getline(f_handler, line);
      ss.str(line);
      ss >> v;
      vertexList.push_back(v);
    }
  }

  for (int i = 0; i < num_face; ++i)
  {
    int f;
    for (int j = 0; j < 3; ++j)
    {
      getline(f_handler, line);
      ss.str(line);
      ss >> f;
      faceList.push_back(f);
    }
  }

  shape->init(vertexList, faceList, UVList);
  return true;
}
Ejemplo n.º 5
0
void GestureContext::postProcessRGB()
{
	GreyscaleImage grey = m_last_rgb_image->greyscale();
	FaceList *faces = m_face_detector->detect(grey, m_face_list->best());
	//FaceList *faces = m_face_detector->detect(grey);
	m_face_list->insert(*faces);
	Face *f = m_face_list->best();
	if (!faces->contains(f)) {
		m_face_list->miss(f);
	}
	faces->clear();
	delete(faces);
}
Ejemplo n.º 6
0
/**
 * Prints the polyhedra on the screen by calculating the intersection of three meshes 
 * each time.
 */
FaceList *
Polyhedron::print()
{
    FaceList * printing = new FaceList();
    FaceList::iterator iter;

    /* Going through the list of points and copy them into the new list. */
    for (iter = faces.begin(); iter != faces.end(); iter++) {
        printing->push_back((*iter)->transform(org, angle));
    }

    return printing;
}
Ejemplo n.º 7
0
        void Brush::restore(const Brush& brushTemplate, bool checkId) {
            if (checkId)
                assert(uniqueId() == brushTemplate.uniqueId());

            Utility::deleteAll(m_faces);

            const FaceList templateFaces = brushTemplate.faces();
            for (size_t i = 0; i < templateFaces.size(); i++) {
                Face* face = new Face(m_worldBounds, m_forceIntegerFacePoints, *templateFaces[i]);
                face->setBrush(this);
                m_faces.push_back(face);
            }

            rebuildGeometry();
        }
Ejemplo n.º 8
0
int FaceList::insert(FaceList &other)
{
	for (std::map< Face*, int >::iterator it = other.m_faces.begin(); it != other.m_faces.end(); it++) {
		insert(it->first, it->second);
	}
	return(other.size());
}
Ejemplo n.º 9
0
        Brush::Brush(const BBoxf& worldBounds, bool forceIntegerFacePoints, const FaceList& faces) :
        MapObject(),
        m_geometry(NULL),
        m_worldBounds(worldBounds),
        m_forceIntegerFacePoints(forceIntegerFacePoints) {
            init();

            FaceList::const_iterator it, end;
            for (it = faces.begin(), end = faces.end(); it != end; ++it) {
                Face* face = *it;
                face->setBrush(this);
                m_faces.push_back(face);
            }

            rebuildGeometry();
        }
Ejemplo n.º 10
0
	void WaterList::build(FaceList& waterFaces, Float32 waveHeight)
	{
		this->waveHeight = waveHeight;
		vertexes.clear();
		for (Vertex& vertex : waterFaces.getVertexes())
		{
			if (vertex.getFlag() == Vertex::Flag::Flow)
			{
				vertexes.push_back(WaterVertex(vertex, waveHeight));
			}
		}
	}
Ejemplo n.º 11
0
void CustomSmileyManager::loadSmileys( int groupIndex )
{
	// clear the table first
	for(int row = 0; row < tblFaceList->numRows(); row++){
			tblFaceList->removeRow(row);
	}
	tblFaceList->setNumRows(0);
	TQString dir = EvaMain::user->getSetting()->getCustomSmileyDir() + "/";

	if(groupIndex>0)
		dir += (m_Config->groupName( groupIndex) + "/");

	FaceList list = m_Config->groupMembers( groupIndex );
	int row = 0;
	if(list.size()){
		tblFaceList->setNumRows(list.size());
		tblFaceList->horizontalHeader()->setLabel( 0, i18n("No." ) );
		tblFaceList->horizontalHeader()->setLabel( 1, i18n("Smiley" ) );
		tblFaceList->horizontalHeader()->setLabel( 2, i18n("Shortcut" ) );
		for( FaceList::Iterator it = list.begin(); it != list.end(); ++it){
			//tblFaceList->setText(row, 0, TQString::number( row + 1));
			tblFaceList->setItem(row, 0, 
						new TQTableItem(tblFaceList, TQTableItem::Never,
									TQString::number(row + 1)));

			TQPixmap *pixmap = new TQPixmap(dir + (*it).fixed());
			CustomItem *item = new CustomItem(tblFaceList, (*it).tip(), *pixmap);
			tblFaceList->setItem(row, 1, item);

			CustomItem *itemSC = new CustomItem(tblFaceList, (*it).shortcut() );
			tblFaceList->setItem(row, 2, itemSC);

			tblFaceList->setRowHeight(row, pixmap->width() + 2);
			delete pixmap;
			row++;
		}
		tblFaceList->setColumnWidth(0, 20);
		tblFaceList->setColumnWidth(1, tblFaceList->visibleWidth() - 20 - 50 );
	}
}
Ejemplo n.º 12
0
void PolyMesh::findNeighbors( Face* f, FaceList& flist )
{
    unsigned int size = f->_pts.size();
    for ( unsigned int i=0; i<size; ++i )
    {
        Edge* edge = getEdge( (*f)[i%size], (*f)[(i+1)%size], _edges );
        if ( !edge ) continue;

        for ( FaceList::iterator itr=edge->_faces.begin();
            itr!=edge->_faces.end();
            ++itr )
        {
            if ( *itr!=f )
                flist.push_back( *itr );
        }
    }
}
Ejemplo n.º 13
0
// Starts the recursive fractal function
void CFractalMtn::CreateFractal(Point3List listStartVerts, FaceList listStartFaces, int levels)
{
	int nFaces = listStartFaces.size();
	
	for (int c=0; c<nFaces; c++)
	{
		Point3 vec1, vec2, vec3;

		vec1 = listStartVerts[listStartFaces[c].v1];
		vec2 = listStartVerts[listStartFaces[c].v2];
		vec3 = listStartVerts[listStartFaces[c].v3];

		if (c == 0)
		{
			m_ptMin = m_ptMax = vec1;
		}

		FractalSub(vec1, vec2, vec3, levels);
	}
}
void FastMassSpring::initEdgeGraph(
  FaceList& face_list,
  VertexList& vertex_list,
  AdjList& vertex_share_faces)
{
  this->P_Num = vertex_list.size() / 3;

  // building edge graph
  this->strech_edges.clear();
  {
    int ptid[3] = {0, 0, 0};
    for (decltype(face_list.size()) i = 0; i < face_list.size() / 3; ++i)
    {
      ptid[0] = face_list[3 * i + 0];
      ptid[1] = face_list[3 * i + 1];
      ptid[2] = face_list[3 * i + 2];
      // the order of start point and end point doesn't matter
      this->strech_edges.push_back(
        ptid[0] < ptid[1] ? Edge(ptid[0], ptid[1]) : Edge(ptid[1], ptid[0]));
      this->strech_edges.push_back(
        ptid[1] < ptid[2] ? Edge(ptid[1], ptid[2]) : Edge(ptid[2], ptid[1]));
      this->strech_edges.push_back(
        ptid[2] < ptid[0] ? Edge(ptid[2], ptid[0]) : Edge(ptid[0], ptid[2]));
    }
    std::sort(this->strech_edges.begin(), this->strech_edges.end());
    std::vector<Edge>::iterator iter = 
      std::unique(this->strech_edges.begin(), this->strech_edges.end());
    this->strech_edges.erase(iter, strech_edges.end());
    this->strech_edges.shrink_to_fit();

    // store rest length
    float cur_r = 0.0;
    this->strech_r_length.clear();
    for (auto& i : this->strech_edges)
    {
      cur_r = 0.0;
      for (int j = 0; j < 3; ++j)
      {
        cur_r += pow(vertex_list[3 * i.first + j] - vertex_list[ 3 * i.second + j], 2);
      }
      this->strech_r_length.push_back(sqrt(cur_r));
    }
  }

  this->bending_edges.clear();
  {
    for (auto& i : this->strech_edges)
    {
      int cross_pi = -1;
      int cross_pj = -1;
      if (findShareVertex(
        cross_pi, cross_pj, i.first, i.second, vertex_share_faces, face_list))
      {
        this->bending_edges.push_back(
          cross_pi < cross_pj ? 
            Edge(cross_pi, cross_pj) : Edge(cross_pj, cross_pi));
      }
    }

    // store rest length
    float cur_r = 0.0;
    this->bending_r_length.clear();
    for (auto& i : this->bending_edges)
    {
      cur_r = 0.0;
      for (int j = 0; j < 3; ++j)
      {
        cur_r += pow(vertex_list[3 * i.first + j] - vertex_list[ 3 * i.second + j], 2);
      }
      this->bending_r_length.push_back(sqrt(cur_r));
    }
  }

  // init d vector
  this->computedVector();
}
Ejemplo n.º 15
0
void ObjLoader::addVerticePart (ObjMesh *mesh, FaceList &faces, int num) {
    std::vector<Face *>::iterator it = faces.begin();
    std::map<VertexObj, int> vertexBuffer;
    // Etape 1 : construire la liste des sommets (vert) uniques
    int addedVerticesNumber = 0;
    do {
        VertexObj v1 (*this, (*it)->vertices[0]);
        vertexBuffer[v1] = ++addedVerticesNumber;
        VertexObj v2 (*this, (*it)->vertices[1]);
        vertexBuffer[v2] = ++addedVerticesNumber;
        VertexObj v3 (*this, (*it)->vertices[2]);
        vertexBuffer[v3] = ++addedVerticesNumber;

        if ( (*it)->type == QUAD) {
            VertexObj v4 (*this, (*it)->vertices[3]);
            vertexBuffer[v4] = ++addedVerticesNumber;

        }
    } while (++it != faces.end());

    // Etape 2 : numeroter les sommets
    int newnumber = 0;
    for (std::map<VertexObj, int>::iterator vm = vertexBuffer.begin(); vm != vertexBuffer.end(); ++vm)
        vm->second = newnumber++;

    // Etape 3 : construire la liste des faces
    std::vector<int> triangleBuffer;
    std::vector<int> quadBuffer;

    int reservedSize = faces.size();
    triangleBuffer.reserve (reservedSize);
    quadBuffer.reserve (reservedSize);

    it = faces.begin();
    do {
        VertexObj v1 (*this, (*it)->vertices[0]);
        VertexObj v2 (*this, (*it)->vertices[1]);
        VertexObj v3 (*this, (*it)->vertices[2]);
        int index1 = vertexBuffer.find (v1)->second;
        int index2 = vertexBuffer.find (v2)->second;
        int index3 = vertexBuffer.find (v3)->second;

        if ( (*it)->type == TRIANGLE) {
            triangleBuffer.push_back (index1);
            triangleBuffer.push_back (index2);
            triangleBuffer.push_back (index3);
        } else {
            VertexObj v4 (*this, (*it)->vertices[3]);
            int index4 = vertexBuffer.find (v4)->second;
            quadBuffer.push_back (index1);
            quadBuffer.push_back (index2);
            quadBuffer.push_back (index3);
            quadBuffer.push_back (index4);
        }
        delete (*it);
    } while (++it != faces.end());

    // etape4 : construire le tableau de sommet final
    std::vector<float> glVertexBuffer;
    for (std::map<VertexObj, int>::iterator vm = vertexBuffer.begin(); vm != vertexBuffer.end(); ++vm) {
        glVertexBuffer.push_back (vm->first.vertex.x);
        glVertexBuffer.push_back (vm->first.vertex.y);
        glVertexBuffer.push_back (vm->first.vertex.z);
    }
    // etape 5 : construire le Mesh pour le renderer
    SmoothGroup *theSmoothGroup = new SmoothGroup (glVertexBuffer, triangleBuffer, quadBuffer, false, false);
    mesh->addSmoothGroup (theSmoothGroup);

    // On nettoie tout !
    glVertexBuffer.erase (glVertexBuffer.begin(), glVertexBuffer.end());
    triangleBuffer.erase (triangleBuffer.begin(), triangleBuffer.end());
    quadBuffer.erase (quadBuffer.begin(), quadBuffer.end());
    vertexBuffer.erase (vertexBuffer.begin(), vertexBuffer.end());
}
Ejemplo n.º 16
0
/** remove one group, 2 options:
      1: remove all smileys in this group, then remove the group itself
      2: move all sub items into another group, then remove the empty group

     NOTE: this operation is un-recoverable.
*/
void CustomSmileyManager::slotRemoveGroupClicked( )
{
	if(!m_Config) return;

	TQListViewItem *item = lvGroups->selectedItem();
	if(item){
		if(item == lvGroups->firstChild()) return; // never remove default group

		int index = m_Config->groupIndex( item->text( 0 ) );
		if(index <= -1) return;

		TQString path = EvaMain::user->getSetting()->getCustomSmileyDir() + "/";
		TQDir dir( path + item->text(0) );
		FaceList list = m_Config->groupMembers( index);
		int result = -2;
		if(list.size() > 0 ){
			result = RmSmileyGroupDialog::QueryDialog( index, m_Config, this);
			switch(result){
				case -2: // abort
					return;
					break;
				case -1:  // remove all
					break;
				default: // otherwise, move to result
				{
					if(dir.exists()){
						dir.setFilter( TQDir::Files | TQDir::Hidden | TQDir::NoSymLinks );
						const TQFileInfoList *list = dir.entryInfoList();
						TQFileInfoListIterator it( *list);
						TQFileInfo *fi;
						TQString destDir = path;
						if(result>0)
							destDir += ( m_Config->groupName( result ) + "/") ;
						while( (fi = it.current() ) != 0 ){
							EvaHelper::copyFile(fi->absFilePath(), (destDir + fi->fileName()) );
							++it;
						}
					}
					m_Config->moveChildrenTo(index, result);
					m_IsChanged = true;
				}
			}
		}

		if(dir.exists()){
			// update the in-memory config
			if(m_Config->removeGroup( index )){
				lvGroups->takeItem( item);
				delete item;
				m_IsChanged = true;
			} else return;

			dir.setFilter( TQDir::Files | TQDir::Hidden | TQDir::NoSymLinks );
			const TQFileInfoList *list = dir.entryInfoList();
			TQFileInfoListIterator it( *list);
			TQFileInfo *fi;
			while( (fi = it.current() ) != 0 ){
				dir.remove( fi->absFilePath() );
				++it;
			}
			// as all files have been deleted,  we need keep the config file up to date.
			m_Config->saveXML();
			if( ! dir.rmdir( dir.path(), true)){
				KMessageBox::error( this, i18n( "Remove directory \"%1\" failed. " ).arg( dir.path() ),
							i18n( "Remove Directory!" ) );
			}
		}
	}
}
Ejemplo n.º 17
0
// Load the landscape
void LoadMountain()
{
	// Initial landscape face and vertex data generated in 
	// 3dsMAX and exported with a MAXScript script.
	Point3 verts[125] = {
		{-30.0f, -5.79f, 19.38f},	{-24.0f, -5.79f, 19.38f},	{-18.0f, -5.79f, 19.38f},
		{-12.0f, -5.79f, 19.38f},	{-6.0f, -5.79f, 19.38f},	{0.0f, -5.79f, 19.38f},
		{5.99f, -5.79f, 19.38f},	{11.99f, -5.79f, 19.38f},	{17.99f, -5.79f, 19.38f},
		{23.99f, -5.79f, 19.38f},	{29.99f, -5.79f, 19.38f},	{-30.0f, -4.17f, 15.72f},
		{-24.0f, -4.17f, 15.72f},	{-18.0f, -4.17f, 15.72f},	{-12.0f, -4.17f, 15.72f},
		{-6.0f, -4.17f, 15.72f},	{0.0f, -4.17f, 15.72f},	{5.99f, -4.17f, 15.72f},
		{11.99f, -4.17f, 15.72f},	{17.99f, -4.17f, 15.72f},	{23.99f, -4.17f, 15.72f},
		{29.99f, -4.17f, 15.72f},	{-30.0f, -2.54f, 12.07f},	{-24.0f, -2.54f, 12.07f},
		{-18.0f, -2.54f, 12.07f},	{-12.0f, -2.54f, 12.07f},	{-6.0f, -2.54f, 12.07f},
		{0.0f, -2.54f, 12.07f},	{5.99f, -2.54f, 12.07f},	{11.99f, -2.54f, 12.07f},
		{17.99f, -2.54f, 12.07f},	{23.99f, -2.54f, 12.07f},	{29.99f, -2.54f, 12.07f},
		{-30.0f, -1.74f, 7.57f},	{-24.0f, -1.74f, 7.57f},	{-18.0f, -1.74f, 7.57f},
		{-12.0f, -1.74f, 7.57f},	{-6.0f, -1.74f, 7.57f},	{0.0f, -1.74f, 7.57f},
		{5.99f, -1.96f, 7.57f},	{11.99f, -1.74f, 7.57f},	{17.99f, -1.74f, 7.57f},
		{23.99f, -1.74f, 7.57f},	{29.99f, -1.74f, 7.57f},	{-30.0f, -0.86f, 3.57f},
		{-24.0f, -0.86f, 3.57f},	{-18.0f, -0.86f, 3.57f},	{-12.0f, -0.86f, 3.57f},
		{-6.0f, -0.86f, 3.57f},	{0.0f, -0.86f, 3.57f},	{5.99f, -0.86f, 3.57f},
		{11.99f, -0.86f, 3.57f},	{17.99f, -0.86f, 3.57f},	{23.99f, -0.86f, 3.57f},
		{29.99f, -0.86f, 3.57f},	{-30.0f, 0.0f, -0.42f},	{-24.0f, 0.0f, -0.42f},
		{-18.0f, 0.0f, -0.42f},	{-12.0f, 0.0f, -0.42f},	{-6.0f, 0.0f, -0.42f},
		{0.0f, 0.0f, -0.42f},	{5.99f, 0.0f, -0.42f},	{11.99f, 0.0f, -0.42f},
		{17.99f, 0.0f, -0.42f},	{23.99f, 0.0f, -0.42f},	{29.99f, 0.0f, -0.42f},
		{-30.0f, -0.03f, -4.42f},	{-24.0f, -0.03f, -4.42f},	{-18.0f, -0.03f, -4.42f},
		{-12.0f, -0.03f, -4.42f},	{-6.0f, -0.03f, -4.42f},	{0.0f, -0.03f, -4.42f},
		{5.99f, -0.03f, -4.42f},	{11.99f, -0.03f, -4.42f},	{17.99f, 3.16f, -4.42f},
		{23.99f, 3.16f, -4.42f},	{29.99f, -0.03f, -4.42f},	{-30.0f, -0.06f, -8.42f},
		{-24.2f, 11.32f, -8.51f},	{-18.2f, 11.32f, -8.51f},	{-12.0f, -0.06f, -8.42f},
		{-6.0f, -0.06f, -8.42f},	{0.0f, -0.06f, -8.42f},	{5.99f, -0.06f, -8.42f},
		{11.99f, -0.06f, -8.42f},	{17.99f, 3.13f, -8.42f},	{23.99f, 3.13f, -8.42f},
		{29.99f, -0.06f, -8.42f},	{-30.0f, -0.1f, -12.41f},	{-24.18f, 10.58f, -12.51f},
		{-18.18f, 10.58f, -12.51f},	{-12.2f, 11.29f, -12.51f},	{-6.0f, -0.1f, -12.41f},
		{0.0f, -0.1f, -12.41f},	{5.99f, -0.1f, -12.41f},	{11.99f, -0.1f, -12.41f},
		{17.99f, -0.1f, -12.41f},	{23.99f, -0.1f, -12.41f},	{29.99f, -0.1f, -12.41f},
		{-30.0f, -0.13f, -16.41f},	{-24.18f, 10.54f, -16.51f},	{-18.18f, 10.54f, -16.51f},
		{-12.2f, 11.25f, -16.51f},	{-6.0f, 5.19f, -16.41f},	{0.0f, 5.19f, -16.41f},
		{5.99f, 7.68f, -16.41f},	{11.99f, 7.68f, -16.41f},	{17.99f, 7.68f, -16.41f},
		{23.99f, 7.68f, -16.41f},	{29.99f, -0.13f, -16.41f},	{-30.0f, -0.17f, -20.41f},
		{-24.0f, -0.17f, -20.41f},	{-18.0f, -0.17f, -20.41f},	{-12.0f, -0.17f, -20.41f},
		{-6.0f, -0.17f, -20.41f},	{0.0f, -0.17f, -20.41f},	{5.99f, -0.17f, -20.41f},
		{11.99f, -0.17f, -20.41f},	{17.99f, -0.17f, -20.41f},	{23.99f, -0.17f, -20.41f},
		{29.99f, -0.17f, -20.41f},	{0.0f, -1.74f, 7.57f},	{0.0f, -2.42f, 7.57f},
		{5.99f, -1.74f, 7.57f},	{0.0f, -2.64f, 7.57f}
	};
	Face faces[200] = {
		{11, 0, 12},	{1, 12, 0},	{12, 1, 13},
		{2, 13, 1},	{13, 2, 14},	{3, 14, 2},
		{14, 3, 15},	{4, 15, 3},	{15, 4, 16},
		{5, 16, 4},	{16, 5, 17},	{6, 17, 5},
		{17, 6, 18},	{7, 18, 6},	{18, 7, 19},
		{8, 19, 7},	{19, 8, 20},	{9, 20, 8},
		{20, 9, 21},	{10, 21, 9},	{22, 11, 23},
		{12, 23, 11},	{23, 12, 24},	{13, 24, 12},
		{24, 13, 25},	{14, 25, 13},	{25, 14, 26},
		{15, 26, 14},	{26, 15, 27},	{16, 27, 15},
		{27, 16, 28},	{17, 28, 16},	{28, 17, 29},
		{18, 29, 17},	{29, 18, 30},	{19, 30, 18},
		{30, 19, 31},	{20, 31, 19},	{31, 20, 32},
		{21, 32, 20},	{33, 22, 34},	{23, 34, 22},
		{34, 23, 35},	{24, 35, 23},	{35, 24, 36},
		{25, 36, 24},	{36, 25, 37},	{26, 37, 25},
		{37, 26, 38},	{27, 38, 26},	{38, 27, 39},
		{28, 39, 27},	{39, 28, 40},	{29, 40, 28},
		{40, 29, 41},	{30, 41, 29},	{41, 30, 42},
		{31, 42, 30},	{42, 31, 43},	{32, 43, 31},
		{44, 33, 45},	{34, 45, 33},	{45, 34, 46},
		{35, 46, 34},	{46, 35, 47},	{36, 47, 35},
		{47, 36, 48},	{37, 48, 36},	{48, 37, 49},
		{38, 49, 37},	{49, 38, 50},	{39, 50, 38},
		{50, 39, 51},	{40, 51, 39},	{51, 40, 52},
		{41, 52, 40},	{52, 41, 53},	{42, 53, 41},
		{53, 42, 54},	{43, 54, 42},	{55, 44, 56},
		{45, 56, 44},	{56, 45, 57},	{46, 57, 45},
		{57, 46, 58},	{47, 58, 46},	{58, 47, 59},
		{48, 59, 47},	{59, 48, 60},	{49, 60, 48},
		{60, 49, 61},	{50, 61, 49},	{61, 50, 62},
		{51, 62, 50},	{62, 51, 63},	{52, 63, 51},
		{63, 52, 64},	{53, 64, 52},	{64, 53, 65},
		{54, 65, 53},	{66, 55, 67},	{56, 67, 55},
		{67, 56, 68},	{57, 68, 56},	{68, 57, 69},
		{58, 69, 57},	{69, 58, 70},	{59, 70, 58},
		{70, 59, 71},	{60, 71, 59},	{71, 60, 72},
		{61, 72, 60},	{72, 61, 73},	{62, 73, 61},
		{73, 62, 74},	{63, 74, 62},	{74, 63, 75},
		{64, 75, 63},	{75, 64, 76},	{65, 76, 64},
		{77, 66, 78},	{67, 78, 66},	{78, 67, 79},
		{68, 79, 67},	{79, 68, 80},	{69, 80, 68},
		{80, 69, 81},	{70, 81, 69},	{81, 70, 82},
		{71, 82, 70},	{82, 71, 83},	{72, 83, 71},
		{83, 72, 84},	{73, 84, 72},	{84, 73, 85},
		{74, 85, 73},	{85, 74, 86},	{75, 86, 74},
		{86, 75, 87},	{76, 87, 75},	{88, 77, 89},
		{78, 89, 77},	{89, 78, 90},	{79, 90, 78},
		{90, 79, 91},	{80, 91, 79},	{91, 80, 92},
		{81, 92, 80},	{92, 81, 93},	{82, 93, 81},
		{93, 82, 94},	{83, 94, 82},	{94, 83, 95},
		{84, 95, 83},	{95, 84, 96},	{85, 96, 84},
		{96, 85, 97},	{86, 97, 85},	{97, 86, 98},
		{87, 98, 86},	{99, 88, 100},	{89, 100, 88},
		{100, 89, 101},	{90, 101, 89},	{101, 90, 102},
		{91, 102, 90},	{102, 91, 103},	{92, 103, 91},
		{103, 92, 104},	{93, 104, 92},	{104, 93, 105},
		{94, 105, 93},	{105, 94, 106},	{95, 106, 94},
		{106, 95, 107},	{96, 107, 95},	{107, 96, 108},
		{97, 108, 96},	{108, 97, 109},	{98, 109, 97},
		{110, 99, 111},	{100, 111, 99},	{111, 100, 112},
		{101, 112, 100},	{112, 101, 113},	{102, 113, 101},
		{113, 102, 114},	{103, 114, 102},	{114, 103, 115},
		{104, 115, 103},	{115, 104, 116},	{105, 116, 104},
		{116, 105, 117},	{106, 117, 105},	{117, 106, 118},
		{107, 118, 106},	{118, 107, 119},	{108, 119, 107},
		{119, 108, 120},	{109, 120, 108}
	};

	Point3List vertList;
	FaceList faceList;
	int c;

	// Position the landscape a bit to line everything up
	Point3 pos = {0.0, -0.75, -2.8};

	// Load the vertices into a list
	for (c=0;c<125;c++)
		vertList.push_back(verts[c]);

	// Load the faces into a list
	for (c=0;c<200;c++)
		faceList.push_back(faces[c]);

	// Load a texture
#ifdef WIN32
	g_mtn1.LoadTexture("../textures/landscape.bmp");
#else
	g_mtn1.LoadTexture("../textures/landscape.ppm");
#endif

	// Create the fractal using 5 recursion levels
	g_mtn1.CreateFractal(vertList, faceList, 3);

	// Pre-render and set the position
	g_mtn1.PreCache();
	g_mtn1.SetPosition(pos);
}